/* Portal Duby Analytics — estilos globais */

:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --bg-elevated: #151a22;
  --surface: #1a2230;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eef7;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  /* Fundo tema claro (login/portal) — abaixo; tema escuro usa gradientes puros, como .page-login--landing */
  --duby-bg-photo-light: url("/static/img/Gradiente%20claro.jpg");

  /* ----- Tokens de gráficos/cards (invertem por tema) ----- */
  /* fundo neutro dentro de cards/SVGs */
  --chart-bg: rgba(255, 255, 255, 0.02);
  --chart-bg-strong: rgba(255, 255, 255, 0.04);
  /* linhas-guia / grid */
  --chart-grid: rgba(148, 163, 184, 0.18);
  --chart-grid-strong: rgba(148, 163, 184, 0.35);
  --chart-grid-faint: rgba(148, 163, 184, 0.12);
  /* texto auxiliar dentro de SVG (eixos, labels) */
  --chart-text: rgba(148, 163, 184, 0.85);
  --chart-text-strong: #e8eef7;
  /* superfícies / cards (genérico) */
  --card-bg: rgba(18, 22, 36, 0.65);
  --card-border: rgba(148, 163, 184, 0.18);
  /* paleta semântica para séries (cores fixas — escolhidas para contraste em ambos os temas) */
  --series-sky: rgba(56, 189, 248, 0.95);
  --series-sky-soft: rgba(56, 189, 248, 0.6);
  --series-rose: rgba(244, 114, 182, 0.95);
  --series-rose-soft: rgba(244, 114, 182, 0.6);
  --series-violet: rgba(167, 139, 250, 0.95);
  --series-violet-soft: rgba(167, 139, 250, 0.6);
  --series-amber: rgba(251, 191, 36, 0.95);
  --series-emerald: rgba(52, 211, 153, 0.95);
  --series-cyan: rgba(34, 211, 238, 0.95);
  --series-indigo: rgba(129, 140, 248, 0.95);
  --series-red: rgba(248, 113, 113, 0.95);
}

/* Sobrescritas de tokens para tema escuro explícito (mantém o default) */
html[data-login-theme="dark"] {
  color-scheme: dark;
  --chart-bg: rgba(255, 255, 255, 0.02);
  --chart-bg-strong: rgba(255, 255, 255, 0.04);
  --chart-grid: rgba(148, 163, 184, 0.18);
  --chart-grid-strong: rgba(148, 163, 184, 0.35);
  --chart-grid-faint: rgba(148, 163, 184, 0.12);
  --chart-text: rgba(148, 163, 184, 0.85);
  --chart-text-strong: #e8eef7;
  --card-bg: rgba(18, 22, 36, 0.65);
  --card-border: rgba(148, 163, 184, 0.18);
}

/* Tokens equivalentes para o tema claro — usados por SVGs/JS/cards genéricos */
html[data-login-theme="light"] {
  color-scheme: light;
  /* superfícies/textos globais */
  --bg: #f1f5fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --border: rgba(18, 40, 63, 0.12);
  --text: #12283f;
  --muted: #334155;
  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.12);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.12);
  --shadow: 0 16px 40px rgba(38, 39, 86, 0.12);
  /* charts/cards */
  --chart-bg: rgba(241, 245, 249, 0.7);
  --chart-bg-strong: rgba(226, 232, 240, 0.75);
  --chart-grid: rgba(51, 65, 85, 0.38);
  --chart-grid-strong: rgba(51, 65, 85, 0.52);
  --chart-grid-faint: rgba(51, 65, 85, 0.24);
  --chart-text: #334155;
  --chart-text-strong: #12283f;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(18, 40, 63, 0.1);
  /* séries com leve ajuste para contraste sobre branco */
  --series-sky: #0284c7;
  --series-sky-soft: rgba(2, 132, 199, 0.55);
  --series-rose: #be185d;
  --series-rose-soft: rgba(190, 24, 93, 0.55);
  --series-violet: #6d28d9;
  --series-violet-soft: rgba(109, 40, 217, 0.55);
  --series-amber: #b45309;
  --series-emerald: #047857;
  --series-cyan: #0e7490;
  --series-indigo: #4338ca;
  --series-red: #b91c1c;
}

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

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(
      ellipse 120% 80% at 50% -40%,
      rgba(56, 189, 248, 0.12),
      transparent 55%
    ),
    radial-gradient(ellipse 90% 50% at 100% 50%, rgba(99, 102, 241, 0.06), transparent);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
}

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Portal (ex.: /space): usar melhor a largura em telas grandes */
body.page-portal .container {
  max-width: min(1480px, 96vw);
  padding-inline: clamp(1rem, 2.4vw, 2.25rem);
}

/* Spaces: ainda mais largura útil */
body.page-space .container {
  max-width: none;
  padding-inline: clamp(0.6rem, 1.6vw, 1.25rem);
}

/* ----- Top bar ----- */

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 28, 0.85);
  backdrop-filter: blur(12px);
}

/* Portal: barra superior fixa no topo, sempre visível mesmo em scroll interno
   (dropdown do usuário continua acima dos cards via z-index) */
body.page-portal {
  --topbar-h: 57px;
  padding-top: var(--topbar-h);
}

body.page-portal .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
}

.topbar__start {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.topbar-icon-btn--menu svg {
  width: 22px;
  height: 22px;
}

.topbar__search {
  position: relative;
  flex: 0 1 460px;
  max-width: 520px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 40px;
  padding: 0 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.topbar__search-icon {
  color: rgba(226, 232, 240, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.topbar__search-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.topbar__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(241, 245, 249, 0.95);
  font: inherit;
  font-size: 0.88rem;
}

.topbar__search-input::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.topbar__search-kbd {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.12rem 0.42rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(226, 232, 240, 0.82);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.actas-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.25);
  background: rgba(124, 58, 237, 0.12);
  color: rgba(241, 245, 249, 0.95);
  max-width: min(520px, 42vw);
}

.actas-pill__label {
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.82);
}

.actas-pill__value {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.actas-pill__btn {
  height: 28px;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(241, 245, 249, 0.95);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.actas-pill__btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(56, 189, 248, 0.35);
}

.actas-pill__btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .actas-pill {
    display: none;
  }
}

.topbar__tools {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.topbar-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(224, 231, 245, 0.88);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.topbar-icon-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.65);
  outline-offset: 2px;
}

.topbar-icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

.topbar-icon-btn--notify {
  position: relative;
}

.topbar-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 4px;
  border-radius: 999px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(15, 20, 28, 0.95);
}

.topbar__sep {
  width: 1px;
  height: 26px;
  flex-shrink: 0;
  margin-inline: 0.15rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand--link {
  color: inherit;
  text-decoration: none;
}

.brand--link:hover .brand__img {
  opacity: 0.88;
}

.brand__img {
  display: block;
  height: 28px;
  width: auto;
}

/* ----- User menu ----- */

.user-menu {
  position: relative;
}

.user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.user-menu__trigger:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.user-menu__avatar-wrap {
  display: inline-flex;
}

.user-menu__avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface);
}

.user-menu__avatar--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--border);
}

.user-menu__name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu__caret {
  font-size: 0.65rem;
  opacity: 0.7;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 50;
}

.user-dropdown--rich {
  min-width: 288px;
  padding: 0;
  overflow: hidden;
}

.user-dropdown__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--border);
}

.user-dropdown__avatar-wrap {
  display: inline-flex;
  flex-shrink: 0;
}

.user-dropdown__avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface);
}

.user-dropdown__avatar--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--border);
}

.user-dropdown__who {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.user-dropdown__name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown__email {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown__badge {
  align-self: flex-start;
  margin-top: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.user-dropdown__divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.2rem 0.65rem;
}

.user-dropdown__lines {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.user-dropdown__title {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
}

.user-dropdown__desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.user-dropdown__item--rich {
  align-items: flex-start;
  padding: 0.65rem 0.85rem;
}

.user-dropdown__item--rich .user-dropdown__icon {
  align-self: flex-start;
  margin-top: 0.15rem;
}

.user-dropdown__item--danger .user-dropdown__desc {
  color: rgba(248, 113, 113, 0.85);
}

.user-dropdown--rich .user-dropdown__header + .user-dropdown__item {
  margin-top: 0.25rem;
}

.user-dropdown--hidden {
  display: none;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-dropdown__item:hover {
  background: var(--accent-dim);
}

.user-dropdown__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.user-dropdown__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.user-dropdown__item:hover .user-dropdown__icon {
  color: var(--text);
}

.user-dropdown__item--upload {
  cursor: pointer;
}

.user-dropdown__item--danger {
  color: var(--danger);
}

.user-dropdown__item--danger .user-dropdown__icon {
  color: var(--danger);
}

.user-dropdown__item--danger:hover {
  background: var(--danger-soft);
}

.user-dropdown__item--danger:hover .user-dropdown__icon {
  color: var(--danger);
}

/* ----- Portal (dashboard / conexões): fundo e tema (botão na topbar) ----- */

html[data-login-theme="dark"] body.page-portal {
  /* Mesmo roxo/azul noturno da login em .page-login--landing (sem fotografia), radiais centralizados */
  background-color: #050110;
  background-image: radial-gradient(
      ellipse 80% 58% at 50% 36%,
      rgba(72, 48, 108, 0.42) 0%,
      transparent 58%
    ),
    radial-gradient(ellipse 100% 48% at 50% 88%, rgba(28, 18, 45, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, #080410 0%, #050110 42%, #030208 100%);
  background-position: center center, center center, center center;
  background-size: 100% 100%, 100% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

/* Tema claro do portal (dashboard, conexões e Spaces): mesmo gradiente
   da landing de login (Gradiente claro.jpg) com overlay branco translúcido,
   cover + attachment fixed para o fundo cobrir a viewport e não rolar junto
   com o conteúdo. */
html[data-login-theme="light"] body.page-portal {
  color: #12283f;
  background-color: #f7fafc;
  background-image: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.72) 0%,
      rgba(248, 250, 255, 0.58) 45%,
      rgba(242, 246, 252, 0.62) 100%
    ),
    var(--duby-bg-photo-light);
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  background-size: 100% 100%, cover;
  background-position: center center, center center;
}

html[data-login-theme="light"] body.page-portal a {
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal a:hover {
  color: #4c1d95;
}

html[data-login-theme="light"] body.page-portal .actas-pill {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(91, 33, 182, 0.28);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .actas-pill__label {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .actas-pill__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .actas-pill__btn {
  background: rgba(109, 40, 217, 0.1);
  border-color: rgba(91, 33, 182, 0.32);
  color: #4c1d95;
}

html[data-login-theme="light"] body.page-portal .actas-pill__btn:hover {
  background: rgba(109, 40, 217, 0.16);
  border-color: rgba(91, 33, 182, 0.45);
  color: #3b0764;
}

html[data-login-theme="light"] body.page-portal .topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .topbar__search {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .topbar__search-icon {
  color: rgba(18, 40, 63, 0.82);
}

html[data-login-theme="light"] body.page-portal .topbar__search-input {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .topbar__search-input::placeholder {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .topbar__search-kbd {
  border-color: rgba(18, 40, 63, 0.14);
  background: rgba(255, 255, 255, 0.75);
  color: rgba(18, 40, 63, 0.72);
}

html[data-login-theme="light"] body.page-portal .topbar-badge {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(248, 250, 252, 0.98);
}

html[data-login-theme="light"] body.page-portal .topbar-icon-btn {
  color: #000000;
}

html[data-login-theme="light"] body.page-portal .topbar-icon-btn svg,
html[data-login-theme="light"] body.page-portal .topbar-icon-btn svg path {
  color: #000000;
  stroke: #000000;
}

html[data-login-theme="light"] body.page-portal .topbar-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #000000;
}

html[data-login-theme="light"] body.page-portal .topbar-icon-btn:hover svg,
html[data-login-theme="light"] body.page-portal .topbar-icon-btn:hover svg path {
  color: #000000;
  stroke: #000000;
}

html[data-login-theme="light"] body.page-portal .topbar-icon-btn:focus-visible {
  outline-color: rgba(59, 130, 246, 0.5);
}

html[data-login-theme="light"] body.page-portal .topbar__sep {
  background: rgba(18, 40, 63, 0.2);
}

html[data-login-theme="light"] body.page-portal .brand__img {
  filter: brightness(0.22);
}

html[data-login-theme="light"] body.page-portal .user-menu__trigger {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .user-menu__trigger:hover {
  border-color: rgba(109, 40, 217, 0.35);
}

html[data-login-theme="light"] body.page-portal .user-dropdown {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
  box-shadow: 0 16px 40px rgba(38, 39, 86, 0.1);
}

html[data-login-theme="light"] body.page-portal .user-dropdown__item {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__item:hover {
  background: rgba(109, 40, 217, 0.08);
}

html[data-login-theme="light"] body.page-portal .user-dropdown__icon {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__item:hover .user-dropdown__icon {
  color: #412884;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__header {
  border-bottom-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .user-dropdown__name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__email {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__desc {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__divider {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .user-dropdown__badge {
  background: rgba(109, 40, 217, 0.12);
  color: #5b21b6;
  border-color: rgba(109, 40, 217, 0.28);
}

html[data-login-theme="light"] body.page-portal .user-dropdown__avatar--ph {
  border-color: rgba(18, 40, 63, 0.14);
  color: #7c3aed;
}

html[data-login-theme="light"] body.page-portal .user-dropdown__item--danger .user-dropdown__desc {
  color: rgba(220, 38, 38, 0.85);
}

html[data-login-theme="light"] body.page-portal .muted {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .login-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(18, 40, 63, 0.1);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .login-card__title,
html[data-login-theme="light"] body.page-portal .connections-title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-lead {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .connections-lead strong {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-search {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

html[data-login-theme="light"] body.page-portal .connections-search__icon {
  color: rgba(18, 40, 63, 0.68);
}

html[data-login-theme="light"] body.page-portal .connections-search__input {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-search__input::placeholder {
  color: rgba(18, 40, 63, 0.62);
}

html[data-login-theme="light"] body.page-portal .connections-count {
  color: #334155;
  border-color: rgba(18, 40, 63, 0.14);
  background: rgba(248, 250, 252, 0.95);
}

html[data-login-theme="light"] body.page-portal .connections-empty {
  border-color: rgba(18, 40, 63, 0.14);
  color: #475569;
  background: rgba(255, 255, 255, 0.88);
}

html[data-login-theme="light"] body.page-portal .connections-empty__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-empty__desc {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .connections-empty__icon {
  color: #334155;
  border-color: rgba(18, 40, 63, 0.14);
  background: rgba(248, 250, 252, 0.95);
}

html[data-login-theme="light"] body.page-portal .connections-table-wrap {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .connections-table th {
  background: rgba(248, 250, 252, 0.95);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-table td {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-table tbody tr:nth-child(2n) td {
  background: rgba(248, 250, 252, 0.55);
}

html[data-login-theme="light"] body.page-portal .connections-table tbody tr:hover td {
  background: rgba(109, 40, 217, 0.06);
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err) {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err) svg {
  color: #12283f;
  stroke: currentColor;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err):hover:not(:disabled) {
  color: #0f1f33;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err):hover:not(:disabled) svg {
  color: #0f1f33;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn--ok {
  border-color: rgba(21, 128, 61, 0.35);
  color: #15803d;
  background: rgba(220, 252, 231, 0.75);
}

html[data-login-theme="light"] body.page-portal .conn-action-btn--err {
  border-color: rgba(185, 28, 28, 0.3);
  color: #b91c1c;
  background: rgba(254, 226, 226, 0.65);
}

html[data-login-theme="light"] body.page-portal .conn-action-spinner {
  border-color: rgba(18, 40, 63, 0.2);
  border-top-color: #334155;
}

html[data-login-theme="light"] body.page-portal .footer.footer--minimal {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .footer.footer--minimal .muted {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .modal {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .modal__head {
  border-bottom-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .modal__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .modal__brand {
  filter: brightness(0.22);
}

html[data-login-theme="light"] body.page-portal .modal__close {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .modal__close:hover {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .modal__intro {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .modal__intro code {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .modal--wide .modal__head,
html[data-login-theme="light"] body.page-portal #diagram-modal-overlay .modal--wide .modal__head {
  background: #ffffff;
}

html[data-login-theme="light"] body.page-portal .sync-loading,
html[data-login-theme="light"] body.page-portal .diagram-loading {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .sync-tables-wrap {
  background: #f8fafc;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .sync-tables__head {
  box-shadow: 0 4px 14px rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .sync-tables__head .check {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .sync-search {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .sync-search::placeholder {
  color: rgba(18, 40, 63, 0.55);
}

html[data-login-theme="light"] body.page-portal .seg {
  background: #f1f5f9;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .seg__btn {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .seg__btn:hover {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .seg__btn--active {
  background: rgba(109, 40, 217, 0.18);
  color: #3b0764;
}

html[data-login-theme="light"] body.page-portal .sync-filter-selected-btn--active {
  background: rgba(109, 40, 217, 0.14);
  color: #4c1d95;
  border-color: rgba(91, 33, 182, 0.35);
}

html[data-login-theme="light"] body.page-portal .sync-group {
  border-top-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .sync-group__head {
  border-bottom-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .sync-group__head strong {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .sync-row__name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .sync-row__preview,
html[data-login-theme="light"] body.page-portal .sync-group__head .muted {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .sync-row__badge {
  color: #4c1d95;
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(91, 33, 182, 0.28);
}

html[data-login-theme="light"] body.page-portal .sync-row:hover {
  background: rgba(109, 40, 217, 0.06);
  border-color: rgba(91, 33, 182, 0.15);
}

html[data-login-theme="light"] body.page-portal .sync-custom,
html[data-login-theme="light"] body.page-portal .sync-created-queries {
  background: #f8fafc;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .sync-custom__title,
html[data-login-theme="light"] body.page-portal .sync-created-queries__head strong {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .cq-card__label,
html[data-login-theme="light"] body.page-portal #sync-modal-overlay .cq-card__hint {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .cq-card__name,
html[data-login-theme="light"] body.page-portal #sync-modal-overlay .cq-card__sql {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .field label {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .field input,
html[data-login-theme="light"] body.page-portal .field select,
html[data-login-theme="light"] body.page-portal .field textarea {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .btn--primary {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .btn--ghost {
  border-color: rgba(18, 40, 63, 0.18);
  color: #334155;
}/* light override removido (somente layout): html[data-login-theme="light"] body.page-portal .btn--ghost:hover */

/* Erro / perigo — modo claro (texto escuro na família vermelha) */
html[data-login-theme="light"] body.page-portal .login-alert {
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .conn-result__banner--err {
  background: rgba(254, 226, 226, 0.85);
  border-color: rgba(185, 28, 28, 0.35);
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .conn-result__banner--err strong {
  color: #7f1d1d;
}

html[data-login-theme="light"] body.page-portal .conn-result__banner--err p {
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .conn-result__detail {
  background: rgba(18, 40, 63, 0.08);
  border-color: rgba(18, 40, 63, 0.12);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .conn-result__banner--ok {
  background: rgba(220, 252, 231, 0.85);
  border-color: rgba(21, 128, 61, 0.35);
  color: #166534;
}

html[data-login-theme="light"] body.page-portal .conn-result__banner--ok strong,
html[data-login-theme="light"] body.page-portal .conn-result__banner--ok p {
  color: #166534;
}

html[data-login-theme="light"] body.page-portal .btn--danger-outline {
  border-color: rgba(185, 28, 28, 0.45);
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .btn--danger-outline:hover {
  background: rgba(254, 226, 226, 0.75);
  color: #7f1d1d;
}

html[data-login-theme="light"] body.page-portal .cq-list-item__btn--danger {
  border-color: rgba(185, 28, 28, 0.4);
  background: rgba(254, 226, 226, 0.75);
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .cq-list-item__btn--danger:hover {
  background: rgba(254, 202, 202, 0.9);
  border-color: rgba(153, 27, 27, 0.55);
  color: #7f1d1d;
}

html[data-login-theme="light"] body.page-portal .cq-card__error {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .mapping-status--err {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .mapping-status--ok {
  color: #15803d;
}

/* Modal de mapeamento — modo claro (contraste legível na paleta do portal) */
html[data-login-theme="light"] body.page-portal .mapping-modal {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-modal .modal__brand {
  filter: brightness(0.22);
}

html[data-login-theme="light"] body.page-portal .mapping-active-toggle {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .mapping-active-toggle input {
  accent-color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .mapping-side {
  background: #f8fafc;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .mapping-side--right {
  background: #f1f5f9;
}

html[data-login-theme="light"] body.page-portal .mapping-side__head h3,
html[data-login-theme="light"] body.page-portal .mapping-group__head {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-side__sub {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-picker__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .mapping-add-table-btn {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(2, 132, 199, 0.35);
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .mapping-add-table-btn:hover {
  color: #0c4a6e;
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__trigger {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__caret {
  border-top-color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__dropdown {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  box-shadow: 0 12px 36px rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__option {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__option:hover,
html[data-login-theme="light"] body.page-portal .mapping-combobox__option:focus {
  background: rgba(109, 40, 217, 0.1);
}

html[data-login-theme="light"] body.page-portal .mapping-combobox__option.is-selected {
  background: rgba(109, 40, 217, 0.14);
  border-left-color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .mapping-search input {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-col-card {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .mapping-col-card__name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-col-card__type {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-col-card__badge {
  background: rgba(56, 189, 248, 0.2);
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .mapping-col-card__badge--date {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .mapping-col-card__badge--text {
  background: rgba(109, 40, 217, 0.14);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row.is-primary {
  border-color: rgba(180, 83, 9, 0.45);
  background: rgba(254, 243, 199, 0.65);
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row__alias {
  background: rgba(18, 40, 63, 0.06);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row__name {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row__tools button {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-tbl-row__tools button:hover {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-section-tabs {
  background: #e2e8f0;
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .mapping-section-tab {
  color: #475569;
  border-right-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .mapping-section-tab.is-active {
  background: rgba(56, 189, 248, 0.22);
  color: #0c4a6e;
}

html[data-login-theme="light"] body.page-portal .mapping-filter-tabs {
  background: #e2e8f0;
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .mapping-tab {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-tab.is-active {
  background: rgba(56, 189, 248, 0.22);
  color: #0c4a6e;
}

html[data-login-theme="light"] body.page-portal .mapping-group {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .mapping-field {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .mapping-field.is-mapped {
  border-color: rgba(21, 128, 61, 0.4);
  background: rgba(220, 252, 231, 0.55);
}

html[data-login-theme="light"] body.page-portal .mapping-field__label {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-field__kind {
  background: rgba(18, 40, 63, 0.08);
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-field__kind--measure {
  background: rgba(56, 189, 248, 0.2);
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .mapping-field__kind--dimension {
  background: rgba(109, 40, 217, 0.14);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .mapping-field__kind--date {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .mapping-field__slot {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(100, 116, 139, 0.45);
}

html[data-login-theme="light"] body.page-portal .mapping-field.is-mapped .mapping-field__slot {
  border-color: rgba(21, 128, 61, 0.4);
  background: rgba(220, 252, 231, 0.45);
}

html[data-login-theme="light"] body.page-portal .mapping-field__placeholder {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-field__hint {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-field__chip {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-field__remove {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-field__remove:hover {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .mapping-field__agg {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-field__consumed > summary {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-field__consumed li {
  color: #334155;
  background: rgba(56, 189, 248, 0.1);
  border-left-color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .mapping-filters-intro {
  color: #475569;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(2, 132, 199, 0.28);
}

html[data-login-theme="light"] body.page-portal .mapping-filters-intro strong {
  color: #0c4a6e;
}

html[data-login-theme="light"] body.page-portal .mapping-filters-intro code {
  background: rgba(18, 40, 63, 0.06);
  border-color: rgba(18, 40, 63, 0.12);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .mapping-filters-intro em {
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__slot {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(100, 116, 139, 0.4);
}

html[data-login-theme="light"] body.page-portal .mapping-filter.has-bindings .mapping-filter__slot,
html[data-login-theme="light"] body.page-portal .mapping-filter.has-bindings {
  border-color: rgba(21, 128, 61, 0.4);
  background: rgba(220, 252, 231, 0.4);
}

html[data-login-theme="light"] body.page-portal .mapping-filter__chip {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__chip.is-primary {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(2, 132, 199, 0.4);
}

html[data-login-theme="light"] body.page-portal .mapping-filter__chip-star {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__chip.is-primary .mapping-filter__chip-star {
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__hint-empty {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__kind {
  background: rgba(18, 40, 63, 0.08);
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__kind--date_range {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__kind--multi_select,
html[data-login-theme="light"] body.page-portal .mapping-filter__kind--single_select {
  background: rgba(109, 40, 217, 0.14);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__kind--number_range {
  background: rgba(251, 191, 36, 0.22);
  color: #b45309;
}

html[data-login-theme="light"] body.page-portal .mapping-filter__scope {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .mapping-foot {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .mapping-foot__left {
  color: #334155;
}

/* ----- Login shell ----- */

.login-main {
  padding-block: clamp(2rem, 8vh, 4rem);
}

.login-shell {
  display: grid;
  gap: 1.5rem;
}

.login-panel {
  width: 100%;
}

.login-card {
  padding: clamp(1.75rem, 4vw, 2.25rem);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.login-card__subtitle {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.login-alert {
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 0.9rem;
}

.login-alert--hidden {
  display: none;
}

.login-form .field + .field {
  margin-top: 1rem;
}

.login-form .check {
  margin-top: 1rem;
}

.login-form .btn--block {
  margin-top: 1.35rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.field--half-wrap {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.field--half {
  flex: 1 1 140px;
  min-width: 120px;
}

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.field-row input {
  flex: 1;
}

.field-hint {
  margin: 0;
  font-size: 0.82rem;
}

.conn-save-field {
  margin-top: 1rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  accent-color: var(--accent);
}

.check--inline {
  align-self: flex-end;
}

/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #7dd3fc);
  color: #0c1220;
  border: none;
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.btn--small {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.btn--danger-outline {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
  background: transparent;
}

.btn--danger-outline:hover {
  background: var(--danger-soft);
}

/* ----- Footer ----- */

.footer {
  margin-top: auto;
  padding-block: 2rem;
}

.footer__minimal {
  text-align: center;
  font-size: 0.85rem;
}

.page-login {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-login .footer {
  margin-top: auto;
}

/* ----- Modal ----- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1rem, 4vh, 3rem);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-overlay--hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal__title-group {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.modal__brand {
  flex-shrink: 0;
  height: 22px;
  width: auto;
  max-width: min(140px, 32vw);
  display: block;
  object-fit: contain;
}

.modal__title-group .modal__title {
  margin: 0;
  min-width: 0;
}

.modal__title {
  margin: 0;
  font-size: 1.15rem;
}

.modal__close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  color: var(--text);
}

.modal__body {
  padding: 1.25rem;
}

.modal__intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.modal__actions--spread {
  justify-content: space-between;
  align-items: center;
}

.modal__actions__right {
  display: flex;
  gap: 0.5rem;
}

.conn-form .field + .field {
  margin-top: 0.85rem;
}

.conn-result {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.conn-result--hidden {
  display: none;
}

.conn-result__banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.conn-result__banner--ok {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
}

.conn-result__banner--err {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.conn-result__banner p {
  margin: 0.35rem 0 0;
}

.conn-result__detail {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.conn-result__tips {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
}

.conn-result__tips-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.conn-result__tips ul {
  margin: 0;
  padding-left: 1.15rem;
}

.conn-result__tips li {
  margin-bottom: 0.25rem;
}

/* ----- Connections page ----- */

.connections-main {
  padding-block: clamp(1.5rem, 5vh, 3rem);
}

.connections-head {
  margin-bottom: 1.75rem;
}

.connections-head__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.connections-head__copy {
  min-width: 0;
}

.connections-title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.connections-lead {
  margin: 0;
  max-width: 62ch;
}

.connections-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.connections-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  min-width: min(460px, 52vw);
  padding: 0 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.connections-search__icon {
  color: rgba(226, 232, 240, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.connections-search__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.connections-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(241, 245, 249, 0.95);
  font: inherit;
  font-size: 0.9rem;
}

.connections-search__input::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.connections-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(226, 232, 240, 0.82);
}

.connections-empty {
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
}

.connections-empty--compact {
  padding: 1.25rem 1.5rem;
}

.connections-empty__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.connections-empty__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(226, 232, 240, 0.85);
}

.connections-empty__icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.connections-empty__text {
  min-width: 0;
}

.connections-empty__title {
  margin: 0 0 0.25rem;
  font-weight: 650;
  color: rgba(226, 232, 240, 0.92);
}

.connections-empty__desc {
  margin: 0 0 0.85rem;
  max-width: 70ch;
}

.connections-empty[hidden] {
  display: none !important;
}

.connections-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.connections-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.connections-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.connections-table th,
.connections-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.connections-table th {
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg-elevated);
}

.connections-table tbody tr:last-child td {
  border-bottom: none;
}

.connections-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.connections-table tbody tr:nth-child(2n) td {
  background: rgba(255, 255, 255, 0.01);
}

.connections-actions {
  text-align: right;
  white-space: nowrap;
}

.conn-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.conn-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: rgba(224, 231, 245, 0.9);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.conn-action-btn:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.conn-action-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.65);
  outline-offset: 2px;
}

.conn-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.conn-action-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.conn-action-btn--ok {
  border-color: rgba(34, 197, 94, 0.35);
  color: rgba(134, 239, 172, 0.95);
  background: rgba(34, 197, 94, 0.06);
}

.conn-action-btn--err {
  border-color: rgba(248, 113, 113, 0.35);
  color: rgba(252, 165, 165, 0.95);
  background: rgba(248, 113, 113, 0.06);
}

.conn-action-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(226, 232, 240, 0.25);
  border-top-color: rgba(226, 232, 240, 0.9);
  animation: connSpin 0.8s linear infinite;
}

.conn-action-btn--danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: rgba(248, 113, 113, 0.95);
}

.conn-action-btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.55);
}

@keyframes connSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Modo claro — conexões (após estilos base para garantir precedência) */
html[data-login-theme="light"] body.page-portal .connections-search {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.18);
}

html[data-login-theme="light"] body.page-portal .connections-search__icon,
html[data-login-theme="light"] body.page-portal .connections-search__icon svg {
  color: rgba(18, 40, 63, 0.68);
}

html[data-login-theme="light"] body.page-portal .connections-search__input,
html[data-login-theme="light"] body.page-portal .connections-search__input::placeholder {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .connections-search__input::placeholder {
  color: rgba(18, 40, 63, 0.62);
}

html[data-login-theme="light"] body.page-portal .connections-table th {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err) {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn:not(.conn-action-btn--danger):not(.conn-action-btn--ok):not(.conn-action-btn--err) svg {
  color: #12283f;
  stroke: currentColor;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger {
  color: #dc2626;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger svg,
html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger svg path {
  color: #dc2626;
  stroke: #dc2626;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger:hover:not(:disabled) {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger:hover:not(:disabled) svg,
html[data-login-theme="light"] body.page-portal .conn-action-btn.conn-action-btn--danger:hover:not(:disabled) svg path {
  color: #b91c1c;
  stroke: #b91c1c;
}

@media (max-width: 900px) {
  .connections-head__row {
    flex-direction: column;
    align-items: stretch;
  }
  .connections-tools {
    justify-content: stretch;
  }
  .connections-search {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .connections-table th:nth-child(3),
  .connections-table td:nth-child(3),
  .connections-table th:nth-child(5),
  .connections-table td:nth-child(5) {
    display: none;
  }
}

/* ----- Space page (admin) ----- */

.space-main {
  position: relative;
  z-index: 2;
  padding-block: clamp(1.5rem, 5vh, 3rem);
}

body.page-space .footer.footer--minimal {
  position: relative;
  z-index: 2;
}

.space-head {
  margin-bottom: 1.5rem;
}

.space-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  letter-spacing: -0.03em;
}

.space-lead {
  margin: 0 0 1rem;
  max-width: 70ch;
}

.space-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.space-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 44px;
  padding: 0 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  max-width: none;
}

.space-search__icon {
  color: rgba(226, 232, 240, 0.75);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.space-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(241, 245, 249, 0.95);
  font: inherit;
  font-size: 0.95rem;
}

.space-search__input::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.space-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.95rem;
  align-items: stretch;
  justify-content: start;
}

.space-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.space-card__head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.space-card__icon-btn {
  width: 34px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(226, 232, 240, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.space-card__icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(56, 189, 248, 0.35);
  color: #f8fafc;
}

.space-card__icon-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.space-card__icon-btn--danger {
  border-color: rgba(248, 113, 113, 0.32);
  color: rgba(252, 165, 165, 0.96);
  background: rgba(248, 113, 113, 0.06);
}

.space-card__icon-btn--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fee2e2;
}

.space-card {
  min-height: 184px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1rem 0.8rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.015));
  color: var(--text);
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.space-card:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 181, 253, 0.4);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.12);
}

/* ---------- Provisionamento (ampulheta) ---------- */
.space-card--provisioning {
  border-color: rgba(129, 140, 248, 0.45);
}
.space-card--provisioning:hover {
  transform: none;
}
.space-card--prov-error {
  border-color: rgba(248, 113, 113, 0.45);
}
.space-card__prov {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20, 16, 40, 0.86), rgba(24, 20, 46, 0.9));
  backdrop-filter: blur(2px);
}
.space-hourglass {
  color: #c4b5fd;
  animation: space-hourglass-flip 1.6s ease-in-out infinite;
  transform-origin: center;
}
@keyframes space-hourglass-flip {
  0%, 55% { transform: rotate(0deg); }
  70%, 100% { transform: rotate(180deg); }
}
.space-card__prov-step {
  font-weight: 600;
  font-size: 0.95rem;
  color: #ede9fe;
}
.space-card__prov-msg {
  font-size: 0.78rem;
  max-width: 92%;
  line-height: 1.3;
}
.space-card__prov-error {
  margin-top: 0.4rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.space-card__prov-error strong {
  display: block;
  color: #fca5a5;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.space-card__prov-error p {
  font-size: 0.78rem;
  margin: 0 0 0.55rem;
  line-height: 1.3;
}
.space-card__prov-error-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.space-prov-mode {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

/* Criar Space via Blueprint: duas colunas (dados | conexão) */
.space-form--bp-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 1.35rem;
  align-items: start;
}
.space-form--bp-split #space-modal-form-heading {
  display: none;
}
.space-form--bp-split #space-bp-main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.space-form--bp-split #space-user-fields {
  display: none;
}
.space-form--bp-split #space-provision-fields {
  display: block;
}
.space-form--bp-split #space-bp-conn {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}
.space-form--bp-split #space-form-result,
.space-form--bp-split .modal__actions {
  grid-column: 1 / -1;
}
.space-bp-main {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.space-bp-conn {
  margin: 0;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(196, 181, 253, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
}
.space-bp-conn .space-modal-split__title {
  margin-top: 0;
}
.space-bp-conn .space-modal-split__lead {
  margin-bottom: 0.75rem;
}
@media (max-width: 768px) {
  .space-form--bp-split {
    grid-template-columns: 1fr;
  }
  .space-form--bp-split #space-bp-main,
  .space-form--bp-split #space-bp-conn {
    grid-column: 1;
    grid-row: auto;
  }
}
html[data-login-theme="light"] body.page-portal .space-bp-conn {
  border-color: rgba(124, 58, 237, 0.22);
  background: linear-gradient(180deg, rgba(245, 243, 255, 0.95), rgba(237, 233, 254, 0.88));
}
html[data-login-theme="light"] body.page-portal .space-card__prov {
  background: linear-gradient(180deg, rgba(245, 243, 255, 0.92), rgba(237, 233, 254, 0.95));
}
html[data-login-theme="light"] body.page-portal .space-hourglass {
  color: #7c3aed;
}
html[data-login-theme="light"] body.page-portal .space-card__prov-step {
  color: #4c1d95;
}

.space-card__main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
}

.space-card__main:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.65);
  outline-offset: 2px;
}

.space-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: #f8fafc;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(196, 181, 253, 0.6), transparent 60%),
    linear-gradient(135deg, #7c3aed, #38bdf8);
  border: 1px solid rgba(196, 181, 253, 0.45);
  flex-shrink: 0;
}

.space-card__lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.space-card__title {
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-card__email {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-card__badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  min-height: 1.55rem;
}

.space-card__badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.35);
  background: rgba(124, 58, 237, 0.14);
  color: rgba(221, 214, 254, 0.98);
}


.space-card__toggle-wrap {
  margin-top: 0.35rem;
}

.space-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 30px;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(241, 245, 249, 0.95);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.space-switch__label {
  font-weight: 750;
  letter-spacing: 0.02em;
}

.space-switch[aria-checked="true"] .space-switch__label {
  color: rgba(187, 247, 208, 0.98);
}

.space-switch[aria-checked="false"] .space-switch__label {
  color: rgba(254, 202, 202, 0.98);
}

.space-switch:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(56, 189, 248, 0.35);
}

.space-switch:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.space-switch__track {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  background: rgba(148, 163, 184, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.space-switch__thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(241, 245, 249, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.space-switch[aria-checked="true"] .space-switch__track {
  background: rgba(34, 197, 94, 0.6);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.space-switch[aria-checked="true"] .space-switch__thumb {
  transform: translateX(16px);
}

.space-switch[aria-checked="false"] .space-switch__track {
  background: rgba(248, 113, 113, 0.35);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.space-switch__label {
  white-space: nowrap;
}
.space-card__badge--muted {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.08);
  color: rgba(148, 163, 184, 0.95);
}

.space-card__footer {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.space-card__footer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.space-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.space-card__actions--primary {
  width: 100%;
}

.space-card__actions--primary .space-card__btn {
  flex: 1 1 0;
  min-width: 0;
}

.space-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  width: 100%;
}

.space-stat {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.space-stat__value {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  color: rgba(241, 245, 249, 0.98);
  line-height: 1.1;
}

.space-stat__label {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-card__btn {
  flex: 0 1 auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(226, 232, 240, 0.92);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.space-card__btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(56, 189, 248, 0.35);
  color: #f8fafc;
}

.space-card__btn span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-card__btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.space-card__btn--danger {
  min-width: 40px;
  border-color: rgba(248, 113, 113, 0.32);
  color: rgba(252, 165, 165, 0.96);
  background: rgba(248, 113, 113, 0.06);
}

.space-card__btn--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fee2e2;
}

/* Card "Criar novo Space" (pontilhado) */
.space-card--new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 184px;
  padding: 1.25rem;
  border: 2px dashed rgba(196, 181, 253, 0.45);
  background: rgba(124, 58, 237, 0.04);
  color: rgba(241, 245, 249, 0.92);
  cursor: pointer;
  font: inherit;
}

.space-card--new:hover {
  border-color: rgba(196, 181, 253, 0.85);
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.18);
}

/* Modal Space: duas colunas (formulário | lista) */
.space-modal-layout {
  display: block;
}

.space-modal-layout--manage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 1.35rem;
  align-items: start;
}

@media (max-width: 768px) {
  .space-modal-layout--manage {
    grid-template-columns: 1fr;
  }
}

.space-modal-layout__form {
  min-width: 0;
}

.space-modal-layout__list {
  min-width: 0;
}

.space-modal-split__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.space-modal-split__lead {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Modal: usuários do Space */
.space-modal-users {
  margin-bottom: 0;
}

.space-modal-users__empty {
  margin: 0;
  padding: 0.35rem 0 0.15rem;
  font-size: 0.88rem;
}

.space-modal-users__title {
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
  color: rgba(148, 163, 184, 0.98);
}

.space-modal-users__hint {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 0.65rem;
  max-width: 62ch;
}

.space-modal-users__list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(260px, 42vh);
  overflow: auto;
  padding-right: 0.2rem;
}

.space-modal-user {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 0.65rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.14);
}

.space-modal-user__main {
  min-width: 0;
}

.space-modal-user__name {
  font-weight: 650;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-modal-user__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.space-modal-user__email {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.space-modal-user__tag {
  font-size: 0.62rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.35);
  background: rgba(124, 58, 237, 0.12);
  color: rgba(221, 214, 254, 0.95);
  flex-shrink: 0;
}

.space-modal-user__tag--owner {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
  color: rgba(186, 230, 253, 0.98);
}

.space-modal-user__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

html[data-login-theme="light"] body.page-portal .space-modal-user {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(18, 40, 63, 0.12);
}

.space-card__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.45);
  background: rgba(124, 58, 237, 0.16);
  color: rgba(221, 214, 254, 0.98);
}

.space-card__new-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 0.98rem;
}

.space-card__new-desc {
  font-size: 0.85rem;
  text-align: center;
  max-width: 32ch;
}

@media (max-width: 560px) {
  .space-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .space-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .space-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* light theme — página Spaces */
html[data-login-theme="light"] body.page-portal .space-title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-lead,
html[data-login-theme="light"] body.page-portal .space-head .muted {
  color: rgba(18, 40, 63, 0.72);
}

html[data-login-theme="light"] body.page-portal .space-card {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card:hover {
  border-color: rgba(91, 33, 182, 0.38);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(91, 33, 182, 0.12);
}

html[data-login-theme="light"] body.page-portal .space-card__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card__email,
html[data-login-theme="light"] body.page-portal .space-card__email.muted {
  color: rgba(18, 40, 63, 0.62);
}

html[data-login-theme="light"] body.page-portal .space-card__badge {
  border-color: rgba(91, 33, 182, 0.35);
  background: rgba(124, 58, 237, 0.12);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .space-card__badge--muted {
  border-color: rgba(18, 40, 63, 0.16);
  background: rgba(18, 40, 63, 0.06);
  color: rgba(18, 40, 63, 0.7);
}

html[data-login-theme="light"] body.page-portal .space-switch {
  background: #f1f5f9;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-switch:hover {
  background: #e8ecf5;
  border-color: rgba(91, 33, 182, 0.32);
}

html[data-login-theme="light"] body.page-portal .space-switch[aria-checked="true"] .space-switch__label {
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .space-switch[aria-checked="false"] .space-switch__label {
  color: #b45309;
}

html[data-login-theme="light"] body.page-portal .space-switch__track {
  background: rgba(18, 40, 63, 0.16);
  box-shadow: inset 0 0 0 1px rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .space-card__icon-btn {
  background: #f8fafc;
  border-color: rgba(18, 40, 63, 0.14);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .space-card__icon-btn:hover {
  background: #eef2f7;
  border-color: rgba(91, 33, 182, 0.35);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card__icon-btn--danger {
  border-color: rgba(185, 28, 28, 0.28);
  color: #b91c1c;
  background: rgba(254, 226, 226, 0.65);
}

html[data-login-theme="light"] body.page-portal .space-card__icon-btn--danger:hover {
  border-color: rgba(185, 28, 28, 0.45);
  color: #991b1b;
  background: rgba(254, 202, 202, 0.85);
}

html[data-login-theme="light"] body.page-portal .space-card__footer {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .space-stat {
  border-color: rgba(18, 40, 63, 0.12);
  background: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-login-theme="light"] body.page-portal .space-stat__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-stat__label,
html[data-login-theme="light"] body.page-portal .space-stat__label.muted {
  color: rgba(18, 40, 63, 0.58);
}

html[data-login-theme="light"] body.page-portal .space-card__btn {
  background: #f8fafc;
  color: #1e293b;
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .space-card__btn:hover {
  background: #eef2f7;
  color: #0f172a;
  border-color: rgba(91, 33, 182, 0.28);
}

html[data-login-theme="light"] body.page-portal .space-card__btn--danger {
  border-color: rgba(185, 28, 28, 0.28);
  color: #b91c1c;
  background: rgba(254, 242, 242, 0.9);
}

html[data-login-theme="light"] body.page-portal .space-card--new {
  background: rgba(124, 58, 237, 0.07);
  border-color: rgba(91, 33, 182, 0.45);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card--new:hover {
  background: rgba(124, 58, 237, 0.11);
  border-color: rgba(91, 33, 182, 0.62);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card__plus {
  border-color: rgba(91, 33, 182, 0.4);
  background: rgba(124, 58, 237, 0.14);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .space-card__new-title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-card__new-desc {
  color: rgba(18, 40, 63, 0.68);
}

html[data-login-theme="light"] body.page-portal .space-search {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

html[data-login-theme="light"] body.page-portal .space-search__icon {
  color: rgba(18, 40, 63, 0.5);
}

html[data-login-theme="light"] body.page-portal .space-search__input {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .space-search__input::placeholder {
  color: rgba(18, 40, 63, 0.45);
}

/* ----- Tela inicial (login) — fundo e layout referência ----- */

/* Acima de z-index:0: em body com background-attachment: fixed o fundo cobre fixed 0. */
.login-particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  vertical-align: top;
}

html[data-login-theme="dark"] .login-particles {
  mix-blend-mode: normal;
  opacity: 1;
}/* light override removido (somente layout): html[data-login-theme="light"] .login-particles */

/* Tipografia unificada (Inter + 15px base = mesmo corpo e cartão) */
.page-login--landing {
  --login-ff: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: relative;
  font-family: var(--login-ff);
  font-size: 15px;
  line-height: 1.55;
  color: #ffffff;
  background-color: #050110;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form controls herdam a mesma família do bloco (evita sistema nos inputs) */
body.page-login--landing :is(input, button, textarea, select) {
  font-family: inherit;
}

body.page-login--landing .footer__minimal,
body.page-login--landing .footer--landing {
  font-size: 1em;
}

/* Tema escuro: #050110 + alento radial central (referência, sem fotografia) */
html[data-login-theme="dark"] .page-login--landing {
  background-image: radial-gradient(
      ellipse 80% 58% at 50% 36%,
      rgba(72, 48, 108, 0.42) 0%,
      transparent 58%
    ),
    radial-gradient(ellipse 100% 48% at 50% 88%, rgba(28, 18, 45, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, #080410 0%, #050110 42%, #030208 100%);
  background-color: #050110;
  background-repeat: no-repeat;
  background-attachment: scroll;
  background-size: 100% 100%, 100% 100%, 100% 100%;
  background-position: center center, center center, center center;
}

.page-login--landing a:not(.login-forgot-link) {
  color: #c084fc;
}

.page-login--landing a:not(.login-forgot-link):hover {
  color: #e9d5ff;
}

.page-login--landing .container {
  width: 100%;
  max-width: 1240px;
  padding-inline: clamp(1.4rem, 4.5vw, 2.75rem);
}

body.page-login--landing .login-main--landing,
body.page-login--landing .footer--landing {
  position: relative;
  z-index: 2;
}

/* Marca: até ~4,5–5,5× a altura do corpo; largura limitada a ~40% da coluna (conteúdo preservado) */
/* 90% da largura da coluna de intro */
.login-intro__logo {
  display: block;
  width: 90%;
  max-width: 90%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  object-position: left center;
  margin-left: 0;
  margin-right: auto;
  margin-bottom: 1.65rem;
}

.login-main--landing {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(2.75rem, 9vh, 5.5rem);
}

.login-shell--landing {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) clamp(3.25rem, 4.2vw, 4.25rem) minmax(0, 0.98fr);
  gap: 0;
  row-gap: 0;
  align-items: center;
  min-width: 0;
}

/* Coluna central: linha vertical (desktop) e interruptor claro/escuro */
.login-shell__divider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 0;
  min-height: 3.5rem;
  width: 100%;
  padding-block: 0.25rem;
}

.login-shell__divider::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

html[data-login-theme="light"] .login-shell__divider::before {
  background: rgba(18, 40, 63, 0.12);
}

/* Login: sol em cima, lua em baixo (trilho vertical na divisória) */
.login-shell__divider .navbar__theme-toggle {
  display: flex;
  justify-content: center;
}

.login-shell__divider .theme-toggle-pill {
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.22rem 0.2rem;
}

.login-shell__divider .theme-toggle-pill__btn {
  width: 1.85rem;
  height: 1.85rem;
}

.login-intro {
  position: relative;
  z-index: 1;
  font-size: 1em; /* base clara p/ 5,5em na logo */
}

.login-intro__eyebrow {
  margin: 0 0 1.05rem;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #bfa6f2;
  line-height: 1.45;
}

.login-intro__lead {
  margin: 0;
  font-size: 1em;
  line-height: 1.55;
  font-weight: 400;
  max-width: 52ch;
  background: linear-gradient(
    100deg,
    #f5f0ff 0%,
    #e9d5ff 22%,
    #c4b5fd 48%,
    #93c5fd 74%,
    #7dd3fc 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.login-panel--landing {
  justify-self: stretch;
  align-self: center;
  border-left: none;
  padding-left: clamp(1.5rem, 2.8vw, 2.75rem);
  min-width: 0;
}

.login-card--landing {
  width: 100%;
  max-width: min(100%, 26.5rem);
  margin-inline: auto 0;
  padding: clamp(1.6rem, 3.1vw, 2.1rem) clamp(1.5rem, 2.8vw, 2rem);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 6, 18, 0.5);
  backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-card--landing .login-card__title {
  margin: 0 0 0.4rem;
  font-size: 1.2em;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.login-card--landing .login-card__subtitle {
  margin: 0 0 1.1rem;
  font-size: 1em;
  font-weight: 400;
  line-height: 1.55;
  color: #a0a0a0;
}

.login-card--landing .login-alert {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 1em;
  line-height: 1.5;
  border-radius: var(--radius-sm);
}

.login-card--landing .field label {
  font-size: 1em;
  font-weight: 500;
  line-height: 1.4;
  color: #a0a0a0;
}

.login-card--landing .field input {
  padding: 0.6rem 0.75rem;
  font-size: 1em;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 11px;
  background: rgba(6, 8, 18, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.login-card--landing .field input::placeholder {
  color: rgba(160, 160, 160, 0.65);
}

.login-card--landing .field input:focus {
  border-color: rgba(192, 132, 252, 0.45);
  box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.14);
}

.page-login--landing .field-password-wrap {
  position: relative;
  width: 100%;
}

.page-login--landing .field-password-wrap > input {
  width: 100%;
  padding-right: 2.75rem;
}

.page-login--landing .field-password-wrap .toggle-pass--infield svg {
  width: 17px;
  height: 17px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.28rem;
}

.field-label-row label {
  margin: 0;
}

.login-forgot-link {
  flex-shrink: 0;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.4;
  color: #c084fc !important;
  text-decoration: none;
}

.login-forgot-link:hover {
  color: #e9d5ff !important;
  text-decoration: underline;
}

.toggle-pass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.toggle-pass__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-pass__icon--hide {
  display: none;
}

.toggle-pass--revealed .toggle-pass__icon--show {
  display: none;
}

.toggle-pass--revealed .toggle-pass__icon--hide {
  display: inline-flex;
}

.page-login--landing .field-password-wrap .toggle-pass--infield {
  position: absolute;
  z-index: 1;
  right: 4px;
  top: 4px;
  bottom: 4px;
  width: 2.05rem;
  min-width: 2.05rem;
  align-self: unset;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(14, 16, 26, 0.92);
  color: rgba(200, 195, 222, 0.95);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.page-login--landing .field-password-wrap .toggle-pass--infield:hover {
  border-color: rgba(192, 132, 252, 0.35);
  background: rgba(22, 24, 36, 0.95);
  color: #f0e8ff;
}

.page-login--landing .field-password-wrap .toggle-pass--infield:focus-visible {
  outline: none;
  border-color: rgba(192, 132, 252, 0.55);
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.35);
}

.page-login--landing .field-password-wrap:focus-within .toggle-pass--infield {
  border-color: rgba(192, 132, 252, 0.28);
}

.login-card--landing .check {
  color: #a0a0a0;
}

.login-card--landing .check input {
  accent-color: #c084fc;
}

.page-login--landing .login-form .field + .field {
  margin-top: 0.8rem;
}

.page-login--landing .login-form .check {
  margin-top: 0.65rem;
}

.page-login--landing .login-form .btn--block {
  margin-top: 1.5rem;
}

.page-login--landing .btn--small {
  padding: 0.38rem 0.55rem;
  font-size: 0.78rem;
}

.page-login--landing .btn--primary.btn--landing {
  padding-block: 0.6rem;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.4;
  border-radius: 11px;
  background: linear-gradient(90deg, #e0c3fc 0%, #8ec5fc 100%);
  color: #0a0a12;
  border: none;
}

.page-login--landing .btn--primary.btn--landing:hover:not(:disabled) {
  filter: brightness(1.07);
}

.page-login--landing .btn--ghost {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

.page-login--landing .btn--ghost:hover:not(:disabled) {
  border-color: rgba(192, 132, 252, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.footer--landing {
  padding-block: 1.1rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer--landing .muted {
  color: rgba(160, 160, 160, 0.85);
}

/* Interruptor tema (login): padrão = sistema; após clicar, preferência salva */

html[data-login-theme="dark"] {
  color-scheme: dark;
}

html[data-login-theme="light"] {
  color-scheme: light;
}

/* Troca de tema: cores sempre instantâneas (sem fade em background/color/border) */
html.theme-colors-snap[data-login-theme] body.page-portal,
html.theme-colors-snap[data-login-theme] body.page-login--landing {
  transition-property: none !important;
}

html.theme-colors-snap[data-login-theme] body.page-portal *,
html.theme-colors-snap[data-login-theme] body.page-portal *::before,
html.theme-colors-snap[data-login-theme] body.page-portal *::after,
html.theme-colors-snap[data-login-theme] body.page-login--landing *,
html.theme-colors-snap[data-login-theme] body.page-login--landing *::before,
html.theme-colors-snap[data-login-theme] body.page-login--landing *::after {
  transition-property: transform, opacity, filter !important;
}

.d-none {
  display: none !important;
}

.navbar__theme-toggle {
  flex-shrink: 0;
  z-index: 2;
}

.theme-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 12, 20, 0.65);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-login-theme="light"] .theme-toggle-pill {
  border-color: rgba(18, 40, 63, 0.14);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(38, 39, 86, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.theme-toggle-pill__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.theme-toggle-pill__btn:hover {
  color: rgba(255, 255, 255, 0.82);
}

html[data-login-theme="light"] .theme-toggle-pill__btn {
  color: rgba(18, 40, 63, 0.45);
}

html[data-login-theme="light"] .theme-toggle-pill__btn:hover {
  color: rgba(18, 40, 63, 0.78);
}

.theme-toggle-pill__btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

html[data-login-theme="light"] .theme-toggle-pill__btn.active {
  background: #252530;
  color: #f8fafc;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16);
}

.theme-toggle-pill__btn:focus-visible {
  outline: 2px solid rgba(192, 132, 252, 0.85);
  outline-offset: 2px;
}

.theme-toggle-pill__btn .bi {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* Tema claro — mesma página de login */

html[data-login-theme="light"] .page-login--landing {
  color: #12283f;
  background-color: #e8ecf5;
  background-image: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.58) 0%,
      rgba(248, 250, 255, 0.48) 45%,
      rgba(242, 246, 252, 0.52) 100%
    ),
    var(--duby-bg-photo-light);
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
  background-size: 100% 100%, cover;
  background-position: center center, center center;
}

html[data-login-theme="light"] .page-login--landing a:not(.login-forgot-link) {
  color: #5b21b6;
}

html[data-login-theme="light"] .page-login--landing a:not(.login-forgot-link):hover {
  color: #4c1d95;
}

html[data-login-theme="light"] .login-intro__logo {
  filter: brightness(0.22);
}

html[data-login-theme="light"] .login-intro__eyebrow {
  color: #5b21b6;
}

html[data-login-theme="light"] .login-intro__lead {
  background: linear-gradient(
    100deg,
    #4c1d95 0%,
    #5b21b6 24%,
    #4338ca 52%,
    #2563eb 78%,
    #0d9488 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html[data-login-theme="light"] .login-card--landing {
  border-color: rgba(18, 40, 63, 0.1);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 44px rgba(38, 39, 86, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-login-theme="light"] .login-card--landing .login-card__title {
  color: #12283f;
}

html[data-login-theme="light"] .login-card--landing .login-card__subtitle {
  color: #64748b;
}

html[data-login-theme="light"] .login-card--landing .login-alert {
  border-color: rgba(220, 38, 38, 0.25);
  color: #991b1b;
}

html[data-login-theme="light"] .login-card--landing .field label {
  color: #64748b;
}

html[data-login-theme="light"] .login-card--landing .field input {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] .login-card--landing .field input::placeholder {
  color: rgba(100, 116, 139, 0.75);
}

html[data-login-theme="light"] .login-card--landing .field input:focus {
  border-color: rgba(109, 40, 217, 0.45);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

html[data-login-theme="light"] .login-forgot-link {
  color: #6d28d9 !important;
}

html[data-login-theme="light"] .login-forgot-link:hover {
  color: #5b21b6 !important;
}

html[data-login-theme="light"] .page-login--landing .field-password-wrap .toggle-pass--infield {
  border-color: rgba(18, 40, 63, 0.12);
  background: rgba(248, 250, 252, 0.98);
  color: #475569;
}

html[data-login-theme="light"] .page-login--landing .field-password-wrap .toggle-pass--infield:hover {
  border-color: rgba(109, 40, 217, 0.35);
  background: #ffffff;
  color: #412884;
}

html[data-login-theme="light"] .page-login--landing .field-password-wrap .toggle-pass--infield:focus-visible {
  border-color: rgba(109, 40, 217, 0.45);
  box-shadow: inset 0 0 0 1px rgba(109, 40, 217, 0.25);
}

html[data-login-theme="light"] .page-login--landing .field-password-wrap:focus-within .toggle-pass--infield {
  border-color: rgba(109, 40, 217, 0.22);
}

html[data-login-theme="light"] .login-card--landing .check {
  color: #64748b;
}

html[data-login-theme="light"] .login-card--landing .check input {
  accent-color: #6d28d9;
}

html[data-login-theme="light"] .page-login--landing .btn--primary.btn--landing {
  background: linear-gradient(90deg, #e0c3fc 0%, #8ec5fc 100%);
  color: #0a0a12;
}

html[data-login-theme="light"] .footer--landing {
  border-top-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] .footer--landing .muted {
  color: #334155;
}

@media (max-width: 960px) {
  .login-shell--landing {
    grid-template-columns: 1fr;
    row-gap: 2.75rem;
    column-gap: 0;
    align-items: center;
  }

  .login-shell__divider {
    min-height: 2.5rem;
    max-width: 24rem;
    width: 100%;
    margin-inline: auto;
    padding-block: 0;
  }

  .login-shell__divider::before {
    top: 50%;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 1px;
    transform: translateY(-50%);
  }

  .login-card--landing {
    max-width: 100%;
    margin-inline: 0;
  }

  .login-panel--landing {
    border-left: none;
    border-top: none;
    padding-left: 0;
    padding-top: 0;
  }

  .login-intro__lead {
    max-width: none;
  }

  .login-intro {
    text-align: center;
  }

  .login-intro__logo {
    width: 90%;
    max-width: 90%;
    margin-inline: auto;
    object-position: center center;
  }
}

/* ----- Portal: shell analítico modular (/dashboard) ----- */

body.page-portal:has(.login-main--analytics) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.login-main--analytics {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-block: 0 1rem;
  min-height: 0;
}

.analytics-layout {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: clamp(0.75rem, 1.4vw, 1.75rem);
  gap: 0;
  min-height: 0;
  align-items: stretch;
}

/* Portal: topbar e footer ocupam a largura total da tela */
body.page-portal .topbar .container,
body.page-portal .footer .container {
  max-width: none;
  padding-inline: clamp(0.9rem, 1.4vw, 1.75rem);
}

.analytics-side {
  width: 228px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  /* padding-right: 0 para a barra de rolagem do nav encostar ao canto direito da coluna */
  padding: 0.1rem 0 0.85rem 0.65rem;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, #0e1018 0%, #0a0c12 55%, #080a0f 100%);
  transition: width 0.22s ease, padding 0.22s ease;
  /* Só o filho .analytics-nav rola; evita “vazar” scroll para o resto da página */
  overflow: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
}

.analytics-layout--collapsed .analytics-side {
  width: 58px;
  padding-right: 0;
  align-items: stretch;
}

.analytics-side__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 0.75rem 0.4rem 0;
  margin-bottom: 0.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.analytics-layout--collapsed .analytics-side__header {
  justify-content: center;
  padding-bottom: 0.55rem;
}

.analytics-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #f8fafc;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.analytics-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.analytics-sidebar-toggle__icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.analytics-layout--collapsed .analytics-sidebar-toggle {
  padding: 0.45rem;
}

.analytics-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  /* Rolagem exclusiva desta faixa; não encadeia para body/stage ao fim do scroll */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  padding-left: 0;
  padding-right: 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 181, 253, 0.55) rgba(6, 8, 14, 0.85);
}

.analytics-nav::-webkit-scrollbar {
  width: 10px;
}

.analytics-nav::-webkit-scrollbar-track {
  background: rgba(6, 8, 14, 0.75);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.analytics-nav::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(196, 181, 253, 0.45), rgba(124, 58, 237, 0.5));
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.analytics-nav::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(221, 214, 254, 0.65), rgba(139, 92, 246, 0.65));
  background-clip: padding-box;
}

.analytics-nav-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Trilho de rolagem “arrastável” no canto direito (além da scrollbar nativa) */
.analytics-scroll-rail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 14px;
  z-index: 3;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 8, 14, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.analytics-nav-wrap:hover .analytics-scroll-rail,
.analytics-scroll-rail.is-active {
  opacity: 1;
  pointer-events: auto;
}

.analytics-scroll-thumb {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 0;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(196, 181, 253, 0.5), rgba(124, 58, 237, 0.55));
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.18);
  cursor: grab;
}

.analytics-scroll-rail.is-dragging .analytics-scroll-thumb {
  cursor: grabbing;
}

html[data-login-theme="light"] body.page-portal .analytics-scroll-rail {
  border-left-color: rgba(18, 40, 63, 0.08);
  background: rgba(226, 232, 240, 0.85);
}

html[data-login-theme="light"] body.page-portal .analytics-scroll-thumb {
  background: linear-gradient(180deg, rgba(221, 214, 254, 0.9), rgba(167, 139, 250, 0.9));
  box-shadow: 0 6px 18px rgba(109, 40, 217, 0.12);
}

.analytics-nav__group {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding-right: 0.55rem;
}

.analytics-nav__group + .analytics-nav__group {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Espaço final abaixo de Pedidos (linha vem do ::after da lateral) */
.analytics-nav__group:last-child {
  padding-bottom: 0.55rem;
}

/* Linha final logo abaixo de “Pedidos” (dentro da lista, não no rodapé fixo) */
.analytics-nav__group:last-child::after {
  content: "";
  display: block;
  height: 2px;
  margin: 0.6rem 0.65rem 0 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(196, 181, 253, 0.55) 25%,
    rgba(124, 58, 237, 0.9) 55%,
    rgba(56, 189, 248, 0.55) 80%,
    rgba(0, 0, 0, 0) 100%
  );
  opacity: 0.65;
  filter: blur(0.2px);
  pointer-events: none;
}

.analytics-nav__group-title {
  margin: 0 0 0.25rem;
  padding: 0.15rem 0.65rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c4b5fd;
  opacity: 0.92;
}

.analytics-nav__group:first-child .analytics-nav__group-title {
  margin-top: 0.1rem;
}

.analytics-nav__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.52rem 0.65rem;
  border-radius: 10px;
  color: rgba(248, 250, 252, 0.92);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 550;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.analytics-nav__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.analytics-nav__link.is-active {
  background: linear-gradient(92deg, #c4b5fd 0%, #a78bfa 38%, #7c3aed 72%, #6d28d9 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.28);
}

.analytics-nav__ico {
  width: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
  font-size: 0.98rem;
  flex-shrink: 0;
}

.analytics-nav__ico--svg svg {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
}

.analytics-nav__label {
  min-width: 0;
}

.analytics-layout--collapsed .analytics-nav__label {
  display: none;
}

.analytics-layout--collapsed .analytics-nav__group-title {
  display: none;
}

.analytics-layout--collapsed .analytics-nav__group + .analytics-nav__group {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
}

.analytics-layout--collapsed .analytics-nav__link {
  justify-content: center;
  padding-inline: 0.45rem;
}

.analytics-layout--collapsed .analytics-side__hint {
  display: none;
}

.analytics-layout--collapsed .analytics-side__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ----------------------------------------------------------------------
   Sub-menu da sidebar (Comercial / Financeiro / Performance)
   ---------------------------------------------------------------------- */
.analytics-nav__item {
  display: contents;
}

.analytics-nav__item--has-sub {
  display: block;
}

.analytics-nav__link--has-sub {
  position: relative;
}

.analytics-nav__caret {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  opacity: 0.65;
  transition: transform 0.18s ease, opacity 0.18s ease;
  flex-shrink: 0;
}

.analytics-nav__link--has-sub:hover .analytics-nav__caret {
  opacity: 0.95;
}

.analytics-nav__item--has-sub.is-expanded .analytics-nav__caret {
  transform: rotate(90deg);
  opacity: 1;
}

.analytics-nav__sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.22s ease, opacity 0.16s ease, margin-top 0.22s ease;
}

.analytics-nav__item--has-sub.is-expanded .analytics-nav__sublist {
  /* valor amplo o bastante para acomodar até ~6 sub-itens; o overflow:hidden
     garante que o "exterior" sempre se encaixe entre o pai e o próximo item. */
  max-height: 320px;
  opacity: 1;
  pointer-events: auto;
  margin-top: 0.2rem;
}

.analytics-nav__sublist > li {
  min-height: 0;
  overflow: hidden;
}

.analytics-nav__sublink {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 2.1rem 0.4rem 2.2rem; /* margem direita reservada ao botão olho */
  border-radius: 8px;
  color: rgba(226, 232, 240, 0.78);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  margin-left: 0.6rem;
}

.analytics-nav__sublink:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
  border-left-color: rgba(167, 139, 250, 0.55);
}

.analytics-nav__sublink.is-active {
  background: linear-gradient(92deg, rgba(167, 139, 250, 0.35), rgba(124, 58, 237, 0.18) 70%, transparent);
  color: #fff;
  border-left-color: rgba(167, 139, 250, 0.95);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.18);
}

.analytics-nav__sub-bullet {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.analytics-nav__sublink.is-active .analytics-nav__sub-bullet {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}

.analytics-nav__sub-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quando a sidebar está recolhida, ocultamos o sub-menu inteiro
   (cabe só o ícone do parent). */
.analytics-layout--collapsed .analytics-nav__sublist,
.analytics-layout--collapsed .analytics-nav__caret {
  display: none !important;
}

/* Tema light */
html[data-login-theme="light"] body.page-portal .analytics-nav__sublink {
  color: rgba(15, 23, 42, 0.72);
  border-left-color: rgba(15, 23, 42, 0.12);
}

html[data-login-theme="light"] body.page-portal .analytics-nav__sublink:hover {
  background: rgba(124, 58, 237, 0.08);
  color: rgba(15, 23, 42, 0.95);
  border-left-color: rgba(124, 58, 237, 0.55);
}

html[data-login-theme="light"] body.page-portal .analytics-nav__sublink.is-active {
  background: linear-gradient(92deg, rgba(167, 139, 250, 0.22), rgba(124, 58, 237, 0.12) 70%, transparent);
  color: rgba(55, 48, 163, 0.95);
  border-left-color: rgba(124, 58, 237, 0.95);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.18);
}

/* ----------------------------------------------------------------------
   Flash visual quando navega para uma sub-seção via sub-menu
   ---------------------------------------------------------------------- */
.dash-section-flash {
  animation: dash-section-flash 1.4s ease-out;
}

@keyframes dash-section-flash {
  0%   { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.0); }
  20%  { box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.0); }
}

.analytics-side__foot {
  padding: 1rem 0.75rem 0 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.analytics-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.15);
  color: rgba(226, 232, 240, 0.9);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.analytics-btn-ghost__ico {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.9;
}

.analytics-layout--collapsed .analytics-btn-ghost__label {
  display: none;
}

.analytics-layout--collapsed .analytics-btn-ghost {
  padding: 0.45rem 0.4rem;
}

.analytics-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
}

.analytics-btn-ghost--full {
  width: 100%;
}

.analytics-side__hint {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  padding-inline: 0.15rem;
}

.analytics-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0 0 1.25rem;
}

.analytics-layout--collapsed .analytics-stage {
  padding-left: 0.85rem;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.analytics-toolbar__end {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 0.85rem;
  min-width: 0;
  margin-left: auto;
}

.analytics-toolbar--no-title {
  justify-content: flex-end;
  border-bottom: none;
  margin-bottom: 0.65rem;
  padding-bottom: 0;
}

.analytics-toolbar--no-title .analytics-toolbar__end {
  width: 100%;
}

/* Filtros globais — widget flutuante fixo na viewport (canto inferior direito). */
body.page-portal .analytics-filters-fab {
  position: fixed;
  top: auto;
  bottom: clamp(1rem, 2vh, 1.5rem);
  right: clamp(1rem, 2vw, 1.5rem);
  left: auto;
  z-index: 220;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: none;
}

body.page-portal:has(.analytics-stage--fullscreen) .analytics-filters-fab {
  bottom: 0.75rem;
}

.analytics-filters-fab > * {
  pointer-events: auto;
}

.analytics-filters-fab__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #7c3aed 0%, #4f46e5 52%, #2563eb 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.28),
    0 10px 28px rgba(79, 70, 229, 0.38);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.analytics-filters-fab__btn:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.06);
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.32),
    0 14px 34px rgba(79, 70, 229, 0.45);
}

.analytics-filters-fab__btn.is-open {
  transform: scale(0.96);
  filter: brightness(0.96);
  box-shadow:
    0 2px 10px rgba(15, 23, 42, 0.25),
    0 8px 22px rgba(79, 70, 229, 0.32);
}

.analytics-filters-fab__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* FAB secundário "Configurar meta": fica acima do FAB de filtros e só
   aparece na seção Metas (classe .metas-config-fab--hidden controla).
   Segue a mesma paleta roxo/índigo/azul dos elementos primários. */
.analytics-filters-fab__btn--meta {
  width: 3rem;
  height: 3rem;
  background: linear-gradient(145deg, #8b5cf6 0%, #6366f1 52%, #4f46e5 100%);
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.28),
    0 10px 26px rgba(99, 102, 241, 0.4);
}

.analytics-filters-fab__btn--meta:hover {
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.32),
    0 14px 32px rgba(99, 102, 241, 0.48);
}

.metas-config-fab--hidden {
  display: none !important;
}

.analytics-filters-panel {
  position: relative;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.85rem 0.9rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 18, 30, 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  transform-origin: bottom right;
  animation: analytics-filters-panel-in 0.2s ease;
}

.analytics-filters-panel::before {
  content: "";
  position: absolute;
  top: auto;
  bottom: -7px;
  right: 1.15rem;
  width: 14px;
  height: 14px;
  background: rgba(15, 18, 30, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(45deg);
}

@keyframes analytics-filters-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.analytics-filters-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.analytics-filters-panel__title {
  font-size: 0.82rem;
  font-weight: 650;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.analytics-filters-panel__close {
  border: none;
  background: transparent;
  color: rgba(148, 163, 184, 0.95);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.analytics-filters-panel__close:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
}

.analytics-filters-panel .analytics-filters {
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
}

.analytics-filters-panel .analytics-filter {
  width: 100%;
}

.analytics-filters-panel .analytics-select {
  width: 100%;
  min-width: 0;
}

.analytics-filters-panel__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.analytics-filters-panel__action {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.analytics-filters-panel__action:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.analytics-filters-panel__action.is-active {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  color: #f5f3ff;
}

.analytics-filters-panel__action-icon,
.analytics-filters-panel__action svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.analytics-filters-panel__action-label {
  flex: 1;
  line-height: 1.2;
}

.analytics-fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(226, 232, 240, 0.95);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  width: 40px;
  height: 36px;
  justify-content: center;
}

.analytics-fs-btn:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
}

.analytics-fs-btn.is-active {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.15);
}

.analytics-fs-btn__icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.analytics-fs-btn--hidden {
  display: none !important;
}

.analytics-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.03em;
}

.analytics-page-lead {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  max-width: 52ch;
}

.analytics-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.analytics-filters::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.analytics-filter {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.analytics-filter--fs > span {
  visibility: hidden;
}

.analytics-filter--fs .analytics-fs-btn {
  height: 36px;
  padding-block: 0;
}

.analytics-filter--fs {
  flex: 0 0 auto;
}

.analytics-filter__ghost-label {
  visibility: hidden;
}

.analytics-select {
  min-width: 7.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 18, 30, 0.65);
  color: #e8eef7;
  font: inherit;
  font-size: 0.82rem;
}

.analytics-views {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.analytics-view--hidden {
  display: none !important;
}

.dash-panel--hidden {
  display: none !important;
}

/* Esconde sub-seções não-ativas dentro de um módulo (ex.: Faturamento vs
   Pedidos no Comercial). Usada por applySubSectionVisibility em
   analytics-dashboard.js para garantir a visibilidade exclusiva por sub-item. */
.analytics-section--hidden {
  display: none !important;
}

.analytics-banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.analytics-banner__ip {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.95);
}

.analytics-banner__ip code {
  font-size: 0.85em;
  color: rgba(56, 189, 248, 0.95);
}

.analytics-connect-hint {
  margin: 0 0 1.1rem;
  font-size: 0.86rem;
}

.analytics-module-grid {
  display: grid;
  gap: 0.85rem;
}

.analytics-module-grid--home {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.analytics-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(22, 26, 42, 0.55);
  backdrop-filter: blur(10px);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.analytics-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  text-decoration: none;
  color: inherit;
}

.analytics-tile__tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(56, 189, 248, 0.9);
}

.analytics-tile__title {
  font-size: 1.05rem;
  font-weight: 650;
}

.analytics-tile__desc {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.95);
  line-height: 1.45;
}

.analytics-tile__pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
  background: rgba(167, 139, 250, 0.25);
  color: #e9d5ff;
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.dash-ml-panel {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: linear-gradient(
    135deg,
    rgba(167, 139, 250, 0.08) 0%,
    rgba(56, 189, 248, 0.06) 100%
  );
}

.dash-ml-panel--compact {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
}

.dash-ml-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.dash-ml-panel__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(167, 139, 250, 0.95);
}

.dash-ml-select {
  min-width: 12rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 18, 30, 0.75);
  color: rgba(226, 232, 240, 0.92);
  font: inherit;
  font-size: 0.78rem;
  cursor: not-allowed;
  opacity: 0.92;
}

.dash-ml-panel__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.dash-ml-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.dash-ml-metric__k {
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.72rem;
}

.dash-ml-metric__v {
  font-weight: 650;
  color: #e8eef7;
}

.dash-ml-metric__v--accent {
  color: #7dd3fc;
}

.dash-ml-metric__v--warn {
  color: #fbbf24;
}

.dash-ml-legend {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.dash-ml-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-ml-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-ml-swatch--hist {
  background: rgba(56, 189, 248, 0.85);
}

.dash-ml-swatch--yoy {
  background: repeating-linear-gradient(
    45deg,
    rgba(244, 114, 182, 0.7),
    rgba(244, 114, 182, 0.7) 2px,
    transparent 2px,
    transparent 4px
  );
  border: 1px solid rgba(244, 114, 182, 0.5);
}

.dash-ml-swatch--fc {
  background: rgba(167, 139, 250, 0.9);
}

.dash-ml-swatch--band {
  background: rgba(244, 114, 182, 0.25);
  border: 1px solid rgba(244, 114, 182, 0.35);
}

.dash-ml-panel__foot {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-kpi-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-kpi-row--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dash-kpi-row--6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dash-kpi-row--single {
  grid-template-columns: 1fr;
}

.dash-kpi {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 22, 36, 0.72);
}

.dash-kpi--wide {
  grid-column: 1 / -1;
  max-width: 100%;
}

/* Matriz RFM — grade quintis + painel de segmentos */
.dash-rfm {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-rfm__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem 1.15rem;
  align-items: stretch;
}

.dash-rfm__heat-wrap,
.dash-rfm__segments {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-rfm__heat-kicker,
.dash-rfm__seg-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.dash-rfm__heat {
  display: grid;
  grid-template-columns: 2.15rem repeat(5, minmax(0, 1fr));
  grid-template-rows: auto repeat(5, minmax(44px, 1fr));
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.dash-rfm__heat-corner {
  display: block;
}

.dash-rfm__heat-h,
.dash-rfm__heat-v {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.95);
}

.dash-rfm__heat-v {
  justify-content: flex-end;
  padding-right: 0.35rem;
}

.dash-rfm__heat-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  cursor: crosshair;
  transition: transform 0.12s ease, outline 0.12s ease;
}

.dash-rfm__heat-cell strong {
  font-weight: 700;
}

.dash-rfm__heat-cell:hover {
  transform: scale(1.03);
  outline: 1.5px solid rgba(255, 255, 255, 0.45);
  outline-offset: 0;
  z-index: 1;
}

.dash-rfm__heat-cell--empty {
  color: transparent;
  cursor: default;
}

.dash-rfm__heat-cell--empty:hover {
  transform: none;
  outline: none;
}

.dash-rfm__heat-foot {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.dash-rfm__seg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.dash-rfm__seg {
  position: relative;
  display: grid;
  grid-template-columns: 0.55rem minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.55rem;
  align-items: center;
  padding: 0.55rem 0.6rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 22, 36, 0.55);
  overflow: hidden;
}

.dash-rfm__seg-swatch {
  grid-row: 1 / span 2;
  width: 0.55rem;
  height: 100%;
  min-height: 2.2rem;
  border-radius: 999px;
}

.dash-rfm__seg-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.dash-rfm__seg-name {
  font-size: 0.8rem;
  font-weight: 650;
  color: #f1f5f9;
  line-height: 1.25;
}

.dash-rfm__seg-meta {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.dash-rfm__seg-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.08rem;
  text-align: right;
}

.dash-rfm__seg-val {
  font-size: 0.8rem;
  font-weight: 650;
  color: #e2e8f0;
  white-space: nowrap;
}

.dash-rfm__seg-pct {
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.9);
  white-space: nowrap;
}

.dash-rfm__seg-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 2px 0 0;
  opacity: 0.85;
  pointer-events: none;
}

.dash-rfm__total {
  margin: 0.65rem 0 0;
  font-size: 0.74rem;
  line-height: 1.4;
}

/* ===== Interação: clicar num segmento destaca a matriz + abre detalhe ===== */
.dash-rfm__seg {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.dash-rfm__seg:hover {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(30, 36, 56, 0.75);
}

.dash-rfm__seg:focus-visible {
  outline: 2px solid rgba(129, 140, 248, 0.6);
  outline-offset: 2px;
}

.dash-rfm__seg.is-active {
  border-color: rgba(129, 140, 248, 0.65);
  background: rgba(79, 70, 229, 0.16);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35) inset;
}

/* Células da matriz sob filtro de segmento */
.dash-rfm--filtered .dash-rfm__heat-cell.is-dim {
  opacity: 0.22;
  filter: saturate(0.5);
}

.dash-rfm--filtered .dash-rfm__heat-cell.is-match {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: -1px;
  z-index: 1;
}

/* Painel de detalhamento do segmento */
.dash-rfm__detail {
  margin-top: 0.6rem;
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(129, 140, 248, 0.3);
  background: rgba(79, 70, 229, 0.1);
}

.dash-rfm__detail-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.dash-rfm__detail-head .dash-rfm__seg-swatch {
  grid-row: auto;
  width: 0.55rem;
  height: 1.1rem;
  min-height: 0;
  flex-shrink: 0;
}

.dash-rfm__detail-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
  flex: 1;
  min-width: 0;
}

.dash-rfm__detail-close {
  border: none;
  background: transparent;
  color: rgba(148, 163, 184, 0.95);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.dash-rfm__detail-close:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}

.dash-rfm__detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.55rem;
}

.dash-rfm__detail-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dash-rfm__detail-k {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.9);
}

.dash-rfm__detail-v {
  font-size: 0.82rem;
  font-weight: 650;
  color: #e2e8f0;
}

.dash-rfm__detail-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.9);
}

.dash-rfm__detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.dash-rfm__detail-chip {
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.dash-rfm__detail-chip strong {
  color: #ffffff;
}

.dash-rfm__detail-listhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.dash-rfm__detail-listhead .dash-rfm__detail-kicker {
  margin: 0;
}

.dash-rfm__detail-note {
  font-size: 0.66rem;
  color: rgba(148, 163, 184, 0.9);
}

.dash-rfm__clients-wrap {
  margin-top: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.dash-rfm__clients {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.dash-rfm__clients thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.96);
  color: rgba(148, 163, 184, 0.95);
  font-weight: 600;
  text-align: right;
  padding: 0.4rem 0.55rem;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dash-rfm__clients thead th:first-child {
  text-align: left;
}

.dash-rfm__clients tbody td {
  padding: 0.34rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.dash-rfm__clients tbody tr:last-child td {
  border-bottom: none;
}

.dash-rfm__clients tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.dash-rfm__cli-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-rfm__cli-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__clients-wrap {
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__clients thead th {
  background: #ffffff;
  color: rgba(51, 65, 85, 0.95);
  border-bottom-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__clients tbody td {
  color: #12283f;
  border-bottom-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__clients tbody tr:hover td {
  background: rgba(18, 40, 63, 0.04);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__detail-note {
  color: rgba(71, 85, 105, 0.9);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg:hover {
  background: rgba(18, 40, 63, 0.05);
  border-color: rgba(18, 40, 63, 0.18);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg.is-active {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.5);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__detail {
  background: rgba(99, 102, 241, 0.07);
  border-color: rgba(99, 102, 241, 0.28);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__detail-name,
html[data-login-theme="light"] body.page-portal .dash-rfm__detail-v {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__detail-chip {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.15);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__detail-chip strong {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .dash-rfm--filtered .dash-rfm__heat-cell.is-match {
  outline-color: rgba(15, 23, 42, 0.75);
}

@media (max-width: 900px) {
  .dash-rfm__layout {
    grid-template-columns: 1fr;
  }
}

.dash-kpi__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.95);
  margin-bottom: 0.35rem;
}

.dash-kpi__value {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.dash-kpi__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.95);
}

.dash-kpi__delta {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}

.dash-kpi__delta--up {
  color: #4ade80;
}

.dash-kpi__delta--down {
  color: #f87171;
}

.dash-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.dash-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Clientes: Top 5 (hbar) + recência na mesma linha — alturas alinhadas. */
.dash-grid--clientes-charts {
  align-items: stretch;
}

.dash-grid--clientes-charts > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--clientes-charts > [data-card-id="cli-chart-faturamento"] .dash-hbar-list {
  flex: 1 1 auto;
  min-height: 10.5rem;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}

.dash-grid--clientes-charts > [data-card-id="cli-chart-recencia"] .dash-chart-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  min-height: 10.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.15rem;
}

.dash-grid--clientes-charts > [data-card-id="cli-chart-recencia"] .dash-svg-chart {
  width: 100%;
  height: auto;
  max-height: 10.5rem;
}

/* Faturamento: tempo + calor à esquerda (mesma altura); mapa regional ocupa a coluna direita (2 linhas). */
.dash-grid--faturamento-charts {
  align-items: stretch;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  min-height: 26rem;
}

.dash-grid--faturamento-charts > .dash-card {
  margin-bottom: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-heatmap"] {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] > .dash-card__head,
.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-heatmap"] > .dash-card__head,
.dash-grid--faturamento-charts > .dash-card--map-row-span > .dash-card__head {
  flex-shrink: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] > .dash-chart-placeholder {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  margin-top: 0.5rem;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] .dash-svg-chart {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-heatmap"] > .dash-heat {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  margin-top: 0.5rem;
  box-sizing: border-box;
  overflow: hidden;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-heatmap"] .dash-heat.mock-heat {
  height: auto;
}

.dash-grid--faturamento-charts > .dash-card--map-row-span {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.6rem 0.65rem 0.45rem;
}

.dash-grid--faturamento-charts > .dash-card--map-row-span > .dash-card__head {
  margin-bottom: 0.1rem;
  flex-shrink: 0;
}

.dash-grid--faturamento-charts > .dash-card--map-row-span .dash-geomap {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
}

.dash-grid--faturamento-charts > .dash-card--map-row-span .dash-geomap__svg {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.dash-card {
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 22, 36, 0.65);
  backdrop-filter: blur(8px);
  margin-bottom: 0.85rem;
}

.dash-card--chart .dash-chart-placeholder {
  margin-top: 0.5rem;
}

.dash-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.dash-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.dash-card__sub {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}

.dash-card__badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.2);
  color: #e9d5ff;
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.dash-card__badge--forecast {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

.dash-card__link {
  font-size: 0.78rem;
  color: rgba(56, 189, 248, 0.95);
  cursor: default;
}

.dash-chart-placeholder {
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.dash-svg-chart {
  width: 100%;
  height: auto;
  display: block;
}

/* Mapa geográfico por UF (choropleth SVG + fallback em tiles). */
.dash-geomap {
  margin-top: 0.5rem;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.55);
}

.dash-geomap__svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 12rem;
}

.dash-geomap__state {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 0.65;
  transition: opacity 0.12s ease, stroke-width 0.12s ease, filter 0.12s ease;
  cursor: default;
}

.dash-geomap__state:hover {
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1;
  filter: brightness(1.12);
}

.dash-geomap__state[data-has-value="0"] {
  opacity: 1;
}

.dash-geomap__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  grid-auto-rows: 1fr;
  gap: 6px;
  width: 100%;
  padding: 4px;
}

.dash-geomap__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  min-height: 1.6rem;
  font-size: 0.62rem;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dash-geomap__tile:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.dash-geomap__uf {
  pointer-events: none;
  fill: #f1f5f9;
  font-family: system-ui, sans-serif;
  font-size: 8px;
  font-weight: 700;
  paint-order: stroke fill;
  stroke: rgba(15, 23, 42, 0.85);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

.dash-geomap__tile .dash-geomap__uf {
  fill: currentColor;
  stroke: none;
  font-size: 0.62rem;
  font-weight: 700;
  paint-order: unset;
}

.dash-geomap__legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  padding: 0.35rem 0.5rem 0.45rem;
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.85);
}

.dash-geomap__legend-bar {
  display: flex;
  flex: 1 1 5rem;
  gap: 2px;
  min-width: 4rem;
}

.dash-geomap__legend-cell {
  flex: 1;
  height: 0.45rem;
  border-radius: 2px;
}

.dash-geomap__legend-range {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

/* Estilos dos elementos desenhados por renderTimeSeriesSvg / renderHistogramSvg
   (séries temporais, combo barras+linha e histogramas). */
.dash-svg-grid {
  stroke: rgba(148, 163, 184, 0.16);
  stroke-width: 1;
}
.dash-svg-grid--zero {
  stroke: rgba(148, 163, 184, 0.4);
}
.dash-svg-forecast-divider {
  stroke: rgba(167, 139, 250, 0.45);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.dash-svg-forecast-line {
  opacity: 0.95;
}
.dash-svg-axis {
  fill: rgba(148, 163, 184, 0.85);
  font-family: system-ui, sans-serif;
  font-size: 9px;
}
.dash-svg-axis--right {
  fill: rgba(244, 114, 182, 0.9);
}
.dash-svg-legend-text {
  fill: rgba(226, 232, 240, 0.92);
  font-family: system-ui, sans-serif;
  font-size: 9px;
}
.dash-svg-hot {
  fill: transparent;
  cursor: pointer;
}
.dash-svg-bar-label {
  fill: rgba(226, 232, 240, 0.92);
  font-family: system-ui, sans-serif;
  font-size: 7.5px;
  font-weight: 600;
}
.dash-svg-bar-label--inside {
  fill: rgba(15, 23, 42, 0.95);
}
.dash-svg-forecast-label {
  fill: rgba(244, 114, 182, 0.95);
}
.dash-svg-combo-line {
  stroke: rgba(244, 114, 182, 0.95);
  stroke-width: 2;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.dash-svg-combo-dot {
  fill: rgba(244, 114, 182, 0.95);
}
.dash-svg-combo-label {
  fill: rgba(244, 114, 182, 0.95);
  font-family: system-ui, sans-serif;
  font-size: 7.5px;
  font-weight: 600;
}

/* Tema claro: texto e grade precisam de contraste em fundo claro. */
html[data-login-theme="light"] body.page-portal .dash-svg-axis {
  fill: #334155;
}
html[data-login-theme="light"] body.page-portal .dash-svg-axis--right {
  fill: rgba(190, 24, 93, 0.95);
}
html[data-login-theme="light"] body.page-portal .dash-svg-legend-text {
  fill: rgba(30, 41, 59, 0.92);
}
html[data-login-theme="light"] body.page-portal .dash-svg-bar-label {
  fill: rgba(30, 41, 59, 0.92);
}
html[data-login-theme="light"] body.page-portal .dash-svg-bar-label--inside {
  fill: rgba(248, 250, 252, 0.98);
}
html[data-login-theme="light"] body.page-portal .dash-svg-grid {
  stroke: rgba(51, 65, 85, 0.28);
}
html[data-login-theme="light"] body.page-portal .dash-svg-grid--zero {
  stroke: rgba(51, 65, 85, 0.5);
}
html[data-login-theme="light"] body.page-portal .dash-svg-combo-line,
html[data-login-theme="light"] body.page-portal .dash-svg-combo-dot,
html[data-login-theme="light"] body.page-portal .dash-svg-combo-label {
  stroke: rgba(190, 24, 93, 0.95);
}
html[data-login-theme="light"] body.page-portal .dash-svg-combo-dot,
html[data-login-theme="light"] body.page-portal .dash-svg-combo-label {
  fill: rgba(190, 24, 93, 0.95);
}

/*
 * Heatmap dia × hora (renderizado a partir de /api/charts/heatmap).
 *
 * Estrutura: linha 1 = canto vazio + 24 rótulos de hora.
 *           linhas 2..8 = rótulo do dia + 24 células.
 * Largura: cada coluna de hora é fluida (1fr); a coluna de rótulos de dia
 * tem largura fixa para alinhamento. As linhas também são 1fr — o grid se
 * estica para preencher toda a altura disponível do `.dash-heat`.
 */
.dash-heat--axis {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  /* Quando dentro do card, ocupa todo o espaço disponível abaixo do título. */
  flex: 1 1 auto;
  min-height: 0;
}

.dash-heat-grid {
  display: grid;
  grid-template-columns: 2.4rem repeat(24, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 2px;
  margin-top: 0.5rem;
  padding: 6px 8px 6px 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  flex: 1 1 auto;
  min-height: 0;
}

/* Em fullscreen, o `.dash-heat` já recebe flex-stretch; alinhamos altura. */
.dash-heat--axis .dash-heat-grid {
  margin-top: 0;
}

.dash-heat-cell {
  border-radius: 2px;
  min-width: 0;
  min-height: 0;
  cursor: crosshair;
  transition: outline 80ms ease, transform 80ms ease;
}

.dash-heat-cell:hover {
  outline: 1.5px solid rgba(255, 255, 255, 0.55);
  outline-offset: 0;
  z-index: 1;
}

/* Rótulos do eixo X (horas) — primeira linha do grid. */
.dash-heat-haxis {
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.95);
  text-align: center;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  align-self: end;
  padding-bottom: 2px;
}

/* Rótulos do eixo Y (dias) — primeira coluna de cada linha. */
.dash-heat-vaxis {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
  text-align: right;
  padding-right: 6px;
  align-self: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Canto superior esquerdo do grid (vazio) — só reserva o slot. */
.dash-heat-corner {
  display: block;
}

/* Legenda de intensidade (gradiente) abaixo do grid. */
.dash-heat-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.dash-heat-legend__caption {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dash-heat-legend__bar {
  display: inline-flex;
  gap: 1px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-heat-legend__cell {
  width: 22px;
  height: 12px;
  display: inline-block;
}

.dash-heat-legend__range {
  margin-left: auto;
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.dash-heat-legend__min,
.dash-heat-legend__max {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
}

/*
 * Quando o card contém um heatmap renderizado (`.dash-heat--axis`), o card
 * vira flex-column para o grid esticar verticalmente até preencher o card.
 */
.dash-card:has(.dash-heat--axis) {
  display: flex;
  flex-direction: column;
}

.dash-card:has(.dash-heat--axis) > .dash-card__head {
  flex-shrink: 0;
}

/*
 * Tooltip flutuante dos gráficos SVG e heatmaps (`.dash-chart-tooltip`),
 * posicionado em relação ao card e movido via mousemove pelo JS. Usa
 * `pointer-events: none` para não interferir com os eventos do próprio gráfico.
 */
.dash-chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(15, 18, 30, 0.96);
  color: #f1f5f9;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 90ms ease;
}

.dash-chart-tooltip.is-visible {
  opacity: 1;
}

.dash-chart-tooltip::after {
  /* Pequena seta apontando para o ponto/barra. */
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: inherit;
  border-right: 1px solid rgba(167, 139, 250, 0.4);
  border-bottom: 1px solid rgba(167, 139, 250, 0.4);
  transform: translateX(-50%) rotate(45deg);
}

.dash-chart-tooltip__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.dash-chart-tooltip__value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Realce sutil para itens que vieram do mapeamento real */
.dash-kpi--is-real .dash-kpi__value {
  color: rgba(186, 230, 253, 0.98);
}

.dash-heat.mock-heat {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 3px;
  height: 140px;
  margin-top: 0.5rem;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.dash-heat.mock-heat::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 7px,
    rgba(255, 255, 255, 0.04) 7px,
    rgba(255, 255, 255, 0.04) 8px
  );
  border-radius: 6px;
  pointer-events: none;
}

.mock-heat {
  background: linear-gradient(
    145deg,
    rgba(30, 58, 138, 0.5) 0%,
    rgba(56, 189, 248, 0.25) 35%,
    rgba(99, 102, 241, 0.35) 70%,
    rgba(30, 27, 75, 0.6) 100%
  ) !important;
}

.dash-seg {
  display: inline-flex;
  gap: 0.2rem;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-seg__btn {
  padding: 0.3rem 0.55rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(148, 163, 184, 0.95);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dash-seg__btn:hover {
  color: #e8eef7;
}

.dash-seg__btn.is-active {
  background: rgba(56, 189, 248, 0.22);
  color: #f8fafc;
}

.dash-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.65rem;
}

.dash-split--60 {
  grid-template-columns: 1.1fr 0.9fr;
}

.dash-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash-rank-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.84rem;
}

.dash-rank-list__n {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.dash-rank-list__v {
  margin-left: auto;
  font-weight: 600;
  color: rgba(56, 189, 248, 0.95);
  font-variant-numeric: tabular-nums;
}

/*
 * Lista ranqueada paginada (10 itens por página, 2 colunas).
 * Usada pelo card "Explorador de receita por dimensão" e suportada
 * pelo renderer `renderRankPaged` em analytics-data.js.
 */
.dash-rank-paged {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.dash-rank-paged__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
}

/* Em telas estreitas (1 coluna no card) cai para 1 coluna. */
@media (max-width: 720px) {
  .dash-rank-paged__cols {
    grid-template-columns: 1fr;
  }
}

.dash-rank-list--col {
  /* Permite a coluna encolher dentro do grid sem estourar o card. */
  min-width: 0;
}

.dash-rank-list--col li {
  /* Em colunas estreitas, label muito longo é cortado com ellipsis. */
  min-width: 0;
}

.dash-rank-list--col li > span:not(.dash-rank-list__n):not(.dash-rank-list__v) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.dash-rank-paged__pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-rank-paged__info {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
  font-variant-numeric: tabular-nums;
}

.dash-rank-paged__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(56, 189, 248, 0.08);
  color: rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.dash-rank-paged__btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.dash-rank-paged__btn:active:not(:disabled) {
  transform: translateY(1px);
}

.dash-rank-paged__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dash-rank-paged__btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.65);
  outline-offset: 2px;
}

/* Tema claro. */
html[data-login-theme="light"] body.page-portal .dash-rank-paged__pager {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-rank-paged__info {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-rank-paged__btn {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(18, 40, 63, 0.12);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-rank-paged__btn:hover:not(:disabled) {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(2, 132, 199, 0.5);
}

/*
 * Tabela paginada (10 itens por página) — card "Operação de pedidos".
 * Mesmo paginador visual do `.dash-rank-paged`, mas em formato tabela.
 * Renderer: `renderTablePaged` em analytics-data.js.
 */
.dash-table-paged {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.dash-table-paged__pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-table-paged__info {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
  font-variant-numeric: tabular-nums;
}

.dash-table-paged__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(56, 189, 248, 0.08);
  color: rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.dash-table-paged__btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.dash-table-paged__btn:active:not(:disabled) {
  transform: translateY(1px);
}

.dash-table-paged__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dash-table-paged__btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.65);
  outline-offset: 2px;
}

html[data-login-theme="light"] body.page-portal .dash-table-paged__pager {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-table-paged__info {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-table-paged__btn {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(18, 40, 63, 0.12);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-table-paged__btn:hover:not(:disabled) {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(2, 132, 199, 0.5);
}

.dash-detail-panel__h {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.dash-spark {
  height: 48px;
  margin-top: 0.75rem;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.15),
    rgba(167, 139, 250, 0.35),
    rgba(56, 189, 248, 0.1)
  );
  opacity: 0.85;
}

.dash-table-wrap {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-table th,
.dash-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(148, 163, 184, 0.95);
  background: rgba(0, 0, 0, 0.2);
}

.dash-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.dash-bar-cell {
  display: block;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.85), rgba(99, 102, 241, 0.5));
  width: var(--w, 50%);
  min-width: 12px;
}

.dash-bar-cell--green {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.85), rgba(56, 189, 248, 0.4));
}

.dash-hbar-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dash-hbar-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 2fr) auto;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.dash-hbar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.85), rgba(99, 102, 241, 0.45));
  width: 100%;
  max-width: var(--w, 50%);
}

.dash-hbar--inline {
  max-width: 120px;
  margin-inline: 0.35rem;
}

.ven-seller-status {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 280px;
  overflow-y: auto;
}

.ven-seller-status--hidden {
  display: none !important;
}

.ven-seller-status-wrap {
  margin-top: 0.15rem;
}

.ven-seller-status-preview {
  padding: 0.15rem 0 0.25rem;
}

.ven-seller-status-preview__label {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  text-align: center;
  line-height: 1.35;
}

.ven-seller-status-preview__svg {
  display: block;
  width: 100%;
  max-height: 168px;
  opacity: 0.82;
}

.ven-seller-status-preview[hidden] {
  display: none !important;
}

html[data-login-theme="light"] body.page-portal .ven-seller-status-preview__svg text[fill="#e2e8f0"] {
  fill: #12283f;
}

html[data-login-theme="light"] body.page-portal .ven-seller-status-preview__svg rect[stroke="rgba(255,255,255,0.07)"] {
  fill: rgba(18, 40, 63, 0.03);
  stroke: rgba(18, 40, 63, 0.1);
}

.ven-seller-status__empty {
  padding: 0.6rem 0.2rem;
  font-size: 0.82rem;
}

.ven-seller-status__row {
  display: grid;
  gap: 0.3rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.ven-seller-status__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.ven-seller-status__name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ven-seller-status__pct {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ven-seller-status__row--ok .ven-seller-status__pct {
  color: #4ade80;
}

.ven-seller-status__row--mid .ven-seller-status__pct {
  color: #38bdf8;
}

.ven-seller-status__row--low .ven-seller-status__pct {
  color: #fb7185;
}

.ven-seller-status__row--na .ven-seller-status__pct {
  color: rgba(148, 163, 184, 0.9);
}

.ven-seller-status__bar {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.ven-seller-status__bar::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--w, 0%);
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.9), rgba(99, 102, 241, 0.7));
}

.ven-seller-status__row--ok .ven-seller-status__bar::after {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.95), rgba(34, 197, 94, 0.65));
}

.ven-seller-status__row--low .ven-seller-status__bar::after {
  background: linear-gradient(90deg, rgba(251, 113, 133, 0.9), rgba(244, 63, 94, 0.55));
}

.ven-seller-status__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.95);
}

.ven-seller-status__meta strong {
  color: #e2e8f0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

html[data-login-theme="light"] body.page-portal .ven-seller-status__row {
  background: rgba(18, 40, 63, 0.03);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .ven-seller-status__name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .ven-seller-status__bar {
  background: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .ven-seller-status__meta strong {
  color: #0f172a;
}

/* ================================================================
 * Funil de situação (Pedidos) — barras decrescentes simulando funil.
 * O efeito de afunilamento vem do `--w` (largura) progressivo nas
 * linhas; visualmente lembra um trapezóide invertido.
 * ================================================================ */
.dash-funnel-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.dash-funnel-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.dash-funnel-row__label {
  color: rgba(226, 232, 240, 0.92);
  white-space: nowrap;
}

.dash-funnel-row__bar {
  height: 28px;
  border-radius: 8px;
  width: var(--w, 100%);
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.85), rgba(56, 189, 248, 0.55));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: width 200ms ease;
}

.dash-funnel-row--alert .dash-funnel-row__bar {
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.85), rgba(244, 114, 182, 0.55));
}

.dash-funnel-row__value {
  color: rgba(226, 232, 240, 0.95);
  font-weight: 600;
  min-width: 4ch;
  text-align: right;
}

html[data-login-theme="light"] body.page-portal .dash-funnel-row__label {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-funnel-row__value {
  color: #0f172a;
}

/* ================================================================
 * Calendário de vencimentos (heatmap semanal × dia da semana).
 * Mock: template estático até a API responder. Real: `renderCalendarHeat`.
 * ================================================================ */
.dash-calendar-heat {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.dash-calendar-heat__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.25rem 0.1rem 0.4rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.dash-calendar-heat__month {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.95);
  text-transform: capitalize;
  letter-spacing: 0.01em;
}

.dash-calendar-heat__stats {
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.92);
  font-variant-numeric: tabular-nums;
}

.dash-calendar-heat__stats strong {
  color: rgba(56, 189, 248, 0.95);
  font-weight: 700;
}

.dash-calendar-heat__head,
.dash-calendar-heat__row {
  display: grid;
  grid-template-columns: 32px repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: stretch;
}

.dash-calendar-heat__head span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.78);
  text-align: center;
  padding-bottom: 0.25rem;
}

.dash-calendar-heat__week {
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.7);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.2rem;
}

.dash-calendar-heat:not(.dash-calendar-heat--real) .dash-calendar-heat__row span:not(.dash-calendar-heat__week) {
  height: 26px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.10);
  position: relative;
  overflow: hidden;
}

.dash-calendar-heat--real .dash-calendar-heat__cell {
  --base: 56, 189, 248;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.15rem;
  min-height: 56px;
  padding: 0.3rem 0.4rem 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background-color: rgba(var(--base), calc(0.06 + 0.78 * var(--intensity, 0)));
  cursor: default;
  transition: transform 120ms ease, box-shadow 120ms ease;
  position: relative;
  overflow: hidden;
}

.dash-calendar-heat--real .dash-calendar-heat__cell[data-has-value="0"] {
  background-color: rgba(148, 163, 184, 0.06);
  border-color: rgba(148, 163, 184, 0.10);
}

.dash-calendar-heat--real .dash-calendar-heat__cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
  border-color: rgba(56, 189, 248, 0.45);
}

.dash-calendar-heat--real .dash-calendar-heat__day-num {
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.72);
  font-weight: 500;
  text-align: left;
  line-height: 1;
}

.dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.7"] .dash-calendar-heat__day-num,
.dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.8"] .dash-calendar-heat__day-num,
.dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.9"] .dash-calendar-heat__day-num,
.dash-calendar-heat--real .dash-calendar-heat__cell[data-i="1.00"] .dash-calendar-heat__day-num {
  color: rgba(255, 255, 255, 0.85);
}

.dash-calendar-heat--real .dash-calendar-heat__day-val {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.97);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.45);
}

.dash-calendar-heat__empty {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

.dash-calendar-heat__legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.25rem;
  padding: 0.25rem 0.1rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.78);
}

.dash-calendar-heat__legend-scale {
  display: inline-flex;
  gap: 2px;
}

.dash-calendar-heat__legend-scale span {
  width: 16px;
  height: 10px;
  border-radius: 2px;
  background-color: rgba(56, 189, 248, calc(0.06 + 0.78 * var(--intensity, 0)));
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat__head span,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat__week {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__day-num {
  color: #1f2937;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.7"] .dash-calendar-heat__day-num,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.8"] .dash-calendar-heat__day-num,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.9"] .dash-calendar-heat__day-num,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="1.00"] .dash-calendar-heat__day-num {
  color: #f8fafc;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__day-val {
  color: #0f172a;
  text-shadow: none;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.6"] .dash-calendar-heat__day-val,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.7"] .dash-calendar-heat__day-val,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.8"] .dash-calendar-heat__day-val,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="0.9"] .dash-calendar-heat__day-val,
html[data-login-theme="light"] body.page-portal .dash-calendar-heat--real .dash-calendar-heat__cell[data-i="1.00"] .dash-calendar-heat__day-val {
  color: #ffffff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.45);
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat__month {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat__stats {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat__stats strong {
  color: #0ea5e9;
}

html[data-login-theme="light"] body.page-portal .dash-calendar-heat__legend {
  color: #475569;
  border-top-color: rgba(15, 23, 42, 0.10);
}

/* ================================================================
 * Donut + legenda lateral (Concentração por fornecedor).
 * Em telas largas o donut fica à esquerda e a legenda à direita;
 * abaixo de 540px empilha (svg ocupa toda a largura).
 * ================================================================ */
.dash-donut-wrap {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  margin-top: 0.55rem;
}

.dash-donut-svg {
  width: 200px;
  height: 200px;
  flex: none;
}

.dash-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.dash-donut-legend li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  color: rgba(226, 232, 240, 0.92);
}

.dash-donut-legend__sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.dash-donut-legend__pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.96);
}

.dash-donut-label {
  fill: #ffffff;
  font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(15, 23, 42, 0.55);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

html[data-login-theme="light"] body.page-portal .dash-donut-label {
  fill: #ffffff;
  stroke: rgba(15, 23, 42, 0.7);
}

@media (max-width: 540px) {
  .dash-donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

html[data-login-theme="light"] body.page-portal .dash-donut-legend li,
html[data-login-theme="light"] body.page-portal .dash-donut-legend__pct {
  color: #0f172a;
}

.dash-pill {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.2);
  font-size: 0.72rem;
  font-weight: 600;
}

.dash-pill--up {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

.dash-pill--down {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.dash-exp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash-exp-list li {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  gap: 0.35rem;
}

.dash-exp-list__n {
  width: 1.35rem;
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.75rem;
}

.mock-scatter {
  height: 160px;
  margin-top: 0.5rem;
  border-radius: 10px;
  background:
    rgba(0, 0, 0, 0.2),
    radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.5) 0, transparent 12px),
    radial-gradient(circle at 45% 55%, rgba(167, 139, 250, 0.45) 0, transparent 10px),
    radial-gradient(circle at 70% 25%, rgba(74, 222, 128, 0.4) 0, transparent 9px),
    radial-gradient(circle at 60% 70%, rgba(248, 113, 113, 0.35) 0, transparent 11px);
}

.dash-badge-ok {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(74, 222, 128, 0.18);
  color: #86efac;
}

.dash-badge-warn {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
}

.dash-kanban {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.mock-kanban--full {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-kanban__col {
  padding: 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-kanban__col h3 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(148, 163, 184, 0.95);
}

.dash-kanban__count {
  font-weight: 700;
  color: rgba(56, 189, 248, 0.95);
}

.dash-kanban__card {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  margin-bottom: 0.45rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ----- Home: hero + KPIs + grid de módulos moderno ----- */

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 60% 120% at 0% 0%, rgba(56, 189, 248, 0.12), transparent 65%),
    radial-gradient(ellipse 60% 120% at 100% 100%, rgba(167, 139, 250, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(18, 22, 36, 0.75), rgba(12, 15, 24, 0.6));
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 40%);
  pointer-events: none;
}

.home-hero__left {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.home-hero__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(167, 139, 250, 0.95);
}

.home-hero__title {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.home-hero__title-accent {
  background: linear-gradient(90deg, #7dd3fc 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-hero__lead {
  margin: 0;
  max-width: 60ch;
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(203, 213, 225, 0.92);
}

.home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.home-hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #e8eef7;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.home-hero__btn:hover {
  text-decoration: none;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

.home-hero__btn--primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.9) 0%, rgba(129, 140, 248, 0.9) 100%);
  border-color: transparent;
  color: #0b1220;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.2);
}

.home-hero__btn--primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(56, 189, 248, 1) 0%, rgba(167, 139, 250, 1) 100%);
  color: #0b1220;
}

.home-hero__meta {
  margin: auto 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
}

.home-hero__meta code {
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: rgba(125, 211, 252, 0.95);
  font-size: 0.85em;
}

.home-hero__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
  flex-shrink: 0;
}

.home-hero__right {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  align-content: center;
}

.home-kpi {
  padding: 0.75rem 0.85rem 0.4rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 18, 30, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.home-kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.home-kpi__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.95);
}

.home-kpi__chip {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
}

.home-kpi__chip--up {
  background: rgba(74, 222, 128, 0.15);
  color: #86efac;
}

.home-kpi__chip--down {
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
}

.home-kpi__value {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.home-kpi__spark {
  margin: 0.15rem -0.35rem -0.15rem;
  width: calc(100% + 0.7rem);
  height: 30px;
  display: block;
}

/* Seção de título */
.home-sec {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.25rem 0 0.85rem;
}

.home-sec__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.home-sec__sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

/* Grid de módulos */
.m-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 1rem;
}

.m-card {
  --accent: 56, 189, 248;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(var(--accent), 0.1), transparent 60%),
    linear-gradient(180deg, rgba(22, 26, 42, 0.78) 0%, rgba(14, 18, 30, 0.72) 100%);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  backdrop-filter: blur(10px);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.m-card[data-accent="sky"]     { --accent: 56, 189, 248; }
.m-card[data-accent="violet"]  { --accent: 167, 139, 250; }
.m-card[data-accent="emerald"] { --accent: 52, 211, 153; }
.m-card[data-accent="amber"]   { --accent: 251, 191, 36; }
.m-card[data-accent="rose"]    { --accent: 244, 114, 182; }
.m-card[data-accent="cyan"]    { --accent: 34, 211, 238; }
.m-card[data-accent="indigo"]  { --accent: 129, 140, 248; }

.m-card:hover {
  text-decoration: none;
  color: inherit;
  transform: translateY(-3px);
  border-color: rgba(var(--accent), 0.45);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(var(--accent), 0.15);
}

.m-card__accent {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(var(--accent), 0.95) 0%, rgba(var(--accent), 0.15) 100%);
  opacity: 0.85;
  z-index: 1;
}

.m-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.m-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(var(--accent), 0.14);
  color: rgb(var(--accent));
  border: 1px solid rgba(var(--accent), 0.28);
}

.m-card__icon svg {
  width: 20px;
  height: 20px;
}

.m-card__chip {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(var(--accent), 0.16);
  color: rgb(var(--accent));
  border: 1px solid rgba(var(--accent), 0.28);
}

.m-card__title {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.m-card__desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.9);
  flex: 1;
}

.m-card__spark {
  width: calc(100% + 2.3rem);
  height: 40px;
  display: block;
  margin: 0.25rem -1.15rem -0.25rem;
}

.m-card__foot {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.65rem;
  margin-top: 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
}

.m-card__kpi {
  font-weight: 650;
  color: rgb(var(--accent));
}

.m-card__delta {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(203, 213, 225, 0.9);
}

.m-card__delta--up {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
}

.m-card__delta--down {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.m-card__go {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.95);
  transition: transform 0.18s ease, color 0.18s ease;
}

.m-card:hover .m-card__go {
  color: rgb(var(--accent));
  transform: translateX(2px);
}

/* ----- Visão Geral: painel consolidado + tela cheia ----- */

.home-hero--compact {
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}

.home-hero--compact .home-hero__title {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.overview-dashboard {
  min-width: 0;
}

.overview-dashboard--fullscreen {
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  padding: 1rem clamp(0.75rem, 2vw, 2rem) 2rem;
  background: #050510;
  overflow: auto;
}

/*
 * Modo "tela cheia" do dashboard analítico (qualquer view: Faturamento,
 * Pedidos, etc.).
 *
 * Quando o usuário ativa o botão de fullscreen, o `analytics-stage` é colocado
 * em fullscreen pela API nativa do browser. Este conjunto de regras comprime
 * paddings, margens e tamanhos para que o conteúdo principal da view caiba na
 * tela sem rolagem (ou com rolagem mínima). Estratégia:
 *   - Reduz o "chrome" (toolbar, headers).
 *   - Encolhe paddings e gaps de cards/grids.
 *   - Limita a altura dos gráficos SVG via `max-height: vh`.
 *   - Diminui o tamanho de fontes secundárias (mantém KPI/Big Number legíveis).
 */
.analytics-stage--fullscreen {
  height: 100vh;
  overflow: auto;
  padding: 0.7rem clamp(0.6rem, 1.4vw, 1.2rem);
  background: #050510;
  display: flex;
  flex-direction: column;
}

/*
 * ELO ESSENCIAL: o wrapper `.analytics-views` precisa ser um flex-column
 * que preenche a sobra do stage. Fora do fullscreen ele é `display: block`
 * com `overflow: auto` — o que fazia a view filha ficar na altura natural e
 * o wrapper rolar internamente (a barra de rolagem reportada). Tornando-o
 * flex-column, o `flex: 1` da view ativa e das linhas de gráfico passa a
 * valer, distribuindo a altura disponível e fazendo tudo caber sem rolar.
 */
.analytics-stage--fullscreen .analytics-views {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/*
 * Em fullscreen, a view ativa (Comercial, Financeiro, etc.) ocupa todo o
 * espaço restante após a toolbar e distribui internamente em coluna. Isso
 * permite que o último bloco (geralmente um card "wide" como o Explorador)
 * estique para preencher a sobra vertical da tela em vez de deixar espaço
 * vazio embaixo.
 */
.analytics-stage--fullscreen .analytics-view:not(.analytics-view--hidden) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-stage--fullscreen .analytics-view:not(.analytics-view--hidden)
  > .dash-card--wide:last-of-type {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-stage--fullscreen .analytics-view:not(.analytics-view--hidden)
  > .dash-card--wide:last-of-type .dash-rank-paged {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-stage--fullscreen .analytics-view:not(.analytics-view--hidden)
  > .dash-card--wide:last-of-type .dash-rank-paged__cols {
  flex: 1 1 auto;
  align-content: start;
}

/* Toolbar superior (título + filtros): mais compacto. */
.analytics-stage--fullscreen .analytics-toolbar {
  padding-top: 0;
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
  gap: 0.5rem 0.75rem;
}

.analytics-stage--fullscreen .analytics-page-title {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  margin: 0;
}

.analytics-stage--fullscreen .analytics-page-lead {
  display: none;
}

.analytics-stage--fullscreen .analytics-filter > span,
.analytics-stage--fullscreen .analytics-select {
  font-size: 0.78rem;
}

.analytics-stage--fullscreen .analytics-select {
  padding: 0.3rem 0.5rem;
}

/* Cards genéricos: padding e margin reduzidos. */
.analytics-stage--fullscreen .dash-card {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
}

.analytics-stage--fullscreen .dash-card__head {
  margin-bottom: 0.2rem;
}

.analytics-stage--fullscreen .dash-card__title {
  font-size: 0.92rem;
}

.analytics-stage--fullscreen .dash-card__sub {
  display: none;
}

/* KPIs: empilhamento mais denso, valor um pouco menor. */
.analytics-stage--fullscreen .dash-kpi-row {
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.analytics-stage--fullscreen .dash-kpi {
  padding: 0.55rem 0.7rem;
}

.analytics-stage--fullscreen .dash-kpi__label {
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
}

.analytics-stage--fullscreen .dash-kpi__value {
  /* Mantém o valor legível, mas com clamp menor para caber em duas linhas
     de KPIs sem empurrar gráficos para fora da tela. */
  font-size: clamp(0.95rem, 1.3vw, 1.2rem);
}

.analytics-stage--fullscreen .dash-kpi__delta {
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

/* Grids de cards (1, 2, 3 colunas) com gap compacto. */
.analytics-stage--fullscreen .dash-grid,
.analytics-stage--fullscreen .dash-grid--2,
.analytics-stage--fullscreen .dash-grid--3 {
  gap: 0.55rem;
}

/*
 * Cards dentro de grids (ex.: Faturamento + Calor lado a lado): flex column
 * com overflow oculto evita que o heatmap estoure o card quando a coluna
 * vizinha (gráfico SVG alto) estica a linha do grid.
 */
.analytics-stage--fullscreen .dash-grid > .dash-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.analytics-stage--fullscreen .dash-grid > .dash-card > .dash-card__head {
  flex-shrink: 0;
}

/*
 * Gráficos SVG em fullscreen.
 *
 * O SVG do gráfico de séries usa viewBox 460×230 (aspect 2:1) e
 * `preserveAspectRatio="xMidYMid meet"`, então quando `max-height` o limita,
 * a largura fica proporcional e sobra espaço lateral no card. Para que o
 * gráfico aproveite **toda a largura do card** em fullscreen, deixamos o
 * `max-height` alto o suficiente para a altura natural (largura/2) caber.
 * Cards de gráfico viram flex column para o placeholder absorver o espaço
 * vertical disponível.
 */
.analytics-stage--fullscreen .dash-card--chart {
  display: flex;
  flex-direction: column;
}

.analytics-stage--fullscreen .dash-card--chart .dash-chart-placeholder {
  margin-top: 0.25rem;
}

.analytics-stage--fullscreen .dash-chart-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analytics-stage--fullscreen .dash-svg-chart {
  width: 100%;
  height: auto;
  max-height: 55vh;
}

.analytics-stage--fullscreen .dash-geomap__svg {
  max-height: 55vh;
}

.analytics-stage--fullscreen .dash-geomap__grid {
  max-height: 55vh;
}

/* Painéis ML (mini-cards de métrica): padding reduzido. */
.analytics-stage--fullscreen .dash-ml-panel {
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}

.analytics-stage--fullscreen .dash-ml-metric {
  padding: 0.4rem 0.55rem;
}

.analytics-stage--fullscreen .dash-ml-metric__v {
  font-size: clamp(0.85rem, 1.2vw, 1.1rem);
}

/* Lista ranqueada paginada: linhas mais finas para mostrar 10 itens em
   colunas sem que a paginação fique escondida. */
.analytics-stage--fullscreen .dash-rank-list li {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.analytics-stage--fullscreen .dash-rank-list__n {
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.66rem;
}

.analytics-stage--fullscreen .dash-rank-paged {
  margin-top: 0.4rem;
  gap: 0.45rem;
}

.analytics-stage--fullscreen .dash-rank-paged__pager {
  padding-top: 0.2rem;
}

.analytics-stage--fullscreen .dash-rank-paged__btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
}

.analytics-stage--fullscreen .dash-rank-paged__info {
  font-size: 0.74rem;
}

/*
 * Heatmap (Calor: dia × hora) em fullscreen.
 *
 * Não usar `height: 100%` + `margin-top` no mesmo elemento — a soma estoura
 * o card quando o grid estica a linha para igualar o gráfico ao lado.
 * Estratégia: flex dentro do card (com `min-height: 0` + `overflow: hidden`
 * no pai) e o heatmap preenche só o espaço restante após o título.
 */
.analytics-stage--fullscreen .dash-heat {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  width: 100%;
  margin-top: 0.25rem;
  box-sizing: border-box;
  overflow: hidden;
}

.analytics-stage--fullscreen .dash-heat-grid {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  width: 100%;
  margin-top: 0;
  box-sizing: border-box;
}

.analytics-stage--fullscreen .dash-heat.mock-heat {
  /* Sobrescreve height: 140px do mock; preenche o card sem ultrapassar. */
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  height: auto;
  margin-top: 0.25rem;
}

.analytics-stage--fullscreen .dash-heat-cell {
  min-width: 0;
  min-height: 0;
}

/* Tema claro: fundo do stage em fullscreen acompanha o tema. */
html[data-login-theme="light"] body.page-portal .analytics-stage--fullscreen {
  background: #f7fafc;
}

/* ================================================================
 * Fullscreen — Faturamento (grid 2×2; linhas esquerda com mesma altura).
 * ================================================================ */
.analytics-stage--fullscreen [data-absorbed="faturamento"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] > .dash-kpi-row {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] > .dash-grid--faturamento-charts {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  margin-bottom: 0;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] > .dash-card--wide {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] .dash-grid--faturamento-charts > .dash-card--map-row-span .dash-geomap__svg {
  max-height: 100%;
  height: 100%;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] .dash-grid--faturamento-charts .dash-svg-chart {
  max-height: 100%;
}

/* ================================================================
 * Fullscreen — view de Pedidos (auto-fit).
 *
 * Pedidos tem MUITO mais conteúdo que Faturamento: 2 linhas de KPI +
 * 4 linhas de gráficos. A regra geral já transforma a view ativa num
 * flex-column, mas as linhas de gráfico ficavam na altura natural e
 * empilhavam, estourando a viewport (daí a barra de rolagem).
 *
 * Aqui distribuímos a altura disponível: KPIs ficam na altura natural
 * e as 4 `dash-grid` de gráficos repartem o espaço vertical restante
 * (flex: 1) — assim TUDO cabe na tela. Componentes muito densos (a
 * tabela de operação) mantêm rolagem interna própria.
 * ================================================================ */
/*
 * IMPORTANTE: o conteúdo de Pedidos é ABSORVIDO em `view-comercial` pelo JS
 * (`absorbViewsIntoDashboard`), que remove o `data-view="pedidos"` e move tudo
 * para um bloco `[data-absorbed="pedidos"]`. Portanto os seletores precisam
 * mirar esse bloco — NÃO `.analytics-view[data-view="pedidos"]` (que deixa de
 * existir após a absorção).
 */
.analytics-stage--fullscreen [data-absorbed="pedidos"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] > .dash-kpi-row {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] > .dash-grid {
  /*
   * Altura EXPLÍCITA por linha (não depende de flex-shrink propagar pela
   * cadeia, que se mostrou instável). São 4 linhas de gráfico: ~16vh cada
   * + 2 linhas de KPI (~13vh) + toolbar/paddings (~10vh) ≈ 87vh < 100vh,
   * então tudo cabe numa tela. `grid-auto-rows: minmax(0,1fr)` faz a linha
   * do grid preencher exatamente essa altura e o card encolher junto.
   */
  flex: 0 0 auto;
  height: 16vh;
  min-height: 0;
  margin-bottom: 0;
  grid-auto-rows: minmax(0, 1fr);
}

/* O card já é flex-column (regra geral .dash-grid > .dash-card). O bloco
   de conteúdo (após o título) absorve a altura restante da linha. */
.analytics-stage--fullscreen [data-absorbed="pedidos"] > .dash-grid > .dash-card
  > *:not(.dash-card__head):not(.card-customizer):not(.card-needs-config__notice) {
  flex: 1 1 auto;
  min-height: 0;
}

/* Gráficos SVG preenchem a altura da linha (sem o teto fixo de 55vh). */
.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-svg-chart {
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

/* Donut: encolhe junto com o card em vez de manter 200px fixos. */
.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-donut-wrap {
  height: 100%;
  align-items: center;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-donut-svg {
  width: auto;
  height: 100%;
  max-height: 100%;
  min-width: 0;
}

/* Calendário/funil/ranking preenchem o card sem estourar. */
.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-calendar-heat {
  height: 100%;
  min-height: 0;
}

/* Tabela de operação: rola internamente se não couber na linha. */
.analytics-stage--fullscreen [data-absorbed="pedidos"] #pedidos-panel-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-table-paged {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.analytics-stage--fullscreen [data-absorbed="pedidos"] .dash-table-paged__pager {
  flex: 0 0 auto;
}

/* Painel analítico: fundo unificado + partículas atrás de todo o conteúdo (#0b0e14, cartões nos módulos) */
body.page-portal .analytics-stage > .overview-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

body.page-portal .analytics-stage > :not(.overview-particles):not(.analytics-filters-fab) {
  position: relative;
  z-index: 1;
}

body.page-portal .analytics-stage {
  position: relative;
  background: #0b0e14;
  padding-left: clamp(1rem, 1.6vw, 1.5rem);
  padding-right: clamp(1rem, 1.6vw, 1.5rem);
}

.analytics-toolbar--overview {
  border-bottom-color: rgba(148, 163, 184, 0.1);
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
}

html[data-login-theme="dark"] .analytics-toolbar--overview .analytics-page-title {
  color: #f8fafc;
}

html[data-login-theme="dark"] .analytics-toolbar--overview .analytics-page-lead {
  color: rgba(148, 163, 184, 0.9);
}

/* Visão Geral — layout compartilhado (espelho escuro ↔ claro) */
#view-visao-geral .home-hero--compact {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.96fr);
  gap: clamp(1.1rem, 3vw, 1.65rem);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  backdrop-filter: none;
  overflow: hidden;
}

#view-visao-geral .home-hero--compact::before {
  display: none;
}

#view-visao-geral .home-hero__right {
  gap: 0.75rem;
}

#view-visao-geral .home-kpi {
  padding: 0.8rem 0.9rem 0.35rem;
  border-radius: 10px;
}

#view-visao-geral .home-kpi__value {
  font-size: 1.32rem;
}

#view-visao-geral .overview-charts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin: 1.5rem 0 1rem;
}

#view-visao-geral .overview-charts-head__copy {
  flex: 1 1 16rem;
  min-width: min(100%, 38rem);
}

#view-visao-geral .overview-charts-head__link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

#view-visao-geral .overview-charts-head__link:hover {
  text-decoration: none;
}

#view-visao-geral .overview-charts-grid {
  gap: 1.05rem;
}

#view-visao-geral .overview-chart-panel {
  border-radius: 12px;
}

#view-visao-geral .overview-chart-panel__accent {
  border-radius: 12px 0 0 12px;
}

#view-visao-geral .overview-chart-panel--wide-2 {
  grid-column: span 2;
}

@media (min-width: 1100px) {
  #view-visao-geral .overview-charts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1099px) {
  #view-visao-geral .home-hero--compact {
    grid-template-columns: 1fr;
  }
}

/* Visão Geral — cores tema escuro */
html[data-login-theme="dark"] #view-visao-geral .home-hero--compact {
  border: 1px solid rgba(240, 246, 252, 0.07);
  background: #161b22;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 48px rgba(0, 0, 0, 0.38);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__eyebrow {
  color: rgba(196, 181, 253, 0.92);
  letter-spacing: 0.11em;
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__title {
  color: #f8fafc;
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__title-accent {
  background: linear-gradient(92deg, #c4b5fd 0%, #a78bfa 35%, #60a5fa 72%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__lead {
  color: rgba(160, 170, 190, 0.96);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__lead strong {
  color: rgba(226, 232, 240, 0.96);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__btn {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(13, 17, 23, 0.65);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__btn:hover {
  border-color: rgba(129, 140, 248, 0.45);
  background: rgba(129, 140, 248, 0.12);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__btn--primary {
  background: linear-gradient(92deg, #7c3aed 0%, #6366f1 45%, #3b82f6 100%);
  border-color: transparent;
  color: #f8fafc;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.28);
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__btn--primary:hover {
  background: linear-gradient(92deg, #8b5cf6 0%, #818cf8 45%, #60a5fa 100%);
  color: #fff;
}

html[data-login-theme="dark"] #view-visao-geral .home-hero__meta {
  color: rgba(148, 163, 184, 0.92);
}

html[data-login-theme="dark"] #view-visao-geral .home-kpi {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #0d1117;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

html[data-login-theme="dark"] #view-visao-geral .home-kpi__value {
  color: #f1f5f9;
}

html[data-login-theme="dark"] #view-visao-geral .overview-charts-head__title {
  color: #f8fafc;
}

html[data-login-theme="dark"] #view-visao-geral .overview-charts-head__link {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(22, 27, 34, 0.9);
  color: #e2e8f0;
}

html[data-login-theme="dark"] #view-visao-geral .overview-charts-head__link:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(129, 140, 248, 0.12);
  color: #f8fafc;
}

html[data-login-theme="dark"] #view-visao-geral .overview-chart-panel {
  border: 1px solid rgba(240, 246, 252, 0.06);
  background: #161b22;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}

html[data-login-theme="dark"] #view-visao-geral .overview-chart-panel__title {
  color: #f1f5f9;
}

html[data-login-theme="dark"] #view-visao-geral .ov-chart-wrap {
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(13, 17, 23, 0.65);
}

.overview-charts-head {
  margin: 1.25rem 0 0.85rem;
}

.overview-charts-head__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.overview-charts-head__sub {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  max-width: 70ch;
}

.overview-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  width: 100%;
  max-width: none;
}

@media (max-width: 900px) {
  .overview-charts-grid {
    grid-template-columns: 1fr;
  }
}

.overview-chart-panel {
  --accent: 56, 189, 248;
  position: relative;
  min-width: 0;
  padding: 1rem 1rem 0.85rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(var(--accent), 0.12), transparent 55%),
    linear-gradient(180deg, rgba(22, 26, 42, 0.82) 0%, rgba(14, 18, 30, 0.78) 100%);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
  isolation: isolate;
}

.overview-chart-panel[data-accent="sky"] {
  --accent: 56, 189, 248;
}
.overview-chart-panel[data-accent="violet"] {
  --accent: 167, 139, 250;
}
.overview-chart-panel[data-accent="emerald"] {
  --accent: 52, 211, 153;
}
.overview-chart-panel[data-accent="amber"] {
  --accent: 251, 191, 36;
}
.overview-chart-panel[data-accent="rose"] {
  --accent: 244, 114, 182;
}
.overview-chart-panel[data-accent="cyan"] {
  --accent: 34, 211, 238;
}
.overview-chart-panel[data-accent="indigo"] {
  --accent: 129, 140, 248;
}

.overview-chart-panel__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(var(--accent), 0.95), rgba(var(--accent), 0.2));
  z-index: 1;
  border-radius: 14px 0 0 14px;
}

.overview-chart-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.overview-chart-panel__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

html[data-login-theme="dark"] .overview-chart-panel__title {
  color: #f1f5f9;
}

.overview-chart-panel__link {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(var(--accent));
  text-decoration: none;
  white-space: nowrap;
}

.overview-chart-panel__link:hover {
  text-decoration: underline;
}

.overview-chart-panel__hint {
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  line-height: 1.35;
}

.ov-chart-wrap {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
  min-height: 132px;
}

.ov-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
}

.overview-chart-panel--wide {
  grid-column: 1 / -1;
}

/* Visão Geral: card “Pedidos” com ícones + barras (layout da referência) */
.ov-pedidos {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.85rem 0.95rem;
}

.ov-pedidos__metrics {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.ov-pedidos__metric {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}

.ov-pedidos__ico {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(167, 139, 250, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ov-pedidos__ico svg {
  width: 16px;
  height: 16px;
  display: block;
}

.ov-pedidos__ico--pending {
  color: rgba(129, 140, 248, 0.95);
  background: rgba(129, 140, 248, 0.12);
  border-color: rgba(129, 140, 248, 0.22);
}

.ov-pedidos__ico--done {
  color: rgba(74, 222, 128, 0.95);
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.22);
}

.ov-pedidos__lines {
  display: grid;
  gap: 0.05rem;
}

.ov-pedidos__value {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: rgba(226, 232, 240, 0.98);
}

.ov-pedidos__label {
  font-size: 0.72rem;
}

.ov-pedidos__bars {
  display: grid;
  gap: 0.95rem;
  align-content: center;
}

.ov-pedidos__bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ov-pedidos__bar-fill {
  height: 100%;
  border-radius: 999px;
}

.ov-pedidos__bar-fill--pending {
  background: linear-gradient(90deg, rgba(129, 140, 248, 0.85), rgba(167, 139, 250, 0.85));
}

.ov-pedidos__bar-fill--done {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.75), rgba(34, 197, 94, 0.8));
}

.ov-pedidos__bar-note {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.95);
  white-space: nowrap;
  mix-blend-mode: normal;
}

@media (max-width: 820px) {
  .ov-pedidos {
    grid-template-columns: 1fr;
  }
  .ov-pedidos__bars {
    gap: 0.75rem;
  }
}

.overview-pane {
  --accent: 56, 189, 248;
  position: relative;
  padding: 1rem 1rem 0.9rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(var(--accent), 0.12), transparent 55%),
    linear-gradient(180deg, rgba(22, 26, 42, 0.82) 0%, rgba(14, 18, 30, 0.78) 100%);
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
}

.overview-pane[data-accent="sky"] {
  --accent: 56, 189, 248;
}
.overview-pane[data-accent="violet"] {
  --accent: 167, 139, 250;
}
.overview-pane[data-accent="emerald"] {
  --accent: 52, 211, 153;
}
.overview-pane[data-accent="amber"] {
  --accent: 251, 191, 36;
}
.overview-pane[data-accent="rose"] {
  --accent: 244, 114, 182;
}
.overview-pane[data-accent="cyan"] {
  --accent: 34, 211, 238;
}
.overview-pane[data-accent="indigo"] {
  --accent: 129, 140, 248;
}

.overview-pane__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(var(--accent), 0.95), rgba(var(--accent), 0.2));
  z-index: 1;
}

.overview-pane__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.overview-pane__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.overview-pane__link {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(var(--accent));
  text-decoration: none;
  white-space: nowrap;
}

.overview-pane__link:hover {
  text-decoration: underline;
}

.overview-pane__dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.overview-pane__dl > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  font-size: 0.82rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.overview-pane__dl > div:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.overview-pane__dl dt {
  margin: 0;
  color: rgba(148, 163, 184, 0.95);
  font-weight: 500;
}

.overview-pane__dl dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  color: #f1f5f9;
}

.ov-trend {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.95);
}

.ov-trend--up {
  color: #86efac;
}

.ov-trend--down {
  color: #fca5a5;
}

.overview-pane__ml {
  margin: 0.65rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(203, 213, 225, 0.92);
}

.overview-pane__ml-tag {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(var(--accent), 0.2);
  color: rgb(var(--accent));
  vertical-align: middle;
}

@media (max-width: 1200px) {
  .home-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-hero__right {
    grid-template-columns: 1fr;
  }
  .home-hero {
    padding: 1.1rem 1rem;
  }
  .m-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  html[data-login-theme="light"] body.page-portal .analytics-side {
    border-bottom-color: rgba(18, 40, 63, 0.1);
  }

  .analytics-layout {
    flex-direction: column;
    min-height: auto;
  }

  .analytics-side__header {
    width: 100%;
  }

  .analytics-side {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.75rem 0;
  }

  .analytics-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    flex: 1;
    width: 100%;
  }

  .analytics-nav__group {
    width: 100%;
  }

  .analytics-side__foot {
    width: 100%;
    border-top: none;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
  }

  .analytics-stage {
    padding-left: 0;
    padding-top: 1rem;
  }

  body.page-portal .analytics-stage {
    padding-left: 0;
    padding-right: 0.75rem;
  }

  .dash-kpi-row,
  .dash-kpi-row--3,
  .dash-kpi-row--5,
  .dash-kpi-row--6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid--2,
  .dash-split,
  .dash-split--60 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dash-kpi-row,
  .dash-kpi-row--3,
  .dash-kpi-row--5,
  .dash-kpi-row--6 {
    grid-template-columns: 1fr;
  }
}

/* Tema claro: módulos analíticos */
html[data-login-theme="light"] body.page-portal .analytics-side {
  background: #ffffff;
  border-right-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .analytics-nav__link {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .analytics-nav__link:hover {
  background: rgba(109, 40, 217, 0.08);
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .analytics-nav__link.is-active {
  background: linear-gradient(92deg, #ddd6fe 0%, #c4b5fd 45%, #a78bfa 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(109, 40, 217, 0.16);
}

html[data-login-theme="light"] body.page-portal .analytics-nav {
  scrollbar-color: rgba(109, 40, 217, 0.45) rgba(226, 232, 240, 0.92);
}

html[data-login-theme="light"] body.page-portal .analytics-nav::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.92);
  border-left-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .analytics-nav::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.55);
}

html[data-login-theme="light"] body.page-portal .analytics-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 40, 217, 0.5);
}

html[data-login-theme="light"] body.page-portal .analytics-nav__group-title {
  color: #4c1d95;
  opacity: 1;
}

html[data-login-theme="light"] body.page-portal .analytics-nav__group + .analytics-nav__group {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .analytics-nav__group:last-child::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(221, 214, 254, 0.75) 25%,
    rgba(109, 40, 217, 0.85) 55%,
    rgba(59, 130, 246, 0.55) 80%,
    rgba(255, 255, 255, 0) 100%
  );
}

html[data-login-theme="light"] body.page-portal .analytics-select {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-filter {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .analytics-filter > span {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .analytics-btn-ghost {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .analytics-page-title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-banner {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.22);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-tile {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .analytics-tile__desc {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-kpi,
html[data-login-theme="light"] body.page-portal .dash-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-card__title,
html[data-login-theme="light"] body.page-portal .dash-kpi__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-kpi__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-kpi__delta--up {
  color: #166534;
}

html[data-login-theme="light"] body.page-portal .dash-kpi__delta--down {
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .dash-kpi__meta {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-card__sub.muted,
html[data-login-theme="light"] body.page-portal .dash-ml-panel__foot.muted {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-card__badge {
  color: #5b21b6;
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(91, 33, 182, 0.32);
}

html[data-login-theme="light"] body.page-portal .dash-card__badge--forecast {
  color: #0369a1;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(2, 132, 199, 0.35);
}

html[data-login-theme="light"] body.page-portal .dash-ml-legend {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-ml-swatch--yoy {
  background: repeating-linear-gradient(
    45deg,
    rgba(190, 24, 93, 0.75),
    rgba(190, 24, 93, 0.75) 2px,
    transparent 2px,
    transparent 4px
  );
  border-color: #9d174d;
}

html[data-login-theme="light"] body.page-portal .dash-ml-swatch--band {
  background: rgba(190, 24, 93, 0.4);
  border-color: #9d174d;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart .dash-txt {
  fill: currentColor;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart .dash-txt--violet {
  color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart .dash-txt--rose {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart line[stroke*="148,163,184"] {
  stroke: rgba(51, 65, 85, 0.5) !important;
}

html[data-login-theme="light"] body.page-portal .dash-chart-placeholder {
  background: rgba(248, 250, 252, 0.95);
}

html[data-login-theme="light"] body.page-portal .dash-geomap {
  background: rgba(248, 250, 252, 0.95);
}

html[data-login-theme="light"] body.page-portal .dash-geomap__state {
  stroke: rgba(51, 65, 85, 0.42);
}

html[data-login-theme="light"] body.page-portal .dash-geomap__state:hover {
  stroke: rgba(15, 23, 42, 0.72);
  filter: brightness(0.97);
}

html[data-login-theme="light"] body.page-portal .dash-geomap__uf {
  fill: #12283f;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2px;
}

html[data-login-theme="light"] body.page-portal .dash-geomap__tile {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-geomap__tile .dash-geomap__uf {
  fill: currentColor;
  stroke: none;
}

html[data-login-theme="light"] body.page-portal .dash-geomap__legend {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-heat.mock-heat {
  background: rgba(226, 232, 240, 0.65);
}

html[data-login-theme="light"] body.page-portal .mock-heat {
  background: linear-gradient(
    145deg,
    rgba(37, 99, 235, 0.38) 0%,
    rgba(56, 189, 248, 0.28) 35%,
    rgba(109, 40, 217, 0.26) 70%,
    rgba(30, 64, 175, 0.38) 100%
  ) !important;
}

html[data-login-theme="light"] body.page-portal .dash-seg {
  background: #e2e8f0;
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] body.page-portal .dash-seg__btn {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-seg__btn:hover {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-seg__btn.is-active {
  background: #ffffff;
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .dash-rank-list li {
  background: rgba(248, 250, 252, 0.98);
  color: #12283f;
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-rank-list__n {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .dash-rank-list__v {
  color: #1e40af;
}

html[data-login-theme="light"] body.page-portal .dash-detail-panel__h {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-kpi__delta:not(.dash-kpi__delta--up):not(.dash-kpi__delta--down) {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-ml-metric__v--warn {
  color: #b45309;
}

html[data-login-theme="light"] body.page-portal .dash-table th {
  background: rgba(241, 245, 249, 0.95);
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-table td {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-side__header {
  border-bottom-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .analytics-sidebar-toggle {
  background: transparent;
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-sidebar-toggle:hover {
  background: rgba(109, 40, 217, 0.08);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .analytics-tile__pill {
  background: rgba(109, 40, 217, 0.12);
  color: #5b21b6;
  border-color: rgba(109, 40, 217, 0.28);
}

html[data-login-theme="light"] body.page-portal .dash-ml-panel {
  border-color: rgba(109, 40, 217, 0.22);
  background: linear-gradient(
    135deg,
    rgba(109, 40, 217, 0.06) 0%,
    rgba(59, 130, 246, 0.06) 100%
  );
}

html[data-login-theme="light"] body.page-portal .dash-ml-panel__eyebrow {
  color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .dash-ml-select {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-ml-metric__k {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-ml-metric__v {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-ml-metric__v--accent {
  color: #2563eb;
}

/* Home hero + módulos no tema claro */
html[data-login-theme="light"] body.page-portal .home-hero {
  background:
    radial-gradient(ellipse 60% 120% at 0% 0%, rgba(59, 130, 246, 0.12), transparent 65%),
    radial-gradient(ellipse 60% 120% at 100% 100%, rgba(109, 40, 217, 0.1), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.92));
  border-color: rgba(18, 40, 63, 0.1);
  box-shadow: 0 20px 50px rgba(38, 39, 86, 0.1);
}

html[data-login-theme="light"] body.page-portal .home-hero__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .home-hero__lead {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .home-hero__btn {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .home-hero__btn:hover {
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(109, 40, 217, 0.06);
}

html[data-login-theme="light"] body.page-portal .home-hero__btn--primary {
  background: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  border-color: transparent;
  color: #ffffff;
}

html[data-login-theme="light"] body.page-portal .home-hero__btn--primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
  color: #ffffff;
}

html[data-login-theme="light"] body.page-portal .home-hero__meta {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .home-hero__meta code {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

html[data-login-theme="light"] body.page-portal .home-hero__eyebrow {
  color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .home-kpi {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .home-kpi__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .home-kpi__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .home-kpi__chip--up {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

html[data-login-theme="light"] body.page-portal .home-kpi__chip--down {
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .home-kpi__chip:not(.home-kpi__chip--up):not(.home-kpi__chip--down) {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .ov-trend--up {
  color: #166534;
}

html[data-login-theme="light"] body.page-portal .ov-trend--down {
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .home-sec__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .m-card {
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(var(--accent), 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.92) 100%);
  border-color: rgba(18, 40, 63, 0.1);
  box-shadow: 0 6px 18px rgba(38, 39, 86, 0.08);
}

html[data-login-theme="light"] body.page-portal .m-card:hover {
  box-shadow: 0 18px 40px rgba(38, 39, 86, 0.12), 0 0 0 1px rgba(var(--accent), 0.2);
}

html[data-login-theme="light"] body.page-portal .m-card__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .m-card__desc {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .m-card__delta {
  background: rgba(18, 40, 63, 0.06);
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .m-card__delta--up {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .m-card__delta--down {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .m-card__foot {
  border-top-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .m-card__go {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .analytics-toolbar {
  border-bottom-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .home-hero__title-accent {
  background: linear-gradient(90deg, #2563eb 0%, #6d28d9 100%);
  color: transparent;
}

html[data-login-theme="light"] body.page-portal .analytics-fs-btn {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .analytics-fs-btn:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
}

html[data-login-theme="light"] body.page-portal .analytics-fs-btn.is-active {
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(109, 40, 217, 0.08);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-fab__btn {
  background: linear-gradient(145deg, #7c3aed 0%, #5b21b6 55%, #2563eb 100%);
  color: #ffffff;
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.14),
    0 10px 26px rgba(109, 40, 217, 0.28);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-fab__btn:hover {
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.16),
    0 14px 32px rgba(109, 40, 217, 0.34);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-fab__btn.is-open {
  box-shadow:
    0 2px 10px rgba(15, 23, 42, 0.12),
    0 8px 20px rgba(109, 40, 217, 0.22);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(18, 40, 63, 0.12);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel::before {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(18, 40, 63, 0.12);
  border-right-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__close {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__actions {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__action {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(18, 40, 63, 0.1);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__action:hover {
  border-color: rgba(2, 132, 199, 0.35);
  background: rgba(224, 242, 254, 0.85);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__action.is-active {
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(237, 233, 254, 0.95);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .analytics-filters-panel__close:hover {
  color: #12283f;
  background: rgba(18, 40, 63, 0.06);
}

html[data-login-theme="light"] body.page-portal .overview-dashboard--fullscreen {
  background: #f7fafc;
}

html[data-login-theme="light"] body.page-portal .overview-pane {
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(var(--accent), 0.1), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.94) 100%);
  border-color: rgba(18, 40, 63, 0.1);
  box-shadow: 0 4px 16px rgba(38, 39, 86, 0.08);
}

html[data-login-theme="light"] body.page-portal .overview-pane__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .overview-pane__dl dd {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .overview-pane__dl > div {
  border-bottom-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .overview-pane__ml {
  border-top-color: rgba(18, 40, 63, 0.08);
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .overview-charts-head__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .overview-charts-head__sub.muted,
html[data-login-theme="light"] body.page-portal .overview-chart-panel__hint.muted {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .overview-chart-panel {
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(var(--accent), 0.16), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.94) 100%);
  border-color: rgba(18, 40, 63, 0.14);
  box-shadow: 0 8px 22px rgba(38, 39, 86, 0.1);
}

html[data-login-theme="light"] body.page-portal .overview-chart-panel__title {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .overview-chart-panel__accent {
  background: linear-gradient(180deg, rgba(var(--accent), 1), rgba(var(--accent), 0.35));
}

html[data-login-theme="light"] body.page-portal .ov-chart-wrap {
  border-color: rgba(18, 40, 63, 0.1);
  background: rgba(248, 250, 252, 0.65);
}

/* SVGs da Visão Geral — textos via currentColor (fill definido no HTML) */
html[data-login-theme="light"] body.page-portal .ov-svg {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .ov-svg .ov-txt {
  fill: currentColor;
}

html[data-login-theme="light"] body.page-portal .ov-svg .ov-txt--value {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .ov-svg .ov-txt--violet {
  color: #6d28d9;
}

html[data-login-theme="light"] body.page-portal .ov-svg .ov-txt--rose {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .ov-svg line[stroke*="148,163,184"] {
  stroke: rgba(51, 65, 85, 0.5) !important;
}

html[data-login-theme="light"] body.page-portal .overview-chart-panel__link {
  color: #4c1d95 !important;
}

html[data-login-theme="light"] body.page-portal .overview-chart-panel__link:hover {
  color: #4c1d95 !important;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-chart-panel__hint.muted,
html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-charts-head__sub.muted {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__bar-note,
html[data-login-theme="light"] body.page-portal .ov-pedidos__bar-note.muted {
  color: #0f172a !important;
  font-weight: 600;
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__bar {
  background: rgba(18, 40, 63, 0.08);
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__ico--pending {
  color: #5b21b6;
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(91, 33, 182, 0.28);
}

html[data-login-theme="light"] body.page-portal .ov-pedidos__ico--done {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(21, 128, 61, 0.28);
}

html[data-login-theme="light"] body.page-portal .analytics-stage {
  background: #f7fafc;
}

html[data-login-theme="light"] body.page-portal .analytics-toolbar--overview .analytics-page-title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-toolbar--overview .analytics-page-lead {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero--compact {
  border: 1px solid rgba(18, 40, 63, 0.1);
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 8px 32px rgba(38, 39, 86, 0.07);
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__eyebrow {
  color: #5b21b6;
  letter-spacing: 0.11em;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__title-accent {
  background: linear-gradient(90deg, #1d4ed8 0%, #6d28d9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__meta {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__lead {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__lead strong {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-kpi {
  border: 1px solid rgba(18, 40, 63, 0.1);
  background: #f8fafc;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-kpi__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-kpi__chip--up {
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-kpi__chip--down {
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-kpi__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__btn {
  background: #f8fafc;
  border-color: rgba(18, 40, 63, 0.12);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__btn:hover {
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(109, 40, 217, 0.06);
  color: #4c1d95;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__btn--primary {
  background: linear-gradient(92deg, #6366f1 0%, #7c3aed 45%, #2563eb 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 32px rgba(109, 40, 217, 0.22);
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .home-hero__btn--primary:hover {
  background: linear-gradient(92deg, #818cf8 0%, #8b5cf6 45%, #3b82f6 100%);
  color: #ffffff;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-charts-head__link {
  border: 1px solid rgba(18, 40, 63, 0.14);
  background: #ffffff;
  color: #334155;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-charts-head__link:hover {
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(109, 40, 217, 0.06);
  color: #4c1d95;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-charts-head__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .ov-chart-wrap {
  border-color: rgba(18, 40, 63, 0.1);
  background: rgba(248, 250, 252, 0.85);
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-chart-panel {
  border: 1px solid rgba(18, 40, 63, 0.12);
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(var(--accent), 0.16), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.94) 100%);
  box-shadow: 0 8px 22px rgba(38, 39, 86, 0.1);
}

html[data-login-theme="light"] body.page-portal #view-visao-geral .overview-chart-panel__title {
  color: #12283f;
}

/* ----- Módulo Metas ----- */

.metas-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse 100% 85% at 100% 0%, rgba(129, 140, 248, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(22, 26, 42, 0.82) 0%, rgba(14, 18, 30, 0.78) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.metas-hero__eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(167, 139, 250, 0.95);
  margin-bottom: 0.35rem;
}

.metas-hero__title {
  margin: 0 0 0.3rem;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #f1f5f9;
  line-height: 1.25;
}

.metas-hero__lead {
  margin: 0;
  font-size: 0.85rem;
  max-width: 62ch;
}

.metas-hero__ml {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(167, 139, 250, 0.08);
  color: rgba(226, 232, 240, 0.92);
  font-size: 0.8rem;
  line-height: 1.45;
}

.metas-hero__ml-tag {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(167, 139, 250, 0.22);
  color: rgb(167, 139, 250);
  flex-shrink: 0;
}

.metas-form {
  padding: 1rem 1.15rem 1.1rem;
}

.metas-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem 1rem;
  margin-top: 0.6rem;
}

.metas-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0;
  border: 0;
}

.metas-field--dias {
  grid-column: span 2;
  min-width: 0;
}

@media (max-width: 640px) {
  .metas-field--dias {
    grid-column: auto;
  }
}

.metas-field__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.metas-field__hint {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.78);
  line-height: 1.35;
}

.metas-field__input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.metas-field__prefix {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.95);
  pointer-events: none;
}

.metas-field__input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.metas-field__input:focus-visible {
  outline: none;
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.metas-field__input--with-prefix {
  padding-left: 2rem;
}

select.metas-field__input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(148, 163, 184, 0.8) 50%),
    linear-gradient(135deg, rgba(148, 163, 184, 0.8) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
}

/* A lista de opções do <select> usa a cor do elemento; sem fundo sólido
   o texto claro fica ilegível. Fixamos fundo/cor por tema. */
select.metas-field__input option {
  background-color: #171b29;
  color: #f1f5f9;
}

html[data-login-theme="light"] body.page-portal select.metas-field__input option {
  background-color: #ffffff;
  color: #12283f;
}

/* Seletor de data nativo: ajusta ícone/picker ao tema do modal. */
input[type="date"].metas-field__input {
  color-scheme: dark;
}

html[data-login-theme="light"] body.page-portal input[type="date"].metas-field__input {
  color-scheme: light;
}

/* ===== Modal "Configurar meta" (abas geral / vendedor / produto) ===== */
.metas-config-modal {
  max-width: 720px;
}

.metas-config__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.metas-config__body {
  padding: 1rem 1.15rem 1.2rem;
}

.metas-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.22);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.metas-tab {
  border: none;
  background: transparent;
  color: rgba(203, 213, 225, 0.85);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  padding: 0.45rem 0.85rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.metas-tab:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.metas-tab.is-active {
  color: #ffffff;
  background: linear-gradient(145deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.metas-tabpanel[hidden] {
  display: none;
}

/* O form geral, agora dentro do modal, não precisa do padding de card. */
.metas-config__body .metas-form {
  padding: 0;
}

.metas-dist {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.metas-dist__controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metas-field--inline {
  max-width: 320px;
}

.metas-dist__table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metas-dist__input {
  width: 100%;
  max-width: 150px;
  margin-left: auto;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.85rem;
  text-align: right;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.metas-dist__input:focus-visible {
  outline: none;
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.metas-dist__input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.metas-dist__val {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.metas-dist__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.metas-dist__foot-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metas-dist__badge {
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.metas-dist__badge--ok {
  color: #34d399;
  background: rgba(52, 211, 153, 0.14);
}

.metas-dist__badge--warn {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
}

/* Metas específicas por setor / produto */
.metas-goals {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metas-goals__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 0.65rem 0.75rem;
  margin-top: 0.35rem;
}

.metas-goals__add {
  height: 2.35rem;
  white-space: nowrap;
}

.metas-goals__sep {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0.35rem 0 0.1rem;
}

.metas-goals__table th,
.metas-goals__table td {
  vertical-align: middle;
}

.metas-goals__del {
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.metas-goals__del:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.55);
}

html[data-login-theme="light"] body.page-portal .metas-goals__sep {
  border-top-color: rgba(18, 40, 63, 0.12);
}

/* Situação do prazo no card visível de metas específicas */
.metas-sit {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: rgba(203, 213, 225, 0.95);
}

.metas-sit--ok {
  background: rgba(52, 211, 153, 0.14);
  color: #34d399;
}

.metas-sit--soon {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
}

.metas-sit--late {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

.metas-dias {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.metas-dia {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(226, 232, 240, 0.88);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.metas-dia input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.metas-dia:has(input:checked) {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.55);
  color: #e0e7ff;
}

.metas-dia:hover {
  border-color: rgba(129, 140, 248, 0.35);
}

.metas-row-accent td {
  background: rgba(129, 140, 248, 0.08);
  font-weight: 600;
}

.metas-table-colabs td[contenteditable="true"] {
  outline: 1px dashed rgba(56, 189, 248, 0.5);
  outline-offset: -2px;
  cursor: text;
}

.metas-burn-svg,
.metas-daily-svg {
  min-height: 140px;
}

.metas-scenario-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.metas-scenario {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(140px, auto);
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
}

.metas-scenario__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.metas-scenario__tag--low {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.metas-scenario__tag--mid {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.metas-scenario__tag--high {
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.metas-scenario__wrap {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.metas-scenario__bar {
  display: block;
  height: 100%;
  width: clamp(0%, var(--w, 0%), 110%);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.9), rgba(167, 139, 250, 0.9));
  border-radius: inherit;
}

.metas-scenario__val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(226, 232, 240, 0.95);
  font-weight: 600;
}

@media (max-width: 1024px) {
  .metas-hero {
    grid-template-columns: 1fr;
  }
  .metas-scenario {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .metas-scenario__val {
    grid-column: 2 / -1;
    text-align: left;
  }
}

/* Tema claro */
html[data-login-theme="light"] body.page-portal .metas-hero {
  background:
    radial-gradient(ellipse 100% 85% at 100% 0%, rgba(109, 40, 217, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.94) 100%);
  border-color: rgba(18, 40, 63, 0.1);
  box-shadow: 0 4px 16px rgba(38, 39, 86, 0.08);
}

html[data-login-theme="light"] body.page-portal .metas-hero__title {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .metas-hero__ml {
  background: rgba(109, 40, 217, 0.07);
  border-color: rgba(109, 40, 217, 0.2);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .metas-hero__ml-tag {
  background: rgba(109, 40, 217, 0.15);
  color: #5b21b6;
}

html[data-login-theme="light"] body.page-portal .metas-field__input {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.15);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .metas-field__label {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .metas-field__hint {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .metas-field__prefix {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .metas-tabs {
  background: rgba(18, 40, 63, 0.05);
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .metas-tab {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .metas-tab:hover {
  color: #12283f;
  background: rgba(18, 40, 63, 0.06);
}

html[data-login-theme="light"] body.page-portal .metas-dist__input {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.15);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .metas-dist__foot {
  background: rgba(18, 40, 63, 0.04);
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] body.page-portal .metas-dia {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.15);
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .metas-dia:has(input:checked) {
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(109, 40, 217, 0.45);
  color: #4c1d95;
}

html[data-login-theme="light"] body.page-portal .metas-row-accent td {
  background: rgba(109, 40, 217, 0.08);
}

html[data-login-theme="light"] body.page-portal .metas-scenario__wrap {
  background: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .metas-scenario__val {
  color: #12283f;
}

/* ============================================================
   Modal de Mapeamento de dados (low-code, estilo SAP DataSphere)
   ============================================================ */

.analytics-fs-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mapping-overlay.modal-overlay {
  padding: clamp(0.65rem, 2.5vh, 2rem) clamp(0.45rem, 1.2vw, 1rem);
}

.mapping-overlay .mapping-modal {
  max-width: min(1720px, 98.5vw);
  width: min(98.5vw, 1720px);
  max-height: min(90vh, calc(100vh - 2.5rem));
  max-height: min(90dvh, calc(100svh - 2.5rem));
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Evita rolagem dupla (página + painéis): o cartão corta em max-height e só as colunas rolam */
  overflow-x: hidden;
  overflow-y: hidden;
}

.mapping-modal .modal__title {
  font-size: 1.38rem;
  line-height: 1.28;
}

.mapping-modal .modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.1rem 1.35rem;
  flex-shrink: 0;
}

.mapping-modal .modal__brand {
  height: 26px;
}

.mapping-modal .analytics-select {
  font-size: 0.92rem;
  padding: 0.48rem 0.65rem;
  min-width: 8.25rem;
}

.mapping-head__tools {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  justify-content: flex-end;
}

.mapping-conn-select {
  min-width: 260px;
}

.mapping-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.93rem;
  color: rgba(226, 232, 240, 0.85);
  white-space: nowrap;
}

.mapping-body {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(380px, 1.28fr);
  gap: 1.25rem;
  padding: 1rem 1.35rem 0;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

.mapping-side {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.88rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mapping-side--left {
  position: relative;
  z-index: 6;
  /* Uma rolagem no painel: colunas + “Tabelas no mapeamento” sempre alcançáveis */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.mapping-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.mapping-side__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mapping-side__head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.mapping-side__hint {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.mapping-side__sub {
  margin: 0.6rem 0 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mapping-add-table-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: rgba(186, 230, 253, 0.95);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.mapping-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.mapping-picker {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.mapping-picker__label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(226, 232, 240, 0.88);
}

.mapping-combobox {
  position: relative;
  width: 100%;
}

.mapping-combobox__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
  min-height: 2.45rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 0.42rem 0.65rem;
  font-size: 0.94rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mapping-combobox__trigger:hover:not(:disabled) {
  border-color: rgba(125, 95, 255, 0.45);
}

.mapping-combobox__trigger:focus-visible {
  outline: none;
  border-color: rgba(125, 95, 255, 0.65);
  box-shadow: 0 0 0 2px rgba(125, 95, 255, 0.25);
}

.mapping-combobox__trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mapping-combobox__trigger[aria-expanded="true"] {
  border-color: rgba(125, 95, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.2);
}

.mapping-combobox__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-combobox__caret {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(148, 163, 184, 0.95);
  transition: transform 0.18s ease;
}

.mapping-combobox__trigger[aria-expanded="true"] .mapping-combobox__caret {
  transform: rotate(180deg);
}

.mapping-combobox__dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  z-index: 40;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 18, 32, 0.98);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.mapping-combobox__options {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  max-height: min(280px, 42vh);
}

.mapping-combobox__option {
  padding: 0.48rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: rgba(226, 232, 240, 0.92);
  border-left: 3px solid transparent;
}

.mapping-combobox__option:hover,
.mapping-combobox__option:focus {
  background: rgba(125, 95, 255, 0.14);
  outline: none;
}

.mapping-combobox__option.is-selected {
  background: rgba(125, 95, 255, 0.18);
  border-left-color: rgba(186, 163, 255, 0.85);
}

.mapping-combobox__empty {
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  margin: 0;
}

@media (max-width: 720px) {
  .mapping-pickers {
    grid-template-columns: 1fr;
  }
}

.mapping-search {
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.mapping-search input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.mapping-empty {
  font-size: 0.92rem;
  line-height: 1.55;
}

.mapping-cols {
  flex: 0 0 auto;
  overflow: visible;
  padding-right: 0.25rem;
}

.mapping-cols-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mapping-col-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: grab;
  user-select: none;
  font-size: 0.95rem;
}

.mapping-col-card.is-dragging {
  opacity: 0.5;
}

.mapping-col-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.06);
}

.mapping-col-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.18);
  color: rgba(186, 230, 253, 0.95);
  font-size: 0.76rem;
  font-weight: 700;
}

.mapping-col-card__badge--date {
  background: rgba(34, 197, 94, 0.18);
  color: rgba(187, 247, 208, 0.98);
}

.mapping-col-card__badge--text {
  background: rgba(167, 139, 250, 0.18);
  color: rgba(221, 214, 254, 0.95);
}

.mapping-col-card__name {
  flex: 1;
}

.mapping-col-card__type {
  font-size: 0.8rem;
  color: var(--muted);
}

.mapping-tables-list {
  border-top: 1px dashed var(--border);
  padding-top: 0.45rem;
  margin-top: 0.55rem;
  flex-shrink: 0;
}

.mapping-tbl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mapping-tbl-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.92rem;
}

.mapping-tbl-row.is-primary {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.08);
}

.mapping-tbl-row__alias {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  font-size: 0.84rem;
}

.mapping-tbl-row__name {
  flex: 1;
  color: var(--muted);
}

.mapping-tbl-row__tools button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  margin-left: 0.2rem;
}

.mapping-tbl-row__tools button:hover {
  color: var(--text);
}

/* lado direito */

.mapping-side--right {
  background: rgba(0, 0, 0, 0.16);
  /* Uma única rolagem no painel inteiro (igual ao lado esquerdo). Sem isto,
     cada bloco interno (campos, valores do filtro, filtro temporal) reusa
     `.mapping-fields-list` com `flex:1 + overflow`, criando rolagens
     concorrentes que espremem a área de mapeamento. */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

/* Dentro do painel direito, os blocos NÃO devem rolar individualmente: eles
   crescem conforme o conteúdo e a rolagem fica no painel. */
.mapping-side--right .mapping-fields-list {
  flex: 0 0 auto;
  overflow: visible;
}

.mapping-side__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
}

.mapping-section-tabs {
  display: inline-flex;
  gap: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mapping-section-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.36rem 0.85rem;
  cursor: pointer;
  border-right: 1px solid var(--border);
}

.mapping-section-tab:last-child {
  border-right: none;
}

.mapping-section-tab.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: rgba(186, 230, 253, 0.95);
}

.mapping-filter-tabs {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.mapping-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.28rem 0.78rem;
  border-radius: 999px;
  cursor: pointer;
}

.mapping-tab.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: rgba(186, 230, 253, 0.95);
}

.mapping-fields-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.35rem;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.mapping-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.mapping-group__head {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.96rem;
  padding: 0.15rem 0.1rem 0.4rem;
}

.mapping-group__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mapping-field {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  padding: 0.5rem 0.6rem;
}

.mapping-field.is-mapped {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.mapping-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.mapping-field__label {
  font-size: 0.96rem;
  font-weight: 600;
}

.mapping-field__kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.06rem 0.48rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
}

.mapping-field__kind--measure {
  background: rgba(56, 189, 248, 0.18);
  color: rgba(186, 230, 253, 0.95);
}

.mapping-field__kind--dimension {
  background: rgba(167, 139, 250, 0.18);
  color: rgba(221, 214, 254, 0.95);
}

.mapping-field__kind--date {
  background: rgba(34, 197, 94, 0.18);
  color: rgba(187, 247, 208, 0.98);
}

.mapping-field__slot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 1.5px dashed rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  min-height: 40px;
  background: rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mapping-field__slot.is-over {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(56, 189, 248, 0.1);
}

.mapping-field.is-mapped .mapping-field__slot {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
}

.mapping-field__placeholder {
  color: var(--muted);
  font-size: 0.88rem;
}

.mapping-field__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-size: 0.9rem;
  font-family: ui-monospace, "JetBrains Mono", monospace;
}

.mapping-field__remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.mapping-field__remove:hover {
  color: var(--danger);
}

.mapping-field__agg {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.84rem;
  padding: 0.18rem 0.4rem;
}

.mapping-field__hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

/* ---- Filtros globais: chips multi-binding ---- */

.mapping-filter__slot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.4rem;
  padding: 0.4rem 0.5rem;
  border: 1.5px dashed rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  min-height: 44px;
  background: rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mapping-filter__slot.is-over {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(56, 189, 248, 0.1);
}

.mapping-filter.has-bindings .mapping-filter__slot {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.mapping-filter.has-bindings {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.mapping-filter__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.55rem 0.18rem 0.55rem;
  font-size: 0.86rem;
  font-family: ui-monospace, "JetBrains Mono", monospace;
}

.mapping-filter__chip.is-primary {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
}

.mapping-filter__chip-star {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}

.mapping-filter__chip.is-primary .mapping-filter__chip-star {
  color: rgba(186, 230, 253, 0.95);
}

.mapping-filter__chip-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.mapping-filter__chip-remove:hover {
  color: var(--danger);
}

.mapping-filter__hint-empty {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

.mapping-filter__kind {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.48rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
}

.mapping-filter__kind--date_range {
  background: rgba(34, 197, 94, 0.18);
  color: rgba(187, 247, 208, 0.98);
}

.mapping-filter__kind--multi_select,
.mapping-filter__kind--single_select {
  background: rgba(167, 139, 250, 0.18);
  color: rgba(221, 214, 254, 0.95);
}

.mapping-filter__kind--number_range {
  background: rgba(251, 191, 36, 0.18);
  color: rgba(254, 240, 138, 0.98);
}

.mapping-filter__scope {
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 0.4rem;
}

/* ---- "consumed_by": que KPIs/gráficos cada campo alimenta ---- */

.mapping-field__consumed {
  margin-top: 0.45rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 0.35rem;
}

.mapping-field__consumed > summary {
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  letter-spacing: 0.02em;
}

.mapping-field__consumed > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
}

.mapping-field__consumed[open] > summary::before {
  transform: rotate(90deg);
}

.mapping-field__consumed > summary::-webkit-details-marker {
  display: none;
}

.mapping-field__consumed ul {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.mapping-field__consumed li {
  font-size: 0.78rem;
  color: rgba(186, 230, 253, 0.85);
  background: rgba(56, 189, 248, 0.06);
  border-left: 2px solid rgba(56, 189, 248, 0.45);
  padding: 0.18rem 0.45rem;
  border-radius: 0 4px 4px 0;
}

/* Nota explicativa no topo da aba "Filtros globais" */

.mapping-filters-intro {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.7rem;
}

.mapping-filters-intro strong {
  color: rgba(186, 230, 253, 0.95);
  font-weight: 650;
}

.mapping-filters-intro code {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  padding: 0.04rem 0.32rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

.mapping-filters-intro em {
  color: rgba(221, 214, 254, 0.95);
  font-style: normal;
}

.mapping-foot {
  padding: 1rem 1.35rem 1.1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.mapping-foot__left {
  font-size: 0.95rem;
}

.mapping-foot .btn {
  font-size: 0.95rem;
  padding: 0.52rem 1rem;
}

.mapping-status--ok {
  color: rgba(134, 239, 172, 0.95);
}

.mapping-status--err {
  color: rgba(252, 165, 165, 0.95);
}

.home-kpi--real {
  position: relative;
}

.home-kpi--real::after {
  content: "DADOS REAIS";
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  color: rgba(187, 247, 208, 0.98);
}

@media (max-width: 860px) {
  .mapping-body {
    grid-template-columns: 1fr;
  }
}

/* ----- Modal de sincronização Source -> ClickHouse ----- */
#sync-modal-overlay.modal-overlay {
  padding: clamp(0.65rem, 2.5vh, 2rem) clamp(0.45rem, 1.2vw, 1rem);
}

.modal--wide {
  width: 100%;
  max-width: min(1720px, 98.5vw);
}

.modal--wide .modal__head {
  padding: 1.1rem 1.35rem;
}

.modal--wide .modal__title {
  font-size: 1.38rem;
  line-height: 1.28;
}

.modal--wide .modal__brand {
  height: 26px;
}

.modal--wide .modal__body {
  padding: 1.25rem 1.45rem 1.35rem;
}

.modal--wide .modal__intro {
  font-size: 1.05rem;
  line-height: 1.6;
}

.modal--wide .modal__intro code {
  font-size: 0.9em;
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(125, 95, 255, 0.12);
  border: 1px solid rgba(125, 95, 255, 0.25);
}

/*
 * Modal Airflow: uma única rolagem no cartão (evita barra dupla overlay+corpo e
 * conteúdo cortado por flex + margin-top:auto no rodapé).
 */
#sync-modal-overlay .modal.modal--wide {
  max-height: min(88vh, calc(100vh - 2.5rem));
  max-height: min(88dvh, calc(100svh - 2.5rem));
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

#sync-modal-overlay .modal--wide .modal__head {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--surface);
}

#sync-modal-overlay .modal--wide .modal__body {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding-bottom: 1.25rem;
}

#sync-modal-overlay .modal__intro,
#sync-modal-overlay .sync-toolbar {
  flex-shrink: 0;
}

#sync-modal-overlay .sync-tables-wrap {
  flex: 0 1 auto;
  min-height: 120px;
  max-height: min(44vh, 480px);
  max-height: min(44vh, 44dvh, 480px);
}

#sync-modal-overlay .sync-custom {
  flex-shrink: 0;
}

#sync-modal-overlay .sync-custom-layout {
  flex-shrink: 0;
}

#sync-modal-overlay #sync-result {
  flex-shrink: 0;
}

#sync-modal-overlay .modal__body > .modal__actions {
  flex-shrink: 0;
  margin-top: 1.15rem;
  margin-bottom: 0;
  padding-top: 1rem;
  padding-bottom: 0.25rem;
  border-top: 1px solid var(--border);
}

.sync-toolbar .field > label {
  font-size: 0.93rem;
}

#sync-modal-overlay #sync-summary {
  font-size: 0.95rem;
}

#sync-modal-overlay .modal__actions .btn {
  font-size: 0.95rem;
  padding: 0.52rem 1rem;
}

#sync-modal-overlay .sync-toolbar__right .btn {
  font-size: 0.95rem;
  padding: 0.52rem 1rem;
}

.sync-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.15rem;
  margin: 0.45rem 0 1.1rem;
  flex-wrap: wrap;
}

.sync-toolbar__right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem;
  gap: 0.15rem;
}

.seg--wrap {
  max-width: 100%;
  justify-content: flex-start;
  border-radius: 14px;
}

.seg__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 600;
  transition: background 0.18s, color 0.18s;
}

.seg__btn:hover {
  color: var(--text);
}

.seg__btn--active {
  background: rgba(125, 95, 255, 0.22);
  color: #fff;
}

.sync-tables-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  max-height: min(68vh, 820px);
  min-height: 220px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sync-loading {
  text-align: center;
  padding: 1.65rem 1rem;
  font-size: 1rem;
}

#sync-tables {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sync-tables__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.72rem 1.15rem;
  /* Fundo opaco: evita “vazar” o conteúdo ao rolar (sticky) */
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.sync-tables__head .check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sync-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  flex: 1;
  min-width: min(100%, 780px);
}

.sync-filters .sync-search {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.sync-filters__col-with-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sync-filters__col-with-btn .sync-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.sync-filter-selected-btn {
  flex: 0 0 auto;
  align-self: center;
  white-space: nowrap;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.88rem;
  border-radius: 10px;
}

.sync-filter-selected-btn--active {
  background: rgba(125, 95, 255, 0.22);
  color: #fff;
  border-color: rgba(125, 95, 255, 0.45);
}

.sync-filter-selected-btn--active:hover {
  background: rgba(125, 95, 255, 0.3);
  border-color: rgba(125, 95, 255, 0.55);
}

@media (max-width: 640px) {
  .sync-filters {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .sync-filters__col-with-btn {
    flex-wrap: wrap;
  }

  .sync-filter-selected-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.sync-search {
  box-sizing: border-box;
  align-self: center;
  min-height: 2.65rem;
  line-height: 1.35;
  flex: 1;
  min-width: min(280px, 100%);
  max-width: min(520px, 100%);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.55rem 0.82rem;
  font-size: 0.98rem;
}

.sync-search:focus {
  outline: none;
  border-color: rgba(125, 95, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(125, 95, 255, 0.15);
}

.sync-group {
  padding: 0.72rem 1.1rem 0.95rem;
  border-top: 1px solid var(--border);
}

.sync-group:first-of-type {
  border-top: 0;
}

.sync-group--filtered-empty {
  display: none;
}

.sync-group__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.98rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sync-group__head strong {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.sync-group__list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.sync-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.58rem 0.68rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.sync-row:hover {
  background: rgba(125, 95, 255, 0.09);
  border-color: rgba(125, 95, 255, 0.12);
}

.sync-row:focus-within {
  border-color: rgba(125, 95, 255, 0.35);
}

.sync-row--hidden {
  display: none;
}

.sync-row__cb {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.18rem;
  accent-color: #8b5cf6;
  cursor: pointer;
}

.sync-row__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sync-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.sync-row__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  word-break: break-word;
  line-height: 1.38;
}

.sync-row__badge {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.95);
  background: rgba(125, 95, 255, 0.18);
  border: 1px solid rgba(125, 95, 255, 0.28);
  padding: 0.22rem 0.48rem;
  border-radius: 6px;
}

.sync-row__preview {
  font-size: 0.88rem;
  line-height: 1.48;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-left: 0.05rem;
  opacity: 0.82;
}

@media (min-width: 720px) {
  .sync-group__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.42rem 1.1rem;
    align-items: start;
  }
}

@media (min-width: 1100px) {
  .sync-group__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1500px) {
  .sync-group__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  .sync-group__list {
    display: flex;
    flex-direction: column;
  }

  .modal--wide {
    max-width: 100%;
  }
}

/* Modo claro — modal sincronização (após estilos base) */
html[data-login-theme="light"] body.page-portal #sync-modal-overlay .modal--wide .modal__head {
  background: #ffffff;
}/* light override removido (somente layout): html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-tables-wrap,
html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-custom,
html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-created-queries */

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-loading {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-row__name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-row__preview {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .sync-search {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal #sync-modal-overlay .seg__btn--active {
  color: #3b0764;
}

/* ----- Consultas SQL personalizadas ----- */
.sync-custom-layout {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.5fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .sync-custom-layout {
    grid-template-columns: 1fr;
  }
}

.sync-custom {
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.95rem 1.1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.sync-created-queries {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.75rem 0.85rem 0.85rem;
}

.sync-created-queries__head strong {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sync-created-queries__list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(380px, 48vh);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.sync-created-queries__empty {
  margin: 0;
  font-size: 0.88rem;
}

.sync-created-queries .cq-list-item {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem 0.65rem;
  padding: 0.48rem 0.4rem;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
}

.sync-created-queries .cq-list-item:last-child {
  border-bottom: none;
}

.sync-created-queries .cq-list-item--active {
  background: rgba(125, 95, 255, 0.08);
  border-radius: 8px;
  border-bottom-color: transparent;
}

.sync-created-queries .cq-list-item__main {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.sync-created-queries .cq-list-item__name {
  flex: 0 1 auto;
  max-width: 42%;
  min-width: 4rem;
}

.sync-created-queries .cq-list-item__sql {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  word-break: normal;
}

.sync-created-queries .cq-list-item__actions {
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.sync-custom__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.sync-custom__intro {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 320px;
  min-width: 0;
}

.sync-custom__title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sync-custom__desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.sync-custom__desc code {
  font-size: 0.86em;
  padding: 0.05em 0.36em;
  border-radius: 6px;
  background: rgba(125, 95, 255, 0.12);
  border: 1px solid rgba(125, 95, 255, 0.25);
}

.sync-custom__head .btn {
  white-space: nowrap;
}

.sync-custom__editor {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.sync-custom__editor .cq-card__name-wrap {
  flex: 0 0 auto;
  width: min(100%, 20rem);
  max-width: 100%;
  min-width: 0;
  align-self: flex-start;
}

.sync-custom__editor .cq-card__sql-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sync-custom__editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.cq-card__sql--editor {
  min-height: 200px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.sync-custom__editor .cq-card__sql {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.cq-list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.48rem 0.52rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  min-width: 0;
}

.cq-list-item--active {
  border-color: rgba(125, 95, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(125, 95, 255, 0.18);
}

.cq-list-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.cq-list-item__name {
  font-weight: 600;
  font-size: 0.82rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cq-list-item__sql {
  font-size: 0.72rem;
  line-height: 1.4;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.cq-list-item__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.cq-list-item__btn {
  padding: 0.28rem 0.45rem;
  font-size: 0.74rem;
  white-space: nowrap;
}

.cq-list-item__btn--danger {
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: rgba(252, 165, 165, 0.95);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cq-list-item__btn--danger:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.55);
}

.sync-custom__empty {
  margin: 0;
  font-size: 0.9rem;
}

.sync-custom__empty[hidden] {
  display: none;
}

.cq-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.7rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cq-card__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cq-card__name-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 1 1 220px;
  min-width: 0;
}

.cq-card__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.cq-card__name {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  font-size: 0.96rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
}

.cq-card__name:focus {
  outline: none;
  border-color: rgba(125, 95, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(125, 95, 255, 0.15);
}

.cq-card__name.is-invalid {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.18);
}

.cq-card__remove {
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: rgba(252, 165, 165, 0.95);
  border-radius: 9px;
  padding: 0.42rem 0.8rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cq-card__remove:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.55);
}

.cq-card__sql-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.cq-card__sql {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
}

.cq-card__sql:focus {
  outline: none;
  border-color: rgba(125, 95, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(125, 95, 255, 0.15);
}

.cq-card__sql.is-invalid {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.18);
}

.cq-card__hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.cq-card__error {
  font-size: 0.82rem;
  color: rgba(248, 113, 113, 0.95);
}

.cq-card__error[hidden] {
  display: none;
}

/* ============================================================
   Views modal (ClickHouse)
   ============================================================ */
.views-modal {
  width: min(1400px, 98vw);
  max-width: 1400px;
  min-height: 0;
}

/* Corpo do modal em coluna: views-body encolhe e não estoura o max-height do mapping-modal */
.mapping-modal.views-modal .views-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.views-body {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr minmax(260px, 300px);
  gap: 0;
  min-height: 0;
  align-items: stretch;
}

.views-side {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Coluna esquerda: tabelas do ClickHouse */
.views-side--tables {
  border-right: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
  background: var(--modal-aside-bg, rgba(255, 255, 255, 0.02));
  overflow: hidden;
}

.views-side--tables .views-side__head {
  flex-shrink: 0;
}

.views-side--tables .views-side__head h3 {
  color: var(--accent, #78a8ff);
}

/* Coluna direita: views salvas */
.views-side--list {
  border-left: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
  background: var(--modal-aside-bg, rgba(255, 255, 255, 0.02));
  overflow: hidden;
}

.views-side--list .views-side__head {
  flex-shrink: 0;
}

.views-side__head h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
}

.views-list__add {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.views-list__add-btn {
  width: 100%;
  justify-content: center;
}

.views-side__hint {
  font-size: 0.78rem;
  margin: 0 0 12px;
}

.views-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  flex: 1;
}

.views-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s, border-color 0.15s;
}
.views-item.is-active {
  border-color: var(--accent, #5b9aff);
  background: rgba(91, 154, 255, 0.08);
}
.views-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.views-item__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.views-item__name {
  font-weight: 600;
  word-break: break-all;
}
.views-item__mode {
  font-size: 0.72rem;
  opacity: 0.7;
}
.views-item__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.views-side--editor {
  overflow: auto;
  padding-top: 6px;
}

.views-empty {
  padding: 0;
  min-height: 0;
}

.views-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.views-editor__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.views-mode-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.views-name-field code {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.views-mode-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  align-self: end;
}
.views-mode-btn {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.12s;
}
.views-mode-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}
.views-mode-btn.is-active {
  background: var(--accent, #5b9aff);
  color: var(--accent-fg, #0c1322);
  font-weight: 600;
}

.views-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Garante alternância SQL vs visual (display:flex não deve vencer [hidden]) */
.views-pane[hidden] {
  display: none !important;
}

.views-pane__label {
  font-weight: 600;
  font-size: 0.85rem;
}

.views-side--tables .views-sql-table-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.views-sql-table-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.views-sql-table-list li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: grab;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.2);
  word-break: break-all;
  user-select: none;
}

.views-sql-table-list li:hover {
  border-color: rgba(91, 154, 255, 0.35);
  background: rgba(91, 154, 255, 0.08);
}

.views-sql-table-list li:active {
  cursor: grabbing;
}

.views-sql-table-list li.is-view {
  opacity: 0.9;
  font-style: italic;
}

.views-tables-foot-hint {
  margin: 10px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  flex-shrink: 0;
}

.views-tables-foot-hint kbd {
  font-family: inherit;
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
}

.views-sql-editor-wrap {
  position: relative;
}

#views-sql {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  resize: vertical;
}
#views-sql:focus {
  outline: 2px solid var(--accent, #5b9aff);
  outline-offset: -2px;
}

.views-sql-ac {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 180px;
  overflow: auto;
  margin: 0 2px 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--modal-bg, #1a1f2e);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

.views-sql-ac[hidden] {
  display: none !important;
}

.views-sql-ac__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  cursor: pointer;
}

.views-sql-ac__item:last-child {
  border-bottom: 0;
}

.views-sql-ac__item:hover,
.views-sql-ac__item.is-active {
  background: rgba(91, 154, 255, 0.15);
}

.views-sql-ac__meta {
  float: right;
  font-size: 0.68rem;
  opacity: 0.55;
  font-family: system-ui, sans-serif;
}

@media (max-width: 960px) {
  .views-body {
    grid-template-columns: 1fr;
  }
  .views-side--tables {
    border-right: 0;
    border-bottom: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
  }
  .views-side--tables .views-sql-table-list {
    max-height: min(200px, 35vh);
  }
  .views-side--list {
    border-left: 0;
    border-top: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
  }
}

/* Builder */
.views-builder {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vb-block {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px 12px;
  background: rgba(255, 255, 255, 0.02);
}
.vb-block legend {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.vb-block--data legend { color: #78a8ff; }
.vb-block--joins legend { color: #6fc1ff; }
.vb-block--filters legend { color: #c08bff; }
.vb-block--summarize legend { color: #6cd58a; }
.vb-block--sort legend { color: #ffae66; }
.vb-block--limit legend { color: #ffae66; }

.vb-add-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: inherit;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.vb-add-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.vb-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}
.vb-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  min-width: 200px;
  flex: 1;
}
.vb-row input,
.vb-row select {
  padding: 6px 10px;
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(120, 168, 255, 0.42);
  background: rgba(18, 26, 44, 0.92);
  color: #eef4fc;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

.vb-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vb-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(12, 18, 32, 0.55);
  border: 1px solid rgba(120, 168, 255, 0.18);
}
.vb-item input,
.vb-item select {
  padding: 6px 8px;
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(120, 168, 255, 0.42);
  background: rgba(18, 26, 44, 0.95);
  color: #eef4fc;
  font-size: 0.85rem;
  min-width: 88px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

.vb-item select:focus,
.vb-item input:focus,
.vb-row select:focus,
.vb-row input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.22),
    inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Dropdowns / analytics-select dentro do modal Views — mesmo peso visual */
.views-modal .analytics-select,
.views-builder .analytics-select,
.views-modal select:not(.views-mode-btn) {
  border: 1px solid rgba(120, 168, 255, 0.42);
  background: rgba(18, 26, 44, 0.95);
  color: #eef4fc;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

.views-modal .analytics-select:focus,
.views-builder .analytics-select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.22),
    inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

#views-name {
  border: 1px solid rgba(120, 168, 255, 0.42);
  background: rgba(18, 26, 44, 0.95);
  color: #eef4fc;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
#views-name:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.22),
    inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

#vb-limit {
  border: 1px solid rgba(120, 168, 255, 0.42);
  background: rgba(18, 26, 44, 0.95);
  color: #eef4fc;
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 180px;
}

.views-modal option,
.views-builder option {
  background: #141c2e;
  color: #eef4fc;
}
.vb-empty {
  padding: 4px 6px;
  font-size: 0.78rem;
}
.vb-on,
.vb-as {
  font-size: 0.75rem;
  text-transform: lowercase;
  opacity: 0.7;
}
.vb-mini {
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}
.vb-del {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  margin-left: auto;
  opacity: 0.6;
}
.vb-del:hover {
  opacity: 1;
}

.vb-sub {
  margin-top: 8px;
}
.vb-sub__title {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.8;
  margin-right: 8px;
}

.vb-generated {
  margin-top: 4px;
}
.vb-generated__pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin: 6px 0 0;
  max-height: 220px;
  overflow: auto;
}

/* Preview */
.views-preview {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}
.views-preview__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.views-preview__table-wrap {
  overflow: auto;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.views-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.views-preview-table th,
.views-preview-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}
.views-preview-table th {
  background: rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
}

@media (max-width: 980px) {
  .views-body {
    grid-template-columns: 1fr;
  }
  .views-side--list {
    border-right: 0;
    border-bottom: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
  }
}

/* ============================================================
 * Modal de diagrama do banco (relacionamentos por chave estrangeira)
 * ============================================================ */
#diagram-modal-overlay.modal-overlay {
  padding: clamp(0.65rem, 2.5vh, 2rem) clamp(0.45rem, 1.2vw, 1rem);
}

#diagram-modal-overlay .modal.modal--wide {
  max-height: min(92vh, calc(100vh - 1.6rem));
  max-height: min(92dvh, calc(100svh - 1.6rem));
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#diagram-modal-overlay .modal--wide .modal__head {
  flex-shrink: 0;
}

.modal__body--diagram {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.1rem 1.35rem 1.1rem;
  overflow: hidden;
}

.modal__body--diagram .modal__intro {
  flex-shrink: 0;
  margin-bottom: 0.85rem;
}

.diagram-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

.diagram-toolbar__left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}

.diagram-toolbar__right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.diagram-search {
  min-width: 240px;
  max-width: 360px;
  flex: 1 1 240px;
}

.diagram-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.diagram-stats {
  font-size: 0.88rem;
}

.diagram-zoom-btn {
  min-width: 2.5rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.diagram-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 25% 25%, rgba(125, 95, 255, 0.08), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 23px,
      rgba(255, 255, 255, 0.035) 23px,
      rgba(255, 255, 255, 0.035) 24px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 23px,
      rgba(255, 255, 255, 0.035) 23px,
      rgba(255, 255, 255, 0.035) 24px
    ),
    rgba(0, 0, 0, 0.25);
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.diagram-stage--panning {
  cursor: grabbing;
}

.diagram-loading,
.diagram-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  font-size: 1rem;
}

.diagram-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.diagram-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  color: rgba(180, 160, 255, 0.85);
  overflow: visible;
}

.diagram-svg .diag-edge {
  stroke: rgba(180, 160, 255, 0.55);
  stroke-width: 1.6;
  fill: none;
  pointer-events: stroke;
  transition: stroke 0.18s, stroke-width 0.18s, opacity 0.18s;
}

.diagram-svg .diag-edge--active {
  stroke: #c8b4ff;
  stroke-width: 2.4;
}

.diagram-svg .diag-edge--dim {
  opacity: 0.18;
}

.diagram-nodes {
  position: relative;
  width: 100%;
  height: 100%;
}

.diag-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(125, 95, 255, 0.45);
  border-radius: 10px;
  background: rgba(20, 14, 40, 0.92);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  font-size: 0.82rem;
  overflow: hidden;
}

.diag-node--dragging {
  z-index: 5;
  box-shadow: 0 10px 26px rgba(125, 95, 255, 0.35);
}

.diag-node__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  background: linear-gradient(180deg, rgba(125, 95, 255, 0.32), rgba(125, 95, 255, 0.18));
  border-bottom: 1px solid rgba(125, 95, 255, 0.45);
  cursor: grab;
}

.diag-node__head:active {
  cursor: grabbing;
}

.diag-node__schema {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  flex-shrink: 0;
}

.diag-node__name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f4eeff;
}

.diag-node__count {
  font-size: 0.72rem;
  flex-shrink: 0;
}

.diag-node__body {
  display: flex;
  flex-direction: column;
}

.diag-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  min-height: 26px;
  font-size: 0.8rem;
  cursor: default;
}

.diag-row:last-child {
  border-bottom: 0;
}

.diag-row:hover {
  background: rgba(125, 95, 255, 0.12);
}

.diag-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.diag-row__icon--pk {
  background: linear-gradient(180deg, #e6c34a, #c79a1a);
  color: #2a1f00;
}

.diag-row__icon--fk {
  background: rgba(125, 95, 255, 0.55);
  color: #fff;
}

.diag-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ece5ff;
}

.diag-row__name--pk {
  font-weight: 600;
}

.diag-row__type {
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  flex-shrink: 0;
  text-align: right;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .diagram-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .diagram-toolbar__left,
  .diagram-toolbar__right {
    justify-content: flex-start;
  }
  .diagram-search {
    min-width: 0;
    max-width: 100%;
  }
}

/* ----- Overlay global de carregamento (API / fetch) ----- */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.app-loading-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.app-loading-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 28, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-login-theme="light"] .app-loading-overlay__backdrop {
  background: rgba(232, 236, 245, 0.72);
}

html[data-login-theme="light"] .app-loading-overlay__img {
  filter: none;
}

.app-loading-overlay__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app-loading-overlay__img {
  display: block;
  max-width: min(200px, 42vw);
  height: auto;
}

/* ========================================================================== */
/* Customizador do dashboard (admin)                                          */
/* ========================================================================== */

.analytics-nav__link {
  position: relative;
}

.module-eye-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.7);
  color: rgba(226, 232, 240, 0.95);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 3;
}

.module-eye-btn svg {
  display: block;
}

.analytics-layout--collapsed .module-eye-btn {
  display: none;
}

.module-eye-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.module-eye-btn--off {
  background: rgba(244, 114, 182, 0.2);
  border-color: rgba(244, 114, 182, 0.6);
  color: #fbcfe8;
}

.analytics-nav__link--customizer-hidden {
  opacity: 0.55;
  text-decoration: line-through;
}

.analytics-nav__link--customizer-hidden.is-active {
  opacity: 0.85;
}

/* Quando admin: mantém visível (com line-through no link); só atenua a sub-lista. */
.analytics-nav__item--customizer-hidden .analytics-nav__sublist {
  opacity: 0.55;
}

/* Sub-link oculto pelo customizer (admin vê line-through; o JS aplica
   `hidden` para usuários comuns). */
.analytics-nav__sublink--customizer-hidden {
  opacity: 0.55;
  text-decoration: line-through;
}

.analytics-nav__sublink--customizer-hidden.is-active {
  opacity: 0.85;
}

/* Botão olho compacto dentro do sub-link (apenas admin). */
.sub-eye-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.7);
  color: rgba(226, 232, 240, 0.92);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  backdrop-filter: blur(4px);
}

.sub-eye-btn svg {
  display: block;
  width: 12px;
  height: 12px;
}

.sub-eye-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.sub-eye-btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.65);
  outline-offset: 2px;
}

.sub-eye-btn--off {
  background: rgba(244, 114, 182, 0.2);
  border-color: rgba(244, 114, 182, 0.55);
  color: #fbcfe8;
}

.analytics-layout--collapsed .sub-eye-btn {
  display: none;
}

html[data-login-theme="light"] .sub-eye-btn {
  background: rgba(255, 255, 255, 0.96);
  color: #1e293b;
  border-color: rgba(18, 40, 63, 0.24);
}

html[data-login-theme="light"] .sub-eye-btn:hover {
  background: rgba(56, 189, 248, 0.16);
  color: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.45);
}

html[data-login-theme="light"] .sub-eye-btn--off {
  background: rgba(244, 114, 182, 0.22);
  border-color: rgba(190, 24, 93, 0.45);
  color: rgba(157, 23, 77, 0.92);
}

.analytics-view--customizer-hidden {
  /* Para usuários comuns o JS aplica `hidden`; para o admin deixamos visível
     com leve atenuação para indicar que o módulo está oculto para o tenant. */
  filter: grayscale(0.25);
}

.card-has-customizer {
  position: relative;
}

.dash-kpi.card-has-customizer,
.dash-card.card-has-customizer,
.dash-ml-panel.card-has-customizer,
.overview-chart-panel.card-has-customizer {
  position: relative;
}

/* Reserva espaço à direita do conteúdo para não esconder textos/badges
   atrás dos botões fixos do customizador (que ficam top-right do card). */
.dash-card.card-has-customizer .dash-card__head,
.dash-ml-panel.card-has-customizer .dash-ml-panel__head {
  padding-right: 4rem;
}

.dash-kpi.card-has-customizer .dash-kpi__label {
  padding-right: 3.75rem;
}

/* Card marcado como oculto pelo admin:
   - NÃO aplicamos opacity no elemento raiz para não esmaecer os botões filhos
     (opacity em CSS cria stacking context e afeta TODOS os descendentes).
   - Atenuamos apenas o conteúdo, preservando os controles do customizador. */
.card-customizer-hidden {
  outline: 2px dashed rgba(244, 114, 182, 0.6);
  outline-offset: 4px;
  background: rgba(244, 114, 182, 0.05);
}

.card-customizer-hidden > *:not(.card-customizer) {
  opacity: 0.45;
  filter: grayscale(0.35);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.card-customizer-hidden::before {
  content: "Oculto p/ usuários";
  position: absolute;
  top: -0.55rem;
  left: 0.55rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fbcfe8;
  background: rgba(244, 114, 182, 0.22);
  border: 1px solid rgba(244, 114, 182, 0.6);
  border-radius: 999px;
  padding: 2px 8px;
  pointer-events: none;
  z-index: 4;
  backdrop-filter: blur(4px);
}

.card-customizer {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 5;
}

.card-customizer__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.82);
  color: rgba(226, 232, 240, 0.95);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
  backdrop-filter: blur(4px);
}

.card-customizer__btn:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.45);
}

.card-customizer__btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.65);
  outline-offset: 2px;
}

.card-customizer__eye--off {
  background: rgba(244, 114, 182, 0.18);
  border-color: rgba(244, 114, 182, 0.55);
  color: #fbcfe8;
}

.dashboard-customizer-toggle {
  display: flex !important;
}

.dashboard-customizer-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.dashboard-customizer-active [data-card-id] {
  outline: 1px dashed rgba(167, 139, 250, 0.18);
  outline-offset: 2px;
}

html[data-login-theme="light"] .module-eye-btn,
html[data-login-theme="light"] .card-customizer__btn {
  background: rgba(255, 255, 255, 0.98);
  color: #1e293b;
  border-color: rgba(18, 40, 63, 0.24);
}

html[data-login-theme="light"] .module-eye-btn:hover,
html[data-login-theme="light"] .card-customizer__btn:hover {
  background: rgba(56, 189, 248, 0.16);
  color: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.45);
}

html[data-login-theme="light"] .module-eye-btn--off,
html[data-login-theme="light"] .card-customizer__eye--off {
  background: rgba(244, 114, 182, 0.22);
  border-color: rgba(190, 24, 93, 0.45);
  color: rgba(157, 23, 77, 0.92);
}

/* ----------------------------------------------------------------------
   Botão "engrenagem" no customizador de cards (Configurar gráfico)
   ---------------------------------------------------------------------- */
.card-customizer__gear {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.45);
  color: rgba(199, 210, 254, 0.95);
}

.card-customizer__gear:hover {
  background: rgba(99, 102, 241, 0.32);
  border-color: rgba(99, 102, 241, 0.85);
  color: #fff;
}

html[data-login-theme="light"] .card-customizer__gear {
  background: rgba(99, 102, 241, 0.18);
  color: rgba(55, 48, 163, 0.95);
  border-color: rgba(99, 102, 241, 0.55);
}

/* ----------------------------------------------------------------------
   Estado "não configurado" / "erro" — aplicado a qualquer card com data-card-id
   quando o backend responde is_configured: false ou error.
   ---------------------------------------------------------------------- */
[data-card-id] {
  position: relative;
}

[data-card-id].card-needs-config,
[data-card-id].card-error {
  outline: 2px dashed rgba(252, 211, 77, 0.55);
  outline-offset: 4px;
  background: rgba(252, 211, 77, 0.05);
}

[data-card-id].card-error {
  outline-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.07);
}

[data-card-id].card-needs-config > *:not(.card-customizer):not(.card-needs-config__notice),
[data-card-id].card-error > *:not(.card-customizer):not(.card-needs-config__notice) {
  opacity: 0.32;
  filter: grayscale(0.5);
  transition: opacity 0.15s ease, filter 0.15s ease;
  pointer-events: none;
}

.card-needs-config__notice {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  text-align: center;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
}

.card-needs-config__notice strong {
  font-size: 0.95rem;
  color: #fde68a;
}

[data-card-id].card-error .card-needs-config__notice strong {
  color: #fecaca;
}

.card-needs-config__notice span,
.card-needs-config__detail {
  font-size: 0.82rem;
  color: rgba(241, 245, 249, 0.92);
  max-width: 38ch;
}

.card-needs-config__detail {
  display: block;
  max-width: min(56ch, 100%);
  max-height: min(42vh, 280px);
  overflow: auto;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.card-needs-config__notice em {
  font-style: normal;
  font-size: 0.74rem;
  color: rgba(226, 232, 240, 0.7);
}

/* Modo escuro: cards não configurados — paleta escura com texto legível (como no claro) */
html[data-login-theme="dark"] [data-card-id].card-needs-config {
  background: rgba(20, 22, 43, 0.94);
  border-color: rgba(252, 211, 77, 0.22);
  outline-color: rgba(252, 211, 77, 0.5);
}

html[data-login-theme="dark"] [data-card-id].card-needs-config > *:not(.card-customizer):not(.card-needs-config__notice) {
  opacity: 1;
  filter: none;
}

html[data-login-theme="dark"] [data-card-id].card-needs-config .dash-kpi__label {
  color: rgba(160, 174, 192, 0.96);
}

html[data-login-theme="dark"] [data-card-id].card-needs-config .dash-kpi__value {
  color: rgba(186, 230, 253, 0.98);
}

html[data-login-theme="dark"] [data-card-id].card-needs-config .dash-card__title {
  color: #e8eef7;
}

html[data-login-theme="dark"] [data-card-id].card-needs-config .dash-card__sub.muted,
html[data-login-theme="dark"] [data-card-id].card-needs-config .dash-kpi__meta {
  color: rgba(148, 163, 184, 0.95);
}

html[data-login-theme="dark"] [data-card-id].card-needs-config .card-customizer__btn {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.9);
  color: rgba(226, 232, 240, 0.98);
}

/* Modo escuro: cards ocultos p/ usuários — indicador rosa, conteúdo legível */
html[data-login-theme="dark"] [data-card-id].card-customizer-hidden {
  background: rgba(22, 18, 32, 0.94);
  border-color: rgba(244, 114, 182, 0.22);
  outline-color: rgba(244, 114, 182, 0.55);
}

html[data-login-theme="dark"] [data-card-id].card-customizer-hidden > *:not(.card-customizer) {
  opacity: 1;
  filter: none;
}

html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-kpi__label {
  color: rgba(160, 174, 192, 0.96);
}

html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-kpi__value {
  color: rgba(186, 230, 253, 0.98);
}

html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-card__title {
  color: #e8eef7;
}

html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-card__sub.muted,
html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-kpi__meta,
html[data-login-theme="dark"] [data-card-id].card-customizer-hidden .dash-kpi__delta:not(.dash-kpi__delta--up):not(.dash-kpi__delta--down) {
  color: rgba(148, 163, 184, 0.95);
}

html[data-login-theme="dark"] body.page-portal .dash-ml-panel__eyebrow {
  color: #e9d5ff;
}

html[data-login-theme="light"] [data-card-id].card-needs-config {
  background: rgba(254, 243, 199, 0.55);
  outline-color: rgba(180, 83, 9, 0.65);
}

html[data-login-theme="light"] [data-card-id].card-error {
  background: rgba(254, 226, 226, 0.55);
  outline-color: rgba(185, 28, 28, 0.65);
}

/* Modo claro: cards não configurados / erro — conteúdo legível (sem atenuação) */
html[data-login-theme="light"] [data-card-id].card-needs-config > *:not(.card-customizer):not(.card-needs-config__notice),
html[data-login-theme="light"] [data-card-id].card-error > *:not(.card-customizer):not(.card-needs-config__notice) {
  opacity: 1;
  filter: none;
}

html[data-login-theme="light"] [data-card-id].card-needs-config .dash-kpi__label,
html[data-login-theme="light"] [data-card-id].card-needs-config .dash-kpi__value,
html[data-login-theme="light"] [data-card-id].card-error .dash-kpi__label,
html[data-login-theme="light"] [data-card-id].card-error .dash-kpi__value {
  color: #12283f;
}

html[data-login-theme="light"] [data-card-id].card-needs-config .dash-kpi__delta--up,
html[data-login-theme="light"] [data-card-id].card-error .dash-kpi__delta--up {
  color: #166534;
}

html[data-login-theme="light"] [data-card-id].card-needs-config .dash-kpi__delta--down,
html[data-login-theme="light"] [data-card-id].card-error .dash-kpi__delta--down {
  color: #991b1b;
}

html[data-login-theme="light"] [data-card-id].card-needs-config .dash-kpi__meta,
html[data-login-theme="light"] [data-card-id].card-error .dash-kpi__meta {
  color: #334155;
}

html[data-login-theme="light"] .card-needs-config__notice strong {
  color: rgba(146, 64, 14, 0.95);
}

html[data-login-theme="light"] [data-card-id].card-error .card-needs-config__notice strong {
  color: #991b1b;
}

html[data-login-theme="light"] .card-needs-config__notice span,
html[data-login-theme="light"] .card-needs-config__detail {
  color: #334155;
}

html[data-login-theme="light"] [data-card-id].card-error .card-needs-config__detail {
  color: #1e293b;
}

html[data-login-theme="light"] .card-needs-config__notice em {
  color: rgba(71, 85, 105, 0.85);
}

/* ----------------------------------------------------------------------
   Modal: Configuração de gráfico (chart-config-modal)
   ---------------------------------------------------------------------- */
.chart-config-modal__subtitle {
  margin-left: 0.5rem;
  font-size: 0.85rem;
}

.chart-config-querytype-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.18);
  color: rgba(199, 210, 254, 0.95);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.5rem;
}

.chart-config-required-tag,
.chart-config-optional-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.5rem;
}

.chart-config-required-tag {
  background: rgba(244, 114, 182, 0.18);
  border: 1px solid rgba(244, 114, 182, 0.55);
  color: #fbcfe8;
}

.chart-config-optional-tag {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: rgba(226, 232, 240, 0.85);
}

.chart-config-temporal {
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.chart-config-temporal__head h4 {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  color: rgba(226, 232, 240, 0.95);
}

.chart-config-temporal__head p {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
}

/* ----- Seletores de valores (baldes de situação) ----- */
.chart-config-selectors {
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.chart-config-selectors__head h4 {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  color: rgba(226, 232, 240, 0.95);
}

.chart-config-selectors__head p {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
}

.chart-config-selector {
  margin-bottom: 0.6rem;
}

.chart-config-selector__count {
  font-size: 0.74rem;
  margin-left: auto;
}

.chart-config-selector__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  margin-top: 0.35rem;
  max-height: 168px;
  overflow-y: auto;
  padding: 0.1rem 0.1rem 0.25rem;
}

.chart-config-selector__opt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  background: rgba(148, 163, 184, 0.08);
}

.chart-config-selector__opt:hover {
  border-color: rgba(99, 102, 241, 0.55);
}

.chart-config-selector__opt input {
  margin: 0;
  cursor: pointer;
}

html[data-login-theme="light"] .chart-config-selectors__head h4 {
  color: rgba(15, 23, 42, 0.9);
}

html[data-login-theme="light"] .chart-config-querytype-badge {
  background: rgba(99, 102, 241, 0.18);
  color: rgba(55, 48, 163, 0.95);
  border-color: rgba(99, 102, 241, 0.55);
}

html[data-login-theme="light"] .chart-config-required-tag {
  background: rgba(190, 24, 93, 0.18);
  color: rgba(157, 23, 77, 0.95);
  border-color: rgba(190, 24, 93, 0.55);
}

html[data-login-theme="light"] .chart-config-optional-tag {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(30, 41, 59, 0.85);
  border-color: rgba(100, 116, 139, 0.45);
}

html[data-login-theme="light"] .chart-config-temporal__head h4 {
  color: rgba(15, 23, 42, 0.9);
}

/* =====================================================================
   MODO CLARO — portal analytics (prioridade final, paleta escura legível)
   ===================================================================== */
html[data-login-theme="light"] body.page-portal .analytics-stage,
html[data-login-theme="light"] body.page-portal .analytics-views {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .muted,
html[data-login-theme="light"] body.page-portal .analytics-views .muted {
  color: #334155 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-card__title,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kpi__label,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kpi__value,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-detail-panel__h,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-ml-metric__v,
html[data-login-theme="light"] body.page-portal .analytics-stage .overview-chart-panel__title,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kanban__col h3 {
  color: #12283f !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-card__link,
html[data-login-theme="light"] body.page-portal .analytics-stage .overview-chart-panel__link {
  color: #4c1d95 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-rank-list li,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-exp-list li,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-hbar-list li {
  color: #12283f !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-rank-list__v {
  color: #1e40af !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-exp-list__n,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-ml-metric__k {
  color: #334155 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-pill--up,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-badge-ok,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kpi__delta--up {
  color: #166534 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-pill--down,
html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kpi__delta--down {
  color: #991b1b !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-badge-warn {
  color: #92400e !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kanban__card {
  color: #334155 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-kanban__count {
  color: #1d4ed8 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-table th {
  color: #475569 !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage .dash-table td {
  color: #12283f !important;
}

/* SVG sem classe no dashboard */
html[data-login-theme="light"] body.page-portal .analytics-stage svg.ov-svg text,
html[data-login-theme="light"] body.page-portal .analytics-stage svg.dash-svg-chart text {
  fill: currentColor !important;
}

html[data-login-theme="light"] body.page-portal .analytics-stage svg:not(.ov-svg):not(.dash-svg-chart) text {
  fill: #334155 !important;
}

/* =====================================================================
   MODO CLARO — espelhamento final: gráficos, modais e componentes
   restantes que ainda permaneciam com a paleta escura.
   ===================================================================== */

/* ---------- SVGs em geral (charts inline em dashboard.html) ---------- */
/* Os fundos `rgba(255,255,255,0.02)` ficam invisíveis sobre superfície branca;
   trocamos para um cinza-claro suave que dá moldura ao gráfico. */
html[data-login-theme="light"] body.page-portal svg.ov-svg rect[fill^="rgba(255"],
html[data-login-theme="light"] body.page-portal svg.dash-svg-chart rect[fill^="rgba(255"] {
  fill: rgba(241, 245, 249, 0.7) !important;
}

/* Sparklines do hero (sem classe; ficam dentro de .home-kpi__spark) */
html[data-login-theme="light"] body.page-portal .home-kpi__spark path[stroke*="56,189,248"],
html[data-login-theme="light"] body.page-portal .home-kpi__spark path[stroke*="129,140,248"] {
  stroke: #0284c7 !important;
}

html[data-login-theme="light"] body.page-portal .home-kpi__spark path[stroke*="244,114,182"] {
  stroke: #be185d !important;
}

html[data-login-theme="light"] body.page-portal .home-kpi__spark path[stroke*="251,191,36"] {
  stroke: #b45309 !important;
}

html[data-login-theme="light"] body.page-portal .home-kpi__spark path[stroke*="167,139,250"] {
  stroke: #6d28d9 !important;
}

/* Strokes claros (cyan/violet) usados nos SVGs de detalhe -> reforço de contraste */
html[data-login-theme="light"] body.page-portal svg.dash-svg-chart path[stroke*="34,211,238"] {
  stroke: #0e7490 !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart path[stroke*="167,139,250"],
html[data-login-theme="light"] body.page-portal svg.ov-svg path[stroke*="167,139,250"] {
  stroke: #6d28d9 !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart path[stroke*="52,211,153"],
html[data-login-theme="light"] body.page-portal svg.ov-svg path[stroke*="52,211,153"] {
  stroke: #047857 !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart path[stroke*="248,113,113"],
html[data-login-theme="light"] body.page-portal svg.ov-svg path[stroke*="248,113,113"] {
  stroke: #b91c1c !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart line[stroke*="167,139,250"],
html[data-login-theme="light"] body.page-portal svg.ov-svg line[stroke*="167,139,250"] {
  stroke: #6d28d9 !important;
}

/* Linhas tracejadas slate (148,163,184) em ambos os charts */
html[data-login-theme="light"] body.page-portal svg.dash-svg-chart line[stroke*="148,163,184"],
html[data-login-theme="light"] body.page-portal svg.ov-svg line[stroke*="148,163,184"] {
  stroke: rgba(51, 65, 85, 0.5) !important;
}

/* Textos inline com fill hardcoded em SVG (Metas etc.) */
html[data-login-theme="light"] body.page-portal svg.dash-svg-chart text[fill*="148,163,184"],
html[data-login-theme="light"] body.page-portal svg.ov-svg text[fill*="148,163,184"] {
  fill: #334155 !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart text[fill*="167,139,250"] {
  fill: #6d28d9 !important;
}

html[data-login-theme="light"] body.page-portal svg.dash-svg-chart text[fill*="52,211,153"] {
  fill: #047857 !important;
}

/* Heatmap dia × hora */
html[data-login-theme="light"] body.page-portal .dash-heat-grid {
  background: rgba(226, 232, 240, 0.7);
}

html[data-login-theme="light"] body.page-portal .dash-heat-haxis {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-heat-vaxis {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-heat-legend {
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .dash-heat-legend__min,
html[data-login-theme="light"] body.page-portal .dash-heat-legend__max {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-heat-cell:hover {
  outline-color: rgba(15, 23, 42, 0.5);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__heat {
  background: rgba(241, 245, 249, 0.9);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__heat-h,
html[data-login-theme="light"] body.page-portal .dash-rfm__heat-v,
html[data-login-theme="light"] body.page-portal .dash-rfm__heat-kicker,
html[data-login-theme="light"] body.page-portal .dash-rfm__seg-kicker {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__heat-cell {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__heat-cell:hover {
  outline-color: rgba(15, 23, 42, 0.35);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg-name {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg-meta,
html[data-login-theme="light"] body.page-portal .dash-rfm__seg-pct,
html[data-login-theme="light"] body.page-portal .dash-rfm__total {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .dash-rfm__seg-val {
  color: #12283f;
}

/* Tooltip de gráficos no tema claro. */
html[data-login-theme="light"] body.page-portal .dash-chart-tooltip {
  background: rgba(255, 255, 255, 0.98);
  color: #12283f;
  border-color: rgba(109, 40, 217, 0.35);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

html[data-login-theme="light"] body.page-portal .dash-chart-tooltip::after {
  border-right-color: rgba(109, 40, 217, 0.35);
  border-bottom-color: rgba(109, 40, 217, 0.35);
}

html[data-login-theme="light"] body.page-portal .dash-chart-tooltip__label {
  color: #64748b;
}

/* ---------- Dashboard: tabela, hbars, kanban, rank ---------- */
html[data-login-theme="light"] body.page-portal .dash-table-wrap {
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-table th,
html[data-login-theme="light"] body.page-portal .dash-table td {
  border-bottom-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] body.page-portal .dash-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.06);
}

html[data-login-theme="light"] body.page-portal .dash-rank-list li {
  background: rgba(248, 250, 252, 0.96);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-rank-list__n {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .dash-rank-list__v {
  color: #1e40af;
}

html[data-login-theme="light"] body.page-portal .dash-kanban__col {
  background: rgba(248, 250, 252, 0.85);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .dash-kanban__col h3 {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-kanban__count {
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .dash-kanban__card {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.1);
  color: #12283f;
}

/* Barras horizontais (mantém gradiente azul/violeta — já tem bom contraste em light) */
html[data-login-theme="light"] body.page-portal .dash-hbar,
html[data-login-theme="light"] body.page-portal .dash-hbar--inline {
  background: linear-gradient(90deg, #0284c7, #6d28d9);
}

html[data-login-theme="light"] body.page-portal .dash-bar-cell {
  background: linear-gradient(90deg, #0284c7, #6d28d9);
}

html[data-login-theme="light"] body.page-portal .dash-bar-cell--green {
  background: linear-gradient(90deg, #047857, #0284c7);
}

html[data-login-theme="light"] body.page-portal .dash-chart-placeholder {
  background: rgba(241, 245, 249, 0.7);
}

/* Spark animado do hero (não-SVG) */
html[data-login-theme="light"] body.page-portal .dash-spark {
  background: linear-gradient(
    90deg,
    rgba(2, 132, 199, 0.18),
    rgba(109, 40, 217, 0.32),
    rgba(2, 132, 199, 0.14)
  );
}

/* ---------- Cards reais marcados (.dash-kpi--is-real) ---------- */
html[data-login-theme="light"] body.page-portal .dash-kpi--is-real .dash-kpi__value {
  color: #0c4a6e;
}

/* ---------- Customizador (módulo eye btn) ---------- */
html[data-login-theme="light"] body.page-portal .module-eye-btn {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(18, 40, 63, 0.24);
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .module-eye-btn:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .module-eye-btn--off {
  background: rgba(190, 24, 93, 0.12);
  border-color: rgba(190, 24, 93, 0.45);
  color: #9d174d;
}

html[data-login-theme="light"] body.page-portal .card-customizer-hidden {
  outline-color: rgba(190, 24, 93, 0.55);
  background: rgba(190, 24, 93, 0.05);
}

html[data-login-theme="light"] body.page-portal .card-customizer-hidden::before {
  color: #9d174d;
  background: rgba(190, 24, 93, 0.12);
  border-color: rgba(190, 24, 93, 0.45);
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden > *:not(.card-customizer) {
  opacity: 1;
  filter: none;
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-kpi__label {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-kpi__value {
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-kpi__delta--up {
  color: #166534;
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-kpi__delta--down {
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-kpi__meta,
html[data-login-theme="light"] body.page-portal [data-card-id].card-customizer-hidden .dash-card__sub.muted {
  color: #334155;
}

/* ---------- Modal: diagram (esquema visual de tabelas) ---------- */
html[data-login-theme="light"] body.page-portal .diagram-stage,
html[data-login-theme="light"] .diagram-stage {
  border-color: rgba(18, 40, 63, 0.14);
  background:
    radial-gradient(circle at 25% 25%, rgba(109, 40, 217, 0.06), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 23px,
      rgba(18, 40, 63, 0.06) 23px,
      rgba(18, 40, 63, 0.06) 24px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 23px,
      rgba(18, 40, 63, 0.06) 23px,
      rgba(18, 40, 63, 0.06) 24px
    ),
    rgba(248, 250, 252, 0.85);
}

html[data-login-theme="light"] .diagram-svg {
  color: rgba(109, 40, 217, 0.85);
}

html[data-login-theme="light"] .diagram-svg .diag-edge {
  stroke: rgba(109, 40, 217, 0.55);
}

html[data-login-theme="light"] .diagram-svg .diag-edge--active {
  stroke: #6d28d9;
}

html[data-login-theme="light"] .diag-node {
  background: #ffffff;
  border-color: rgba(109, 40, 217, 0.45);
  box-shadow: 0 6px 18px rgba(38, 39, 86, 0.16);
}

html[data-login-theme="light"] .diag-node__head {
  background: linear-gradient(
    180deg,
    rgba(109, 40, 217, 0.18),
    rgba(109, 40, 217, 0.08)
  );
  border-bottom-color: rgba(109, 40, 217, 0.35);
  color: #3b0764;
}

html[data-login-theme="light"] .diag-node__name {
  color: #1e1b4b;
}

html[data-login-theme="light"] .diag-node__schema,
html[data-login-theme="light"] .diag-node__count {
  color: #475569;
}

html[data-login-theme="light"] .diag-row {
  border-bottom-color: rgba(18, 40, 63, 0.08);
}

html[data-login-theme="light"] .diag-row:hover {
  background: rgba(109, 40, 217, 0.08);
}

html[data-login-theme="light"] .diag-row__icon {
  background: rgba(18, 40, 63, 0.08);
  color: #475569;
}

html[data-login-theme="light"] .diag-row__icon--fk {
  background: rgba(109, 40, 217, 0.6);
  color: #ffffff;
}

html[data-login-theme="light"] .diag-row__name {
  color: #12283f;
}

html[data-login-theme="light"] .diag-row__type {
  color: #475569;
}

/* ---------- Modal: views (SQL/visual) ---------- */
html[data-login-theme="light"] body.page-portal .views-side--tables,
html[data-login-theme="light"] body.page-portal .views-side--list,
html[data-login-theme="light"] .views-side--tables,
html[data-login-theme="light"] .views-side--list {
  background: rgba(248, 250, 252, 0.85);
  border-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] .views-side--tables .views-side__head h3 {
  color: #1d4ed8;
}

html[data-login-theme="light"] .views-item {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(18, 40, 63, 0.08);
  color: #12283f;
}

html[data-login-theme="light"] .views-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

html[data-login-theme="light"] .views-item.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: #2563eb;
}

html[data-login-theme="light"] .views-item__mode {
  color: #475569;
}

html[data-login-theme="light"] .views-sql-table-list li {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(18, 40, 63, 0.08);
  color: #12283f;
}

html[data-login-theme="light"] .views-sql-table-list li:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.45);
}

html[data-login-theme="light"] .views-mode-toggle {
  border-color: rgba(18, 40, 63, 0.14);
}

html[data-login-theme="light"] .views-mode-btn {
  color: #334155;
}

html[data-login-theme="light"] .views-mode-btn:hover {
  background: rgba(37, 99, 235, 0.06);
}

html[data-login-theme="light"] .views-mode-btn.is-active {
  background: #2563eb;
  color: #ffffff;
}

html[data-login-theme="light"] .views-name-field code {
  background: rgba(18, 40, 63, 0.08);
  color: #1e293b;
}

html[data-login-theme="light"] .views-tables-foot-hint kbd {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(18, 40, 63, 0.18);
  color: #334155;
}

html[data-login-theme="light"] #views-sql {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.16);
  color: #0f172a;
}

html[data-login-theme="light"] .views-sql-ac {
  background: #ffffff;
  border-color: rgba(18, 40, 63, 0.14);
  box-shadow: 0 -8px 24px rgba(38, 39, 86, 0.14);
  color: #0f172a;
}

html[data-login-theme="light"] .views-sql-ac__item {
  border-bottom-color: rgba(18, 40, 63, 0.06);
  color: #12283f;
}

html[data-login-theme="light"] .views-sql-ac__item:hover,
html[data-login-theme="light"] .views-sql-ac__item.is-active {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

html[data-login-theme="light"] .views-sql-ac__meta {
  color: #475569;
}

html[data-login-theme="light"] .views-preview {
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] .views-preview__table-wrap {
  border-color: rgba(18, 40, 63, 0.12);
}

html[data-login-theme="light"] .views-preview-table th {
  background: rgba(241, 245, 249, 0.98);
  color: #475569;
}

html[data-login-theme="light"] .views-preview-table th,
html[data-login-theme="light"] .views-preview-table td {
  border-bottom-color: rgba(18, 40, 63, 0.08);
  color: #12283f;
}

/* ---------- Variáveis de gráfico para JS/elemento dinâmico ---------- */
/* Texto base dentro de SVGs do dashboard ganha a cor de texto do tema. */
html[data-login-theme="light"] body.page-portal svg.dash-svg-chart,
html[data-login-theme="light"] body.page-portal svg.ov-svg {
  color: #334155;
}

/* Cores de série (azul -> rosa) padrão usadas pelos charts dinâmicos do JS */
html[data-login-theme="light"] body.page-portal .dash-svg-chart rect[fill*="56,189,248"] {
  fill: #0284c7 !important;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart path[stroke*="244,114,182"],
html[data-login-theme="light"] body.page-portal .ov-svg path[stroke*="244,114,182"] {
  stroke: #be185d !important;
}

html[data-login-theme="light"] body.page-portal .dash-svg-chart path[stroke*="56,189,248"],
html[data-login-theme="light"] body.page-portal .ov-svg path[stroke*="56,189,248"] {
  stroke: #0284c7 !important;
}

/* =====================================================================
   MODO CLARO — reforço de contraste (acessibilidade, paleta preservada)
   ===================================================================== */

/* Séries claras nos mini-gráficos da Visão Geral */
html[data-login-theme="light"] body.page-portal svg.ov-svg path[stroke*="34,211,238"] {
  stroke: #0e7490 !important;
}

html[data-login-theme="light"] body.page-portal svg.ov-svg path[stroke*="251,191,36"] {
  stroke: #b45309 !important;
}

/* Valores numéricos nos gráficos horizontais */
html[data-login-theme="light"] body.page-portal .ov-svg .ov-txt--value {
  color: #0f172a;
}

/* Legendas dos gráficos dinâmicos */
html[data-login-theme="light"] body.page-portal .dash-svg-legend-text {
  fill: #334155;
}

/* Eixos do heatmap */
html[data-login-theme="light"] body.page-portal .dash-heat-haxis {
  color: #334155;
}

html[data-login-theme="light"] body.page-portal .dash-heat-legend {
  color: #334155;
}

/* KPI — ícones do customizador (reforço final de contraste) */
html[data-login-theme="light"] body.page-portal .card-customizer__btn svg {
  opacity: 1;
}

/* Sidebar — sub-itens e caret */
html[data-login-theme="light"] body.page-portal .analytics-nav__sublink {
  color: #1e293b;
}

html[data-login-theme="light"] body.page-portal .analytics-nav__sub-bullet {
  color: #64748b;
  opacity: 1;
}

html[data-login-theme="light"] body.page-portal .analytics-nav__caret {
  opacity: 0.85;
  color: #475569;
}
