/* 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);
  font-family: inherit;
  line-height: 1.2;
}

.topbar__search.is-open {
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.14);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.topbar__search-results {
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(100% + 1px);
  z-index: 80;
  max-height: min(420px, 70vh);
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 12px 12px;
  background: rgba(15, 18, 30, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.topbar__search-group {
  padding: 0.35rem 0.45rem 0.2rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
}

.topbar__search-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.topbar__search-item:hover,
.topbar__search-item.is-active {
  background: rgba(129, 140, 248, 0.16);
}

.topbar__search-item__title {
  font-size: 0.86rem;
  font-weight: 650;
  color: #f1f5f9;
}

.topbar__search-item__meta {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.topbar__search-empty {
  padding: 0.75rem 0.65rem;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.95);
}

@media (max-width: 720px) {
  .topbar__search-kbd {
    display: none;
  }
}

.portal-search-flash {
  animation: portal-search-flash 1.3s ease;
}

@keyframes portal-search-flash {
  0%,
  100% {
    box-shadow: none;
  }
  25%,
  70% {
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.7);
  }
}

.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);
}

/* display:inline-flex vence o [hidden] do UA — igual bug do suporte */
.actas-pill[hidden] {
  display: none !important;
}

.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--cache {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(56, 189, 248, 0.4);
}

.actas-pill__btn--cache:hover {
  background: rgba(14, 165, 233, 0.38);
  border-color: rgba(56, 189, 248, 0.55);
}

.actas-pill__btn--cache:disabled {
  opacity: 0.65;
  cursor: wait;
}

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

@media (max-width: 900px) {
  .actas-pill:not([hidden]) {
    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.2rem 0.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.user-menu__trigger:hover {
  border-color: transparent;
  opacity: 0.92;
}

.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,
.user-dropdown__item:focus,
.user-dropdown__item:focus-visible,
a.user-dropdown__item:hover,
a.user-dropdown__item:focus,
a.user-dropdown__item:visited {
  text-decoration: none !important;
}

.user-dropdown__item:hover .user-dropdown__title,
.user-dropdown__item:hover .user-dropdown__desc,
.user-dropdown__item:focus .user-dropdown__title,
.user-dropdown__item:focus .user-dropdown__desc {
  text-decoration: none !important;
}

body.page-portal .user-dropdown a.user-dropdown__item,
body.page-portal .user-dropdown a.user-dropdown__item:hover,
body.page-portal .user-dropdown a.user-dropdown__item:focus {
  color: inherit;
  text-decoration: none !important;
}

.user-dropdown__item:hover,
.user-dropdown__item.is-active {
  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 .actas-pill__btn--cache {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(2, 132, 199, 0.35);
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .actas-pill__btn--cache:hover {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(2, 132, 199, 0.5);
  color: #075985;
}

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__search.is-open {
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

html[data-login-theme="light"] body.page-portal .topbar__search-results {
  background: #ffffff;
  border-color: rgba(79, 70, 229, 0.28);
  border-top-color: rgba(18, 40, 63, 0.1);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

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

html[data-login-theme="light"] body.page-portal .topbar__search-item__meta,
html[data-login-theme="light"] body.page-portal .topbar__search-empty,
html[data-login-theme="light"] body.page-portal .topbar__search-group {
  color: #64748b;
}

html[data-login-theme="light"] body.page-portal .topbar__search-item:hover,
html[data-login-theme="light"] body.page-portal .topbar__search-item.is-active {
  background: rgba(99, 102, 241, 0.1);
}

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: transparent;
  border-color: transparent;
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .user-menu__trigger:hover {
  border-color: transparent;
  opacity: 0.92;
}

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,
html[data-login-theme="light"] body.page-portal .user-dropdown__item.is-active {
  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;
  color-scheme: light;
}

html[data-login-theme="light"] body.page-portal .field select option {
  background-color: #ffffff;
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .field select option:checked,
html[data-login-theme="light"] body.page-portal .field select option:hover {
  background-color: #dbeafe;
  color: #0f172a;
}

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 select {
  background-color: #0f172a;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.32);
  color-scheme: dark;
}

.field select option {
  background-color: #0f172a;
  color: #e2e8f0;
}

.field select option:checked,
.field select option:hover {
  background-color: #1d4ed8;
  color: #f8fafc;
}

.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.75rem;
}

.space-head__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

.space-head__intro {
  min-width: 0;
}

.space-head__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.space-head__notify {
  gap: 0.45rem;
  text-decoration: none;
}

.space-head__notify:hover,
.space-head__notify:focus,
.space-head__notify:visited {
  text-decoration: none;
}

.space-head__notify svg {
  flex-shrink: 0;
}

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

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

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

.space-count {
  flex-shrink: 0;
  padding-left: 0.6rem;
  margin-left: 0.2rem;
  border-left: 1px solid var(--border);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.space-count:empty {
  display: none;
}

.space-search {
  flex: 0 1 520px;
  width: 100%;
  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: 520px;
}

.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: 1rem;
  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: 800px) {
  .space-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .space-search {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .space-grid {
    grid-template-columns: 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;
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
  max-height: calc(100vh - var(--topbar-h));
  /* 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-fab-toggle[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);
}

/* Esconde a seção de ações se nenhum botão estiver visível (ex.: tela cheia oculta). */
.analytics-filters-panel__actions:not(:has(.analytics-filters-panel__action:not([hidden]))) {
  display: none;
}

.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;
}

.topbar-icon-btn[hidden],
#overview-mapping-btn[hidden],
#overview-clear-filters-btn[hidden] {
  display: none !important;
}

/* Controles de card (olho/lápis/tipo/engrenagem) só para admin */
body:not(.is-admin) .card-customizer {
  display: none !important;
}
body:not(.is-admin) #overview-mapping-btn,
body:not(.is-admin) #overview-clear-filters-btn {
  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(148, 163, 184, 0.32);
  background-color: #0f172a;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.82rem;
  color-scheme: dark;
}

.analytics-select option {
  background-color: #0f172a;
  color: #e2e8f0;
}

.analytics-select option:checked,
.analytics-select option:hover {
  background-color: #1d4ed8;
  color: #f8fafc;
}

.analytics-select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.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--series {
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 1rem;
}

.dash-ml-panel--forecast {
  padding: 0.9rem 1rem 1.05rem;
  margin-bottom: 1rem;
}

.dash-ml-panel--forecast .dash-ml-panel__head {
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.dash-ml-panel__titles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.dash-ml-panel--forecast .dash-ml-panel__hint {
  margin: 0;
  max-width: 42rem;
}

.dash-ml-forecast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, 210px);
  gap: 0.85rem;
  align-items: stretch;
}

.dash-ml-forecast__chart {
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  padding: 0.35rem 0.45rem 0.15rem;
  overflow: hidden;
}

.dash-ml-forecast__svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 11.5rem;
}

.dash-ml-forecast__side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.dash-ml-side-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 18, 30, 0.55);
  flex: 1 1 auto;
}

.dash-ml-side-kpi--hero {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.08));
}

.dash-ml-side-kpi__k {
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.dash-ml-side-kpi__v {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.dash-ml-side-kpi--hero .dash-ml-side-kpi__v {
  font-size: 1.25rem;
  color: #7dd3fc;
}

.dash-ml-side-kpi__v--signal {
  color: #4ade80;
}

.dash-ml-side-kpi__hint {
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.88);
  line-height: 1.35;
}

.dash-ml-rmse {
  height: 6px;
  margin: 0.25rem 0 0.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.dash-ml-rmse__fill {
  display: block;
  height: 100%;
  width: var(--w, 30%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.95), rgba(56, 189, 248, 0.75));
}

@media (max-width: 860px) {
  .dash-ml-forecast {
    grid-template-columns: 1fr;
  }

  .dash-ml-forecast__side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .dash-ml-forecast__side {
    grid-template-columns: 1fr;
  }
}

/* ---- Painel ML interativo (.dash-ml2) --------------------------------- */
.dash-ml-tag {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  white-space: nowrap;
}

.dash-ml2 {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ml2 {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ml2__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dash-card__head--ml {
  justify-content: flex-start;
  gap: 0.75rem 1rem;
  align-items: center;
}

.dash-card__title-with-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
  z-index: 4;
}

.dash-card__head--ml .dash-card__title {
  flex: 0 0 auto;
}

.dash-card__head--ml .ml2__tabs--inline {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
}

.dash-card__head--ml .ml2__info {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
}

.dash-card.card-has-customizer .dash-card__head--ml {
  padding-right: 5.5rem;
}

.ml2__tabs--inline {
  padding: 0.2rem;
}

.ml2__tabs--inline .ml2__tab {
  padding: 0.32rem 0.65rem;
  font-size: 0.74rem;
}

.ml2__tabs {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.ml2__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.ml2__tab:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.ml2__tab.is-active {
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.22), rgba(99, 102, 241, 0.16));
  color: #f1f5f9;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.ml2__tab-ic {
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.9;
}

.ml2__info {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.16s ease;
}

.ml2__info:hover,
.ml2__info.is-active {
  background: rgba(167, 139, 250, 0.28);
  color: #fff;
}

.ml2__help-pop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 40;
  width: min(22.5rem, calc(100vw - 2.5rem));
  padding: 0.85rem 0.95rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.38);
  background: linear-gradient(165deg, rgba(28, 24, 48, 0.98), rgba(16, 18, 32, 0.98));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color: rgba(226, 232, 240, 0.95);
  font-size: 0.8rem;
  line-height: 1.45;
}

.ml2__help-pop[hidden] {
  display: none !important;
}

.ml2__help-pop::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 1.55rem;
  width: 11px;
  height: 11px;
  border-left: 1px solid rgba(167, 139, 250, 0.38);
  border-top: 1px solid rgba(167, 139, 250, 0.38);
  background: rgba(28, 24, 48, 0.98);
  transform: rotate(45deg);
}

.ml2__help-pop__title {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e9e5ff;
}

.ml2__help-pop__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.ml2__help-pop__list li {
  margin: 0;
  padding-left: 0.7rem;
  position: relative;
  color: rgba(203, 213, 225, 0.95);
}

.ml2__help-pop__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(167, 139, 250, 0.85);
}

.ml2__help-pop__list strong {
  color: #f1f5f9;
  font-weight: 650;
}

/* legado — mantido caso algum tema ainda referencie */
.ml2__source {
  display: none;
}

.ml2__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(172px, 214px);
  gap: 0.85rem;
  align-items: stretch;
}

.ml2__chartwrap {
  position: relative;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  padding: 0.4rem 0.5rem 0.5rem;
}

.ml2__svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 0;
}

.ml2-dot {
  cursor: pointer;
  transition: r 0.12s ease, opacity 0.12s ease;
}

.ml2-dot:hover {
  opacity: 0.85;
}

.ml2-dot--pulse {
  animation: ml2-dot-pulse 0.6s ease;
}

@keyframes ml2-dot-pulse {
  50% { transform: scale(1.6); transform-box: fill-box; transform-origin: center; }
}

.ml2__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.35rem 0.25rem 0.1rem;
}

.ml2-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: rgba(203, 213, 225, 0.9);
}

.ml2-lg__line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.ml2-lg__line--dash {
  background-image: none !important;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 7px);
  mask-image: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 7px);
}

.ml2-lg__rect {
  width: 14px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.ml2-lg__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.ml2__caption {
  margin: 0.15rem 0.15rem 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(148, 163, 184, 0.95);
}

.ml2__caption strong {
  color: #e2e8f0;
}

.ml2__caption em {
  color: #c4b5fd;
  font-style: normal;
  font-weight: 600;
}

.ml2__tip {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: rgba(9, 12, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 6;
  white-space: nowrap;
}

.ml2__tip.is-visible {
  opacity: 1;
}

.ml2__tip-l {
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.95);
  font-weight: 600;
}

.ml2__tip-v {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
}

.ml2__tip-x {
  font-size: 0.68rem;
  color: rgba(196, 181, 253, 0.95);
}

.ml2__tip-x:empty {
  display: none;
}

.ml2__side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.ml2-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 18, 30, 0.55);
  flex: 1 1 auto;
}

.ml2-kpi--hero {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.08));
}

.ml2-kpi__k {
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.ml2-kpi__v {
  font-size: 1.02rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.ml2-kpi--hero .ml2-kpi__v {
  font-size: 1.2rem;
  color: #7dd3fc;
}

.ml2-kpi__v--up {
  color: #4ade80;
}

.ml2-kpi__v--down {
  color: #f87171;
}

.ml2-kpi__hint {
  font-size: 0.66rem;
  color: rgba(148, 163, 184, 0.88);
  line-height: 1.35;
}

.ml2__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.9);
}

.ml2__foot-model strong {
  color: #e2e8f0;
}

.ml2__chip {
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #7dd3fc;
  font-weight: 600;
  font-size: 0.68rem;
}

.ml2__foot-note {
  flex: 1 1 12rem;
  min-width: 0;
  color: rgba(148, 163, 184, 0.75);
  font-style: italic;
}

@media (max-width: 860px) {
  .ml2__body {
    grid-template-columns: 1fr;
  }
  .ml2__side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

/* Tema claro */
:root[data-theme="light"] .ml2__tabs {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.1);
}

:root[data-theme="light"] .ml2__tab {
  color: rgba(71, 85, 105, 0.95);
}

:root[data-theme="light"] .ml2__tab:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .ml2__chartwrap {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.1);
}

:root[data-theme="light"] .ml2__help-pop {
  border-color: rgba(99, 102, 241, 0.28);
  background: linear-gradient(165deg, #ffffff, #f8fafc);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  color: #334155;
}

:root[data-theme="light"] .ml2__help-pop::before {
  border-color: rgba(99, 102, 241, 0.28);
  background: #ffffff;
}

:root[data-theme="light"] .ml2__help-pop__title,
:root[data-theme="light"] .ml2__help-pop__list strong {
  color: #0f172a;
}

:root[data-theme="light"] .ml2__help-pop__list li {
  color: #475569;
}

:root[data-theme="light"] .ml2-kpi {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.1);
}

:root[data-theme="light"] .ml2-kpi__v {
  color: #0f172a;
}

:root[data-theme="light"] .ml2__caption strong {
  color: #1e293b;
}

.dash-ml-panel--spark .dash-ml-panel__body {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.dash-ml-spark {
  width: 100%;
  height: 56px;
  display: block;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 6px;
  box-sizing: border-box;
}

.dash-ml-panel--spark .dash-ml-panel__metrics--chips {
  margin-top: 0;
}

@media (max-width: 720px) {
  .dash-ml-panel--spark .dash-ml-panel__body {
    grid-template-columns: 1fr;
  }
}

.dash-ml-panel__hint {
  margin: -0.15rem 0 0.65rem;
  font-size: 0.74rem;
  line-height: 1.4;
}

.dash-ml-panel__chart {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  padding: 0.35rem 0.45rem 0.2rem;
  overflow: hidden;
}

.dash-ml-series-svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 9.5rem;
}

.dash-ml-legend--inline {
  margin-top: 0.55rem;
  margin-bottom: 0.15rem;
}

.dash-ml-swatch--ma {
  background: rgba(251, 191, 36, 0.95);
}

.dash-ml-swatch--band {
  background: linear-gradient(
    180deg,
    rgba(167, 139, 250, 0.55) 0%,
    rgba(167, 139, 250, 0.12) 100%
  );
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.dash-ml-panel__metrics--chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.dash-ml-chip {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 18, 30, 0.55);
  min-width: 0;
}

.dash-ml-chip--accent {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}

.dash-ml-chip .dash-ml-metric__k {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-ml-chip .dash-ml-metric__v {
  font-size: 0.92rem;
  line-height: 1.2;
}

.dash-ml-chip__hint {
  font-size: 0.66rem;
  color: rgba(148, 163, 184, 0.88);
}

@media (max-width: 720px) {
  .dash-ml-panel__metrics--chips {
    grid-template-columns: 1fr;
  }
}

.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(148, 163, 184, 0.32);
  background-color: #0f172a;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.78rem;
  cursor: not-allowed;
  opacity: 0.92;
  color-scheme: dark;
}

.dash-ml-select option {
  background-color: #0f172a;
  color: #e2e8f0;
}

.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-panel--target {
  padding: 0.55rem 0.85rem 0.65rem;
  /* Fundo padrão de card: o painel ML é transparente e deixava
     as partículas do stage aparecerem por baixo. */
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(18, 22, 36, 0.65);
  backdrop-filter: blur(8px);
}

.dash-ml-panel--target .dash-ml-panel__head {
  margin-bottom: 0.35rem;
}

.dash-ml-panel--target .dash-card__title {
  margin: 0;
}

.dash-ml-panel--target .dash-goal-gauges {
  gap: 0.55rem;
}

.dash-ml-panel--target .dash-goal-gauge {
  padding: 0.4rem 0.55rem 0.45rem;
}

.dash-ml-panel--target .dash-goal-gauge h3 {
  font-size: 0.72rem;
  margin-bottom: 0;
}

.dash-ml-panel--target .dash-goal-gauge svg {
  width: min(100%, 160px);
  max-height: 88px;
}

.dash-ml-panel--target .dash-goal-gauge__numbers {
  margin-top: 0.15rem;
  gap: 0.25rem 0.65rem;
}

.dash-ml-panel--target .dash-goal-gauge__numbers span {
  font-size: 0.68rem;
}

.dash-ml-panel--target .dash-goal-gauge__value {
  font-size: 0.85rem;
}

.dash-grid--vendedores-charts {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-grid--vendedores-charts > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--vendedores-charts .dash-hbar-list,
.dash-grid--vendedores-charts .ven-seller-status-wrap {
  flex: 1 1 auto;
  min-height: 11rem;
  margin-top: 0.35rem;
}

.dash-hbar-paged {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.45rem;
}

.dash-hbar-paged .dash-hbar-list,
.dash-hbar-paged .ven-seller-status {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.2rem;
}

.dash-hbar-paged__pager {
  flex: 0 0 auto;
  margin-top: auto;
}

.dash-grid--vendedores-charts .ven-seller-status-wrap.dash-hbar-paged {
  min-height: 14rem;
}

@media (max-width: 1100px) {
  .dash-grid--vendedores-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dash-grid--vendedores-charts {
    grid-template-columns: 1fr;
  }
}

.dash-target-forecast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 230px);
  gap: 1rem;
  align-items: stretch;
}

.dash-target-forecast__chart {
  min-width: 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.dash-target-forecast__chart svg {
  display: block;
  width: 100%;
  height: 8.5rem;
}

.dash-target-forecast__grid line {
  stroke: rgba(148, 163, 184, 0.14);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.dash-target-forecast__grid .dash-target-forecast__goal {
  stroke: rgba(74, 222, 128, 0.75);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.dash-target-forecast__track {
  fill: rgba(148, 163, 184, 0.1);
  stroke: rgba(148, 163, 184, 0.16);
}

.dash-target-forecast__p10 {
  stroke: #fbbf24;
  stroke-width: 2.5;
}

.dash-target-forecast__p50 {
  fill: #38bdf8;
  stroke: rgba(224, 242, 254, 0.9);
  stroke-width: 2;
}

.dash-target-forecast__label {
  font-size: 0.72rem;
  font-weight: 700;
  fill: #cbd5e1;
}

.dash-target-forecast__label--low {
  fill: #fbbf24;
}

.dash-target-forecast__label--mid {
  fill: #7dd3fc;
}

.dash-target-forecast__label--goal {
  fill: #4ade80;
}

.dash-target-forecast__axis {
  font-size: 0.65rem;
  fill: rgba(148, 163, 184, 0.85);
}

.dash-target-forecast__summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.dash-target-forecast__summary > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(15, 18, 30, 0.5);
}

.dash-target-forecast__summary span,
.dash-target-forecast__summary small {
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.67rem;
}

.dash-target-forecast__summary strong {
  margin: 0.08rem 0;
  color: #7dd3fc;
  font-size: 1.15rem;
}

.dash-target-forecast__summary > div:last-child strong {
  color: #fbbf24;
}

.dash-fin-projection {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

/* Resultados financeiros: esquerda 60% (projeção + explorador|ciclo),
   DRE à direita em 40% cobrindo a altura das duas linhas. */
.dash-grid--fin-layout {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 4fr);
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.85rem;
}

.dash-fin-left {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  min-height: 0;
}

.dash-fin-left > .dash-card {
  margin-bottom: 0;
}

.dash-fin-left-bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
  min-height: 0;
}

.dash-fin-left-bottom > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-fin-left-bottom .dash-exp-list,
.dash-fin-left-bottom .ciclo-metrics {
  flex: 1 1 auto;
  margin-top: 0.35rem;
}

.dash-grid--fin-layout > [data-card-id="fin-dre"],
.dash-card--dre {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Altura fixa = coluna da esquerda. Sem isso, expandir linhas
     da DRE estica o card e o grid inteiro. */
  height: 0;
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.dash-card--dre .dash-card__head,
.dash-card--dre .dash-card__hint {
  flex: 0 0 auto;
}

.dash-card--dre .dash-card__hint {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
}

.dash-card--dre .dash-table-wrap {
  flex: 1 1 auto;
  margin-top: 0.15rem;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dash-card--dre .dash-dre thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(18, 22, 36, 0.96);
}

.dash-grid--fin-top {
  align-items: stretch;
  margin-bottom: 0.85rem;
  grid-template-columns: minmax(0, 1fr);
}

.dash-grid--fin-top > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 24rem;
}

.dash-card--fin-proj {
  min-height: 18rem;
}

.dash-fin-left > .dash-card--fin-proj {
  flex: 1.15 1 auto;
}

.dash-card--fin-proj .dash-fin-projection {
  flex: 1 1 auto;
  margin-top: 0.15rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(9.5rem, 12rem);
  gap: 0.5rem;
  min-height: 14rem;
  width: 100%;
  align-items: stretch;
}

.dash-fin-projection__chart {
  min-width: 0;
  width: 100%;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.2rem 0.25rem 0.3rem;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.dash-card--fin-proj .dash-fin-projection__summary {
  grid-template-columns: 1fr;
  align-content: stretch;
  gap: 0.28rem;
  height: 100%;
}

.dash-card--fin-proj .dash-fin-projection__summary > div {
  min-height: 2.65rem;
  padding: 0.28rem 0.45rem;
}

.dash-fin-projection__chart svg {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 12rem;
  height: 100%;
  max-height: none;
}

.dash-fin-projection__empty {
  fill: rgba(148, 163, 184, 0.8);
  font-size: 12px;
  pointer-events: none;
}

/* SVG <text hidden> não some no browser — exige display:none. */
.dash-fin-projection__empty[hidden],
.dash-fin-projection__empty[aria-hidden="true"],
.sug-priority-matrix__empty[hidden],
.sug-priority-matrix__empty[aria-hidden="true"] {
  display: none !important;
}

.dash-fin-projection__grid line {
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.dash-fin-projection__area {
  fill: url("#fin-projection-area");
}

.dash-fin-projection__history,
.dash-fin-projection__forecast {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-fin-projection__history {
  stroke: #38bdf8;
  stroke-width: 3;
}

.dash-fin-projection__forecast {
  stroke: url("#fin-projection-future");
  stroke-width: 3;
  stroke-dasharray: 7 5;
}

[data-fin-projection-points] circle {
  stroke: #0f172a;
  stroke-width: 2;
}

[data-fin-projection-points] circle.is-history {
  fill: #38bdf8;
}

[data-fin-projection-points] circle.is-forecast {
  fill: #f472b6;
}

[data-fin-projection-points] circle.is-nowcast {
  fill: #a78bfa;
  stroke: rgba(15, 18, 30, 0.85);
  stroke-width: 1.2;
}

.dash-fin-projection__point-label {
  fill: #7dd3fc;
  font-size: 11px;
  font-weight: 650;
}

.dash-fin-projection__point-label.is-forecast {
  fill: #f9a8d4;
}

.dash-fin-projection__month {
  fill: rgba(148, 163, 184, 0.92);
  font-size: 11px;
  text-transform: capitalize;
}

.dash-fin-projection__legend,
.dash-fin-chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.15rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
  margin-top: 0.2rem;
  flex: 0 0 auto;
}

.dash-fin-projection__legend span,
.dash-fin-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dash-fin-projection__legend i,
.dash-fin-chart-legend i {
  width: 20px;
  height: 3px;
  border-radius: 999px;
}

.dash-fin-projection__legend i.is-history,
.dash-fin-chart-legend i.is-history {
  background: #38bdf8;
}

.dash-fin-projection__legend i.is-forecast,
.dash-fin-chart-legend i.is-forecast {
  background: repeating-linear-gradient(90deg, #a78bfa 0 5px, transparent 5px 8px);
}

.dash-fin-projection__legend i.is-trend,
.dash-fin-chart-legend i.is-trend {
  background: #f472b6;
}

/* Piso (já lançado) e faixa provável da projeção: blocos, não linhas. */
.dash-fin-chart-legend i.is-floor,
.dash-fin-chart-legend i.is-range {
  height: 9px;
  border-radius: 2px;
}

.dash-fin-chart-legend i.is-floor {
  background: rgba(56, 189, 248, 0.18);
  border: 1px dashed rgba(56, 189, 248, 0.7);
}

.dash-fin-chart-legend i.is-range {
  background: rgba(244, 114, 182, 0.18);
}

.dash-fin-projection__summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.dash-fin-projection__summary > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.34);
}

.dash-fin-projection__summary span,
.dash-fin-projection__summary small {
  color: var(--muted);
  font-size: 0.65rem;
}

.dash-fin-projection__summary strong {
  margin: 0.08rem 0;
  color: #7dd3fc;
  font-size: 0.85rem;
}

.dash-fin-projection__summary strong.is-negative {
  color: #fb7185;
}

.dash-fin-projection__summary strong.is-positive {
  color: #4ade80;
}

.dash-card--fin-despesas .dash-chart-placeholder,
.dash-chart-placeholder--fin-fill {
  width: 100%;
  flex: 1 1 auto;
  min-height: 16rem;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  padding: 0.15rem 0.2rem 0.25rem;
  box-sizing: border-box;
}

.dash-card--fin-despesas .dash-svg-chart {
  width: 100%;
  flex: 1 1 auto;
  min-height: 14rem;
  height: 100%;
  max-height: none;
  display: block;
}

.dash-card--fin-despesas .dash-svg-bar-label {
  font-size: 11px;
  font-weight: 650;
  fill: #7dd3fc;
}

.dash-card--fin-despesas .dash-svg-forecast-label {
  fill: #f9a8d4;
}

.dash-card--fin-despesas .dash-svg-axis {
  font-size: 11px;
}

.dash-grid--fin-resultados {
  align-items: stretch;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-grid--fin-resultados > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--fin-resultados .dash-exp-list,
.dash-grid--fin-resultados .dash-table-wrap,
.dash-grid--fin-resultados .ciclo-metrics {
  flex: 1 1 auto;
  margin-top: 0.35rem;
}

/* DRE: linhas expansíveis (drill-down). */
.dash-dre__row--expandable {
  cursor: pointer;
}

.dash-dre__row--expandable:hover > td {
  background: rgba(56, 189, 248, 0.06);
}

.dash-dre__row--open > td {
  background: rgba(56, 189, 248, 0.08);
}

.dash-dre__caret {
  display: inline-block;
  width: 0.85rem;
  margin-right: 0.28rem;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.dash-dre__row--open .dash-dre__caret {
  transform: rotate(90deg);
  color: #7dd3fc;
}

.dash-dre__child td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.82rem;
  color: rgba(203, 213, 225, 0.95);
  background: rgba(0, 0, 0, 0.18);
  border-top-color: transparent;
}

.dash-dre__child td:first-child {
  padding-left: 1.55rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dash-dre__child--loading td,
.dash-dre__child--empty td {
  font-style: italic;
  color: rgba(148, 163, 184, 0.9);
}

/* Valor / %: nunca quebrar (ex.: "R$" numa linha e o número na outra). */
.dash-dre th:nth-child(2),
.dash-dre td:nth-child(2),
.dash-dre th:nth-child(3),
.dash-dre td:nth-child(3),
.dash-dre th:nth-child(4),
.dash-dre td:nth-child(4) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  width: 1%;
  vertical-align: top;
}

@media (max-width: 1100px) {
  .dash-grid--fin-resultados {
    grid-template-columns: 1fr;
  }

  .dash-grid--fin-layout {
    grid-template-columns: 1fr;
  }

  .dash-fin-left-bottom {
    grid-template-columns: 1fr;
  }

  /* Em coluna única a DRE volta a ter altura própria (com teto + scroll). */
  .dash-grid--fin-layout > [data-card-id="fin-dre"],
  .dash-card--dre {
    height: auto;
    min-height: 18rem;
    max-height: min(70vh, 36rem);
  }
}

.dash-goal-gauges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.dash-goal-gauge {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 74%, rgba(56, 189, 248, 0.08), transparent 46%),
    rgba(15, 23, 42, 0.3);
}

.dash-goal-gauge h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.dash-goal-gauge svg {
  display: block;
  width: min(100%, 250px);
  margin: 0 auto;
  overflow: visible;
}

.dash-goal-gauge__track,
.dash-goal-gauge__zones,
.dash-goal-gauge__progress {
  fill: none;
  stroke-linecap: round;
  stroke-width: 14;
}

.dash-goal-gauge__track {
  stroke: rgba(148, 163, 184, 0.12);
}

.dash-goal-gauge__zones {
  stroke: rgba(148, 163, 184, 0.1);
  stroke-dasharray: 55 3 17 3 22;
}

.dash-goal-gauge__progress {
  stroke: #fb7185;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.55s ease, stroke 0.25s ease;
}

.dash-goal-gauge.is-warn .dash-goal-gauge__progress {
  stroke: #fbbf24;
}

.dash-goal-gauge.is-ok .dash-goal-gauge__progress {
  stroke: #4ade80;
}

.dash-goal-gauge__needle {
  transform: rotate(-90deg);
  transform-origin: 100px 92px;
  transition: transform 0.55s ease;
}

.dash-goal-gauge__needle line {
  stroke: #e2e8f0;
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(226, 232, 240, 0.45));
}

.dash-goal-gauge__pivot {
  fill: #0f172a;
  stroke: #e2e8f0;
  stroke-width: 3;
}

.dash-goal-gauge__value {
  fill: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 800;
}

.dash-goal-gauge__tick {
  fill: rgba(148, 163, 184, 0.8);
  font-size: 0.55rem;
}

.dash-goal-gauge__numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.dash-goal-gauge__numbers span {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  color: var(--muted);
  font-size: 0.64rem;
}

.dash-goal-gauge__numbers strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .dash-fin-projection,
  .dash-card--fin-proj .dash-fin-projection {
    grid-template-columns: 1fr;
  }

  .dash-fin-projection__summary,
  .dash-card--fin-proj .dash-fin-projection__summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-target-forecast {
    grid-template-columns: 1fr;
  }

  .dash-target-forecast__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-goal-gauges {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .dash-fin-projection__summary {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 721px) and (max-width: 1050px) {
  .dash-goal-gauges {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.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__pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

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

.dash-rfm__pane .dash-rfm__heat-wrap {
  flex: 1 1 auto;
}

.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 troca a matriz pelo 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;
}

/* Painel de detalhamento no lugar da matriz de quintis */
.dash-rfm__detail {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0.75rem 0.85rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(79, 70, 229, 0.12);
  overflow: auto;
}

.dash-rfm__detail[hidden] {
  display: none !important;
}

.dash-rfm__layout.dash-rfm--detail .dash-rfm__heat-wrap {
  display: none;
}
.dash-rfm__seg-hint {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.68rem;
}

.dash-rfm__detail-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.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.15rem;
  flex-shrink: 0;
}

.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;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.dash-rfm__pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.55rem;
  flex-shrink: 0;
}

.dash-rfm__pager[hidden] {
  display: none !important;
}

.dash-rfm__pager-info {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
  min-width: 3.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dash-rfm__pager-btn {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dash-rfm__pager-btn:hover:not(:disabled) {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.4);
  color: #f8fafc;
}

.dash-rfm__pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dash-rfm__pager-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.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;
}

.dash-rfm__cli-score {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: rgba(203, 213, 225, 0.92);
}

/* Modal de clientes por segmento RFM */
.rfm-clients-modal {
  max-width: min(920px, calc(100vw - 2rem));
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 820px);
}

#rfm-clients-overlay.modal-overlay {
  align-items: center;
}

.rfm-clients-modal .modal__head {
  flex-shrink: 0;
}

.rfm-clients-modal .modal__title-group {
  align-items: center;
  gap: 0.7rem;
}

.rfm-clients-modal__swatch {
  width: 0.55rem;
  height: 2.1rem;
  border-radius: 999px;
  flex: 0 0 auto;
  background: rgba(52, 211, 153, 0.9);
}

.rfm-clients-modal__sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
}

.rfm-clients-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.rfm-clients-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rfm-clients-modal__count {
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
}

.rfm-clients-modal__table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.rfm-clients-modal__table {
  width: 100%;
  border-collapse: collapse;
}

.rfm-clients-modal__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 18, 30, 0.96);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.95);
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rfm-clients-modal__table thead th:nth-child(n+2) {
  text-align: right;
}

.rfm-clients-modal__table thead th:nth-child(n+5) {
  text-align: center;
}

.rfm-clients-modal__table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
}

.rfm-clients-modal__pager {
  justify-content: center;
  flex-shrink: 0;
}

html[data-login-theme="light"] body.page-portal .rfm-clients-modal__table-wrap {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-login-theme="light"] body.page-portal .rfm-clients-modal__table thead th {
  background: #f8fafc;
  color: #64748b;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-login-theme="light"] body.page-portal .rfm-clients-modal__table tbody td {
  border-bottom-color: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

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

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__pager-info {
  color: rgba(71, 85, 105, 0.95);
}

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

html[data-login-theme="light"] body.page-portal .dash-rfm__pager-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.35);
}

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;
}

@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--has-help {
  position: relative;
  overflow: visible;
}

.dash-kpi__label-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  z-index: 3;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.dash-kpi__label-row .dash-kpi__label {
  display: block;
  margin-bottom: 0;
  min-width: 0;
  flex: 0 1 auto;
  width: auto;
  max-width: calc(100% - 1.5rem);
  padding-right: 0;
}

.dash-kpi__help-btn {
  width: 18px;
  height: 18px;
  font-size: 0.68rem;
  line-height: 1;
  padding: 0;
  flex: 0 0 auto;
}

.dash-kpi__help-pop {
  left: 0;
  right: auto;
  width: min(20.5rem, calc(100vw - 2rem));
}

/* "?" que abre a lista de registros por trás do número (KPIs de aging). */
.dash-kpi__detail-btn {
  width: 18px;
  height: 18px;
  font-size: 0.68rem;
  line-height: 1;
  padding: 0;
  flex: 0 0 auto;
}

.dash-kpi--has-detail {
  position: relative;
  overflow: visible;
}

.dash-kpi.card-has-customizer .dash-kpi__label-row {
  max-width: calc(100% - 3.75rem);
}

.dash-kpi.card-has-customizer .dash-kpi__label-row .dash-kpi__label {
  padding-right: 0;
}

.dash-kpi__value {
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* Comercial > Produtos: caixas de insight (campeão, vilão, etc.) — o valor
   é o nome do produto, não um número. 1.25rem sobra e "grita"; fica em 1rem
   só nestas 6 caixas, sem afetar os demais KPIs. */
.dash-insight-row .dash-kpi--insight .dash-kpi__value {
  font-size: 1rem;
}

/* Comercial > Vendedores: Top vendedor — o valor é o nome da pessoa. */
[data-card-id="ven-kpi-top"] .dash-kpi__value {
  font-size: 1rem;
}

.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));
}

/* Mais vendidos 60% · Concentração da demanda 40% */
.dash-grid--sug-vendidos-concentracao {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

@media (max-width: 900px) {
  .dash-grid--sug-vendidos-concentracao {
    grid-template-columns: 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: 18rem;
  justify-content: space-between;
  margin-bottom: 0.15rem;
  gap: 0.42rem;
}

.dash-grid--clientes-charts > [data-card-id="cli-chart-recencia"] .dash-chart-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  min-height: 11.5rem;
  margin-top: 0.35rem;
  margin-bottom: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  overflow: visible;
}

.dash-grid--clientes-charts > [data-card-id="cli-chart-recencia"] .dash-svg-chart {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 10.5rem;
  display: block;
}

/* Produtos: grade 3 colunas com tipos mistos (hbar / signed / hist / funnel / donut). */
.dash-grid--produtos-charts {
  align-items: stretch;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .dash-grid--produtos-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dash-grid--produtos-charts {
    grid-template-columns: 1fr;
  }
}

.dash-grid--produtos-charts > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--produtos-charts .dash-chart-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  min-height: 11rem;
  margin-top: 0.35rem;
  padding: 0.4rem 0.45rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
}

.dash-grid--produtos-charts .dash-svg-chart {
  width: 100%;
  height: auto;
  min-height: 10.5rem;
  display: block;
}

.dash-grid--produtos-charts .dash-hbar-list {
  flex: 1 1 auto;
  min-height: 11rem;
  margin-top: 0.35rem;
}

.dash-svg-axis--signed-label {
  font-size: 9.5px;
  fill: rgba(203, 213, 225, 0.92);
}

.dash-svg-bar-label--signed {
  font-size: 9px;
  font-weight: 650;
  fill: rgba(241, 245, 249, 0.95);
}

.dash-svg-plot-bg {
  fill: rgba(255, 255, 255, 0.02);
}

.dash-svg-bar-track {
  fill: rgba(148, 163, 184, 0.08);
}

/* Clientes: RFM + mapa — preenche a altura do card (sem buraco embaixo). */
.dash-grid--clientes-rfm {
  align-items: stretch;
}

.dash-grid--clientes-rfm > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] > .dash-rfm {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__pane,
.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__segments {
  flex: 1 1 auto;
  min-height: 0;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__heat-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__heat {
  flex: 1 1 auto;
  min-height: 14rem;
  grid-template-rows: auto repeat(5, minmax(0, 1fr));
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__heat-cell {
  min-height: 0;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-rfm"] .dash-rfm__seg-list {
  flex: 1 1 auto;
  justify-content: flex-start;
  gap: 0.55rem;
}

.dash-grid--clientes-rfm > [data-card-id="cli-chart-mapa"] .dash-geomap {
  flex: 1 1 auto;
  min-height: 14rem;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
}

/* Faturamento: série ML em largura total; calor + mapa na segunda linha. */
.dash-grid--faturamento-charts {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto minmax(12rem, 1fr);
  min-height: 0;
  gap: 0.85rem;
}

.dash-grid--faturamento-charts > .dash-card {
  margin-bottom: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] {
  grid-column: 1 / -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-regiao"] {
  grid-column: 2;
  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 > [data-card-id="cmcl-chart-regiao"] > .dash-card__head {
  flex-shrink: 0;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] > .dash-card__sub {
  margin: 0.15rem 0 0.55rem;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"] > .dash-ml2 {
  flex: 1 1 auto;
  min-width: 0;
}

.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.25rem;
  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 > [data-card-id="cmcl-chart-regiao"] .dash-geomap {
  flex: 1 1 auto;
  min-height: 10rem;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
}

.dash-grid--faturamento-charts > [data-card-id="cmcl-chart-regiao"] .dash-geomap__svg {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

@media (max-width: 900px) {
  .dash-grid--faturamento-charts {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .dash-grid--faturamento-charts > [data-card-id="cmcl-chart-faturamento-tempo"],
  .dash-grid--faturamento-charts > [data-card-id="cmcl-chart-heatmap"],
  .dash-grid--faturamento-charts > [data-card-id="cmcl-chart-regiao"] {
    grid-column: 1;
    grid-row: auto;
  }
}

.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;
}
/* Faixa da projeção: preenchimento discreto, sem borda, para a linha
   tracejada continuar sendo o elemento principal. */
/* Faixa provável da projeção: preenchimento na cor da linha, bem diluído
   para não competir com as barras do realizado. */
.dash-svg-forecast-range {
  fill-opacity: 0.14;
}
/* Piso "já lançado" dos meses projetados: barra vazada com contorno
   tracejado, para distinguir do realizado sem sair do eixo. */
.dash-svg-forecast-floor {
  fill-opacity: 0.18;
  stroke-width: 1;
  stroke-dasharray: 3 2;
  stroke-opacity: 0.7;
}
.dash-svg-axis {
  fill: rgba(148, 163, 184, 0.92);
  font-family: system-ui, sans-serif;
  font-size: 11px;
}
.dash-svg-axis--right {
  fill: rgba(244, 114, 182, 0.9);
}
.dash-svg-legend-text {
  fill: rgba(226, 232, 240, 0.95);
  font-family: system-ui, sans-serif;
  font-size: 11px;
}
.dash-svg-legend-text--sm {
  font-size: 9px;
  fill: rgba(148, 163, 184, 0.92);
}
.dash-svg-hot {
  fill: transparent;
  cursor: pointer;
}
.dash-svg-bar-label {
  fill: rgba(226, 232, 240, 0.95);
  font-family: system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 650;
}
.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: 9.5px;
  font-weight: 650;
}

/* 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));
  /* Linha 1 = rótulos de hora (altura do conteúdo); linhas 2–8 = dias (esticam). */
  grid-template-rows: auto repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin-top: 0;
  padding: 4px 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 (não estica). */
.dash-heat-haxis {
  font-size: 0.7rem;
  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;
  line-height: 1.1;
}

/* 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;
}

/* Barras divergentes: zero no centro (negativo ← | → positivo). */
.dash-hbar-signed {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: center;
  width: 100%;
  min-height: 8px;
}

.dash-hbar-signed__half {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 8px;
}

.dash-hbar-signed__half--neg {
  justify-content: flex-end;
}

.dash-hbar-signed__half--pos {
  justify-content: flex-start;
}

.dash-hbar-signed__zero {
  width: 1px;
  height: 14px;
  background: rgba(148, 163, 184, 0.55);
  justify-self: center;
}

.dash-hbar.dash-hbar--signed-pos,
.dash-hbar.dash-hbar--signed-neg {
  width: var(--w, 50%);
  max-width: 100%;
  flex: 0 0 auto;
}

.dash-hbar.dash-hbar--signed-neg {
  background: linear-gradient(270deg, rgba(248, 113, 113, 0.95), rgba(239, 68, 68, 0.55));
}

.dash-hbar-list__value--neg {
  color: rgba(248, 113, 113, 0.98);
  font-weight: 650;
}

html[data-login-theme="light"] body.page-portal .dash-hbar-signed__zero {
  background: rgba(100, 116, 139, 0.55);
}

html[data-login-theme="light"] body.page-portal .dash-hbar.dash-hbar--signed-neg {
  background: linear-gradient(270deg, rgba(220, 38, 38, 0.95), rgba(239, 68, 68, 0.55));
}

html[data-login-theme="light"] body.page-portal .dash-hbar-list__value--neg {
  color: #dc2626;
}

.ven-seller-status {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: none;
  overflow: visible;
}

.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;
}

.dash-grid--cash-pair {
  align-items: stretch;
}

.dash-grid--cash-pair > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--cap-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  grid-template-areas:
    "left fluxo"
    "projecao projecao";
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.85rem;
}

.dash-grid--cap-layout > .dash-cap-left-stack {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  height: 100%;
}

.dash-grid--cap-layout > .dash-cap-left-stack > .dash-card {
  flex: 1 1 0;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-grid--cap-layout > [data-card-id="cap-chart-fluxo"] {
  grid-area: fluxo;
}

.dash-grid--cap-layout > [data-card-id="cap-chart-projecao"] {
  grid-area: projecao;
}

.dash-grid--cap-layout > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-grid--car-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  grid-template-areas:
    "left fluxo"
    "projecao projecao";
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.85rem;
}

.dash-grid--car-layout > .dash-cap-left-stack {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  height: 100%;
}

.dash-grid--car-layout > .dash-cap-left-stack > .dash-card {
  flex: 1 1 0;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-grid--car-layout > [data-card-id="car-chart-fluxo"] {
  grid-area: fluxo;
}

.dash-grid--car-layout > [data-card-id="car-chart-projecao"] {
  grid-area: projecao;
}

.dash-grid--car-layout > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-card--car-lista {
  min-width: 0;
  overflow: hidden;
}

.dash-card--car-lista .dash-exp-list--fill {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  margin-top: 0.45rem;
  gap: 0.45rem;
  overflow: hidden;
  box-sizing: border-box;
}

.dash-card--car-fluxo .dash-calendar-heat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-card--car-fluxo .dash-calendar-heat__row {
  flex: 1 1 auto;
}

.dash-card--cap-categoria,
.dash-card--car-categoria,
.dash-card--orc-distribuicao {
  display: flex;
  flex-direction: column;
}

.dash-card--cap-categoria .dash-donut-wrap,
.dash-card--car-categoria .dash-donut-wrap,
.dash-card--orc-distribuicao .dash-donut-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  margin-top: 0.35rem;
  display: grid;
  grid-template-columns: minmax(6.5rem, 0.78fr) minmax(0, 1.2fr);
  gap: 0.55rem 0.75rem;
  align-items: center;
  align-content: center;
  overflow: hidden;
  box-sizing: border-box;
}

.dash-card--cap-categoria .dash-donut-wrap--legend-left,
.dash-card--car-categoria .dash-donut-wrap--legend-left,
.dash-card--orc-distribuicao .dash-donut-wrap--legend-left {
  grid-template-columns: minmax(6.5rem, 0.78fr) minmax(0, 1.2fr);
}

.dash-card--cap-categoria .dash-donut-legend,
.dash-card--car-categoria .dash-donut-legend,
.dash-card--orc-distribuicao .dash-donut-legend {
  gap: 0.42rem;
  font-size: 0.86rem;
  line-height: 1.3;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
}

.dash-card--cap-categoria .dash-donut-wrap--names-only .dash-donut-legend li,
.dash-card--car-categoria .dash-donut-wrap--names-only .dash-donut-legend li,
.dash-card--orc-distribuicao .dash-donut-wrap--names-only .dash-donut-legend li {
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 0.45rem;
}

.dash-card--cap-categoria .dash-donut-legend__sw,
.dash-card--car-categoria .dash-donut-legend__sw,
.dash-card--orc-distribuicao .dash-donut-legend__sw {
  width: 14px;
  height: 14px;
}

.dash-card--cap-categoria .dash-donut-svg,
.dash-card--car-categoria .dash-donut-svg,
.dash-card--orc-distribuicao .dash-donut-svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(100%, 16rem);
  aspect-ratio: 1 / 1;
  justify-self: center;
  align-self: center;
  overflow: hidden;
  flex: none;
}

.dash-donut-wrap--pie-fill .dash-donut-svg {
  max-height: min(100%, 11.5rem);
}

.dash-card--cap-categoria .dash-donut-label--pie,
.dash-card--car-categoria .dash-donut-label--pie,
.dash-card--orc-distribuicao .dash-donut-label--pie {
  font-size: 14px;
  font-weight: 700;
}

.dash-card--cap-receita .dash-chart-placeholder--cap-receita {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  padding: 0.1rem 0.15rem 0.2rem;
  box-sizing: border-box;
}

.dash-card--cap-receita .dash-svg-chart {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  display: block;
}

.dash-card--cap-receita .dash-fin-chart-legend,
.dash-card--cap-fill .dash-fin-chart-legend {
  justify-content: flex-start;
  margin-top: 0.35rem;
  font-size: 0.84rem;
}

.dash-card--cap-receita .dash-svg-bar-label,
.dash-card--cap-receita .dash-svg-combo-label {
  font-size: 11px;
  font-weight: 650;
}

.dash-card--cap-receita .dash-svg-legend-text,
.dash-card--cap-receita .dash-svg-axis {
  font-size: 11px;
}

/* Projeções: rótulos menores — o viewBox largo amplia a fonte SVG. */
[data-card-id="cap-chart-projecao"] .dash-svg-bar-label,
[data-card-id="cap-chart-projecao"] .dash-svg-combo-label,
[data-card-id="car-chart-projecao"] .dash-svg-bar-label,
[data-card-id="car-chart-projecao"] .dash-svg-combo-label {
  font-size: 7.5px;
  font-weight: 600;
}

[data-card-id="cap-chart-projecao"] .dash-svg-axis,
[data-card-id="car-chart-projecao"] .dash-svg-axis {
  font-size: 9px;
}

.dash-card--cap-fluxo {
  min-height: 0;
}

.dash-card--cap-fluxo .dash-calendar-heat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dash-card--cap-fluxo .dash-calendar-heat__row {
  flex: 1 1 auto;
}

.dash-grid--cash-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: inherit;
  align-items: stretch;
  margin-bottom: 0.85rem;
}

.dash-grid--cash-split > .dash-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (max-width: 900px) {
  .dash-grid--cash-split {
    grid-template-columns: 1fr;
  }

  .dash-grid--cap-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "fluxo"
      "projecao";
  }

  .dash-grid--cap-layout > .dash-cap-left-stack {
    height: auto;
  }

  .dash-grid--cap-layout > .dash-cap-left-stack > .dash-card {
    flex: 0 0 auto;
    min-height: 12rem;
  }

  .dash-grid--car-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "fluxo"
      "projecao";
  }

  .dash-grid--car-layout > .dash-cap-left-stack {
    height: auto;
  }

  .dash-grid--car-layout > .dash-cap-left-stack > .dash-card {
    flex: 0 0 auto;
    min-height: 12rem;
  }
}

.dash-card--cap-fill .dash-chart-placeholder--cap-wide {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  margin-top: 0.25rem;
  display: block;
}

.dash-card--cap-fill .dash-chart-placeholder--cap-wide .dash-svg-chart {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  display: block;
}

.dash-card--cap-fill .dash-chart-placeholder--fin-fill {
  flex: 1 1 auto;
  min-height: 12rem;
}

.dash-card--cap-fill .dash-svg-chart {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
}

.dash-card--cap-categoria {
  display: flex;
  flex-direction: column;
}

.dash-card--cap-categoria .dash-exp-list--fill {
  flex: 1 1 auto;
  margin-top: 0.45rem;
  gap: 0.55rem;
}

.dash-exp-list--fill {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.dash-exp-list--fill li {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) minmax(0, 1.5fr) 3.75ch;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.dash-exp-list--fill .dash-exp-list__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dash-exp-list--fill .dash-hbar {
  width: var(--w, 50%);
  max-width: 100%;
  min-width: 0;
  justify-self: start;
  box-sizing: border-box;
}

.dash-exp-list--fill .dash-exp-list__pct {
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

/* ================================================================
 * 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__nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.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;
  min-width: 9.5rem;
}

.dash-calendar-heat__nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.08);
  color: rgba(226, 232, 240, 0.9);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.dash-calendar-heat__nav-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
}

.dash-calendar-heat__nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.dash-calendar-heat__stats {
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.92);
  font-variant-numeric: tabular-nums;
}

.dash-calendar-heat__export {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.08);
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dash-calendar-heat__export:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
}

.dash-calendar-heat__export:disabled {
  opacity: 0.55;
  cursor: default;
}

.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--no-weeks .dash-calendar-heat__head,
.dash-calendar-heat--no-weeks .dash-calendar-heat__row {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.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;
  width: 100%;
  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)));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  position: relative;
  overflow: hidden;
}

.dash-calendar-heat--real .dash-calendar-heat__cell:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.85);
  outline-offset: 1px;
}

.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);
}

/* Dia já vencido com saldo em aberto: mesma escala de intensidade, base
   vermelha. Só troca `--base`, então o degradê continua comparável. */
.dash-calendar-heat--real .dash-calendar-heat__cell[data-overdue="1"] {
  --base: 248, 113, 113;
  border-color: rgba(248, 113, 113, 0.45);
}

.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__cell[data-overdue="1"]:hover {
  border-color: rgba(248, 113, 113, 0.8);
}

.dash-calendar-heat__overdue-stat {
  color: rgba(248, 113, 113, 0.95) !important;
}

.dash-calendar-heat__legend-overdue {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.6rem;
}

.dash-calendar-heat__legend-swatch {
  width: 16px;
  height: 10px;
  border-radius: 2px;
  background-color: rgba(248, 113, 113, 0.7);
}

.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);
}

/* Modal de detalhe do dia (calendário) */
.cal-day-detail-modal {
  /* Com o detalhe completo (documento, fornecedor, valores, atraso) a tabela
     tem ~12 colunas: cabe mais largura antes de rolar na horizontal. */
  max-width: min(1240px, 97vw);
}

.cal-day-detail-modal .modal__head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cal-day-detail__export[hidden] {
  display: none;
}

.cal-day-detail__export {
  white-space: nowrap;
  font-size: 0.82rem;
  padding: 0.32rem 0.7rem;
}

.cal-day-detail__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(70vh, 640px);
}

.cal-day-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.cal-day-detail__agg--overdue strong {
  color: rgba(248, 113, 113, 0.95);
}

.cal-day-detail__meta strong {
  color: #e2e8f0;
  font-weight: 600;
}

.cal-day-detail__scroll {
  overflow: auto;
  max-height: min(56vh, 520px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
}

.cal-day-detail__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cal-day-detail__table th,
.cal-day-detail__table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.cal-day-detail__table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #94a3b8;
  font-weight: 600;
  z-index: 1;
}

.cal-day-detail__trunc,
.cal-day-detail__loading {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}

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

html[data-login-theme="light"] body.page-portal .cal-day-detail__meta strong {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .cal-day-detail__table th {
  background: #f8fafc;
  color: #475569;
}

html[data-login-theme="light"] body.page-portal .cal-day-detail__scroll {
  border-color: rgba(15, 23, 42, 0.1);
}

/* ================================================================
 * 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.86rem;
}

.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;
}

.dash-donut-label--pie {
  font-size: 13px;
  font-weight: 700;
  stroke-width: 3px;
}

.dash-donut-wrap--names-only .dash-donut-legend li {
  grid-template-columns: 14px minmax(0, 1fr);
}

@media (max-width: 540px) {
  .dash-donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .dash-card--cap-categoria .dash-donut-wrap,
  .dash-card--car-categoria .dash-donut-wrap,
  .dash-card--orc-distribuicao .dash-donut-wrap,
  .dash-card--cap-categoria .dash-donut-wrap--legend-left,
  .dash-card--car-categoria .dash-donut-wrap--legend-left,
  .dash-card--orc-distribuicao .dash-donut-wrap--legend-left {
    grid-template-columns: 1fr;
  }

  .dash-card--cap-categoria .dash-donut-legend,
  .dash-card--car-categoria .dash-donut-legend,
  .dash-card--orc-distribuicao .dash-donut-legend {
    width: 100%;
    order: 2;
  }

  .dash-card--cap-categoria .dash-donut-svg,
  .dash-card--car-categoria .dash-donut-svg,
  .dash-card--orc-distribuicao .dash-donut-svg {
    order: 1;
    max-width: 14rem;
  }
}

html[data-login-theme="light"] body.page-portal .dash-donut-label {
  fill: #ffffff;
  stroke: rgba(15, 23, 42, 0.7);
}

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);
}

/* ===== Planejamento editável (orçamento, ciclo, limite) ===== */
.dash-card__hint {
  margin: -0.15rem 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(148, 163, 184, 0.88);
}

.dash-planner-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.ciclo-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.ciclo-metrics__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.45);
}

.ciclo-metrics__label {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.92);
}

.ciclo-metrics__value {
  font-size: 1.05rem;
  font-weight: 650;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.ciclo-metrics__src {
  font-style: normal;
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.75);
  min-height: 0.9rem;
}

@media (max-width: 720px) {
  .ciclo-metrics {
    grid-template-columns: 1fr;
  }
}

.dash-planner-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
}

.dash-planner-field span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-planner-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.88rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.dash-planner-field input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.28);
}

.dash-planner-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);
  background: rgba(0, 0, 0, 0.32);
}

.orc-budget {
  min-width: 0;
}

.dash-grid--orc-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  grid-template-areas: "charts categorias";
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.85rem;
  min-height: min(70vh, 42rem);
}

.dash-grid--orc-layout > .dash-orc-left-stack {
  grid-area: charts;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-self: stretch;
  min-width: 0;
  min-height: 100%;
  height: 100%;
}

.dash-grid--orc-layout > .dash-orc-left-stack > .dash-card {
  flex: 1 1 0;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-grid--orc-layout > .dash-orc-left-stack > .dash-card--orc-comparativo {
  flex: 1.25 1 0;
  min-height: 22rem;
}

.dash-grid--orc-layout > .dash-orc-left-stack > .dash-card--orc-distribuicao {
  flex: 1 1 0;
  min-height: 18rem;
}

.dash-grid--orc-layout > .orc-budget__table {
  grid-area: categorias;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

.orc-budget__table-hint {
  margin: 0.15rem 0 0.55rem;
  font-size: 0.78rem;
}

.orc-budget__table .dash-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.orc-table-paged {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.55rem;
}

.orc-table-paged__pager {
  flex: 0 0 auto;
  margin-top: auto;
}

@media (max-width: 900px) {
  .dash-grid--orc-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "charts"
      "categorias";
  }

  .dash-grid--orc-layout > .dash-orc-left-stack {
    height: auto;
  }

  .dash-grid--orc-layout > .dash-orc-left-stack > .dash-card {
    flex: 0 0 auto;
    min-height: 14rem;
  }
}

.orc-budget__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.orc-budget__toolbar .dash-card__hint {
  margin: 0.28rem 0 0;
}

.orc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.orc-save-status {
  color: var(--muted);
  font-size: 0.78rem;
}

.orc-save-status.is-ok {
  color: #4ade80;
}

.orc-save-status.is-warn {
  color: #fbbf24;
}

.orc-save-status.is-err {
  color: #fb7185;
}

.orc-budget__kpis {
  margin-bottom: 0.85rem;
}

.dash-card--orc-comparativo,
.dash-card--orc-distribuicao {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.orc-chart-legend {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  margin: 0.15rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
}

.orc-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.orc-chart-legend i {
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.orc-chart-legend i.is-budget {
  background: #38bdf8;
}

.orc-chart-legend i.is-actual {
  background: #a78bfa;
}

.orc-hbar-paged {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.45rem;
}

.orc-hbar-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.2rem;
  overflow: hidden;
  justify-content: flex-start;
  gap: 0.55rem;
}

.orc-hbar-paged__pager {
  flex: 0 0 auto;
  margin-top: auto;
}

.orc-hbar-list li {
  grid-template-columns: minmax(0, 1.1fr) minmax(72px, 1.6fr) auto;
  font-size: 0.82rem;
}

.orc-hbar-list__cat {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(226, 232, 240, 0.94);
}

.orc-hbar-list__bars {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.orc-hbar.dash-hbar {
  height: 7px;
  max-width: var(--w, 50%);
}

.orc-hbar.is-budget {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.95), rgba(56, 189, 248, 0.45));
}

.orc-hbar.is-actual {
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.95), rgba(129, 140, 248, 0.45));
}

.orc-hbar-list__vals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.orc-hbar-list__vals strong {
  font-size: 0.82rem;
  font-weight: 650;
}

.orc-hbar-list__vals strong.is-budget {
  color: #7dd3fc;
}

.orc-hbar-list__vals strong.is-actual {
  color: #c4b5fd;
}

.orc-hbar-list__empty {
  display: block;
  padding: 1.1rem 0.25rem;
  text-align: center;
  font-size: 0.82rem;
  list-style: none;
}

.orc-budget__visuals > .dash-card {
  min-width: 0;
  min-height: 320px;
}

.orc-config-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

.orc-config-modal .modal__head {
  flex: 0 0 auto;
}

.orc-config-modal .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
}

.orc-config-modal .orc-modal-grid,
.orc-config-modal .orc-cat-field {
  overflow: visible;
}

.orc-config-modal .modal__foot {
  flex: 0 0 auto;
}

.orc-table-paged--modal {
  flex: 0 0 auto;
  margin-top: 0.25rem;
}

.orc-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: end;
}

.orc-cat-field {
  min-width: 0;
}

.orc-cat-combobox {
  position: relative;
  z-index: 2;
}

.orc-cat-combobox.is-open {
  z-index: 40;
}

.orc-cat-combobox__control {
  position: relative;
  display: flex;
  align-items: stretch;
}

.orc-cat-combobox__input {
  width: 100%;
  padding-right: 2.4rem;
}

.orc-cat-combobox__toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: rgba(148, 163, 184, 0.95);
  border-radius: 0 10px 10px 0;
}

.orc-cat-combobox__toggle:hover,
.orc-cat-combobox__toggle:focus-visible {
  color: #e2e8f0;
  outline: none;
  background: rgba(56, 189, 248, 0.1);
}

.orc-cat-combobox__caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.15s ease;
}

.orc-cat-combobox.is-open .orc-cat-combobox__caret {
  transform: rotate(180deg);
}

.orc-cat-combobox__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 14rem;
  overflow: auto;
  padding: 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}

.orc-cat-combobox__panel[hidden] {
  display: none !important;
}

.orc-cat-combobox__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.orc-cat-combobox__list li {
  margin: 0;
}

.orc-cat-combobox__list button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
}

.orc-cat-combobox__list button:hover,
.orc-cat-combobox__list button.is-active {
  background: rgba(56, 189, 248, 0.16);
}

.orc-cat-combobox__empty {
  margin: 0;
  padding: 0.55rem 0.6rem;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .orc-modal-grid {
    grid-template-columns: 1fr;
  }
}

.orc-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.orc-modal-actions__btn {
  width: 100%;
  min-height: 2.4rem;
  justify-content: center;
}

@media (max-width: 520px) {
  .orc-modal-actions {
    grid-template-columns: 1fr;
  }
}

.orc-saved .dash-card__head {
  margin-bottom: 0.45rem;
}

.orc-chart__empty {
  fill: rgba(148, 163, 184, 0.55);
  font-size: 12px;
}

.orc-chart__empty[hidden] {
  display: none;
}

.orc-chart {
  min-width: 0;
  padding: 0.35rem 0.2rem 0;
}

.orc-chart svg {
  display: block;
  width: 100%;
  min-height: 220px;
}

.orc-chart__legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 550;
}

.orc-chart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.orc-chart__legend i {
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.orc-chart__legend i.is-budget {
  background: #38bdf8;
}

.orc-chart__legend i.is-actual {
  background: #a78bfa;
}

.orc-chart__empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.orc-bars__label {
  fill: #cbd5e1;
  font-size: 12px;
  font-weight: 550;
}

.orc-bars__bar {
  transition: width 0.25s ease;
}

.orc-bars__bar.is-budget {
  fill: #38bdf8;
}

.orc-bars__bar.is-actual {
  fill: #a78bfa;
}

.orc-bars__value {
  font-size: 11px;
  font-weight: 700;
}

.orc-bars__value.is-budget {
  fill: #7dd3fc;
}

.orc-bars__value.is-actual {
  fill: #c4b5fd;
}

.orc-donut {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(140px, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
}

.orc-donut svg {
  display: block;
  width: 100%;
  max-width: 200px;
  max-height: 12rem;
  margin: 0 auto;
}

.orc-donut__track,
.orc-donut__segment {
  fill: none;
  stroke-width: 22;
}

.orc-donut__track {
  stroke: rgba(148, 163, 184, 0.12);
}

.orc-donut__segment {
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
  transition: stroke-dasharray 0.3s ease;
}

.orc-donut__value {
  fill: #e2e8f0;
  font-size: 14px;
  font-weight: 800;
}

.orc-donut__label {
  fill: var(--muted);
  font-size: 11px;
}

.orc-donut__legend {
  display: grid;
  align-content: center;
  gap: 0.48rem;
  max-height: 100%;
  overflow-y: auto;
}

.orc-donut__legend > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
}

.orc-donut__legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orc-color);
}

.orc-donut__legend span {
  overflow: hidden;
  color: #cbd5e1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orc-donut__legend strong {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.orc-budget__table {
  margin-top: 0;
}

.orc-table__empty td {
  padding: 2rem 1rem !important;
  color: var(--muted);
  text-align: center !important;
}

.orc-table__empty button {
  margin-left: 0.35rem;
  border: 0;
  background: none;
  color: #7dd3fc;
  font: inherit;
  cursor: pointer;
}

.orc-table td:last-child {
  width: 2.5rem;
  text-align: center;
}

.orc-table tfoot td {
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.orc-inp {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: #f1f5f9;
  font: inherit;
  font-size: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.orc-inp--num {
  max-width: 9.5rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.orc-inp--cat {
  min-width: 10rem;
}

/* Orçado que ainda é sugestão da base (nenhum valor definido pelo usuário). */
.orc-inp--sugerido {
  color: var(--muted);
  border-style: dashed;
}

.orc-table__cat {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.orc-table__real {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
  max-width: 9.5rem;
}

.orc-del[disabled] {
  opacity: 0.25;
  cursor: default;
}

.orc-inp:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.28);
}

.orc-inp:focus-visible {
  outline: none;
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
  background: rgba(0, 0, 0, 0.32);
}

.orc-inp[type="number"]::-webkit-inner-spin-button,
.orc-inp[type="number"]::-webkit-outer-spin-button,
.dash-planner-field input[type="number"]::-webkit-inner-spin-button,
.dash-planner-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.orc-inp[type="number"],
.dash-planner-field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.orc-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.08);
  color: rgba(248, 113, 113, 0.9);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.orc-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  color: rgba(125, 211, 252, 0.95);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.orc-edit:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
}

.orc-edit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.orc-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  width: 100%;
}

.orc-table--modal th:last-child,
.orc-table--modal td:last-child {
  width: 5.5rem;
  text-align: right;
}

.orc-del:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.orc-del:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

@media (max-width: 860px) {
  .orc-budget__toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .orc-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .orc-save-status {
    width: 100%;
  }

  .orc-donut {
    grid-template-columns: 1fr;
  }
}

/* ===== Comprador inteligente / Fornecedores ===== */
.dash-grid--buy-radar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 1100px) {
  .dash-grid--buy-radar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .dash-grid--buy-radar {
    grid-template-columns: 1fr;
  }
}

.dash-grid--buy-explain {
  grid-template-columns: minmax(0, 0.3fr) minmax(0, 0.7fr);
}

@media (max-width: 900px) {
  .dash-grid--buy-explain {
    grid-template-columns: 1fr;
  }
}

.buy-sim-modal {
  width: min(1480px, 98vw);
  max-width: min(1480px, 98vw);
  max-height: min(94vh, 980px);
  height: min(94vh, 980px);
  display: flex;
  flex-direction: column;
}

.buy-sim-head {
  position: relative;
  padding-right: 3rem;
  flex: 0 0 auto;
}

.buy-sim-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.45rem;
  line-height: 1;
  color: rgba(226, 232, 240, 0.85);
  background: rgba(148, 163, 184, 0.12);
}

.buy-sim-close:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.22);
}

.buy-sim-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
  min-height: 0;
  flex: 1 1 auto;
}

.buy-sim-detail {
  flex: 0 0 auto;
}

.buy-sim-detail[hidden] {
  display: none !important;
}

.buy-sim-workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(15rem, 1fr) minmax(16rem, 1.15fr);
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.buy-sim-workspace[hidden] {
  display: none !important;
}

.buy-sim-workspace__col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.buy-sim-workspace__col--kpis {
  gap: 0.7rem;
}

.buy-sim-workspace__col--suppliers {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.35);
}

.buy-sim-workspace__col--charts {
  overflow: hidden;
}

.buy-sim-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  flex: 0 1 auto;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.buy-sim-reasons {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(165deg, rgba(14, 116, 144, 0.28), rgba(15, 23, 42, 0.5));
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.buy-sim-reasons__title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f0f9ff;
}

.buy-sim-reasons .buy-explain__reasons {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  color: rgba(226, 232, 240, 0.98);
  font-size: 0.98rem;
  line-height: 1.5;
}

.buy-sim-context {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: auto;
}

.buy-sim-context[hidden] {
  display: none !important;
}

.buy-sim-context__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f0f9ff;
}

.buy-sim-context__best {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
}

.buy-sim-context__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.buy-sim-context__list li {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  font-size: 0.8rem;
}

.buy-sim-context__list li.is-best {
  outline: 1px solid rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.08);
}

.buy-sim-context__sub {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.buy-sim-context__bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 4.5rem;
}

.buy-sim-context__bar {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.buy-sim-context__bar i {
  display: block;
  width: 100%;
  max-width: 1.1rem;
  border-radius: 4px 4px 2px 2px;
  background: rgba(148, 163, 184, 0.55);
}

.buy-sim-context__bar.is-best i {
  background: rgba(74, 222, 128, 0.85);
}

.buy-sim-context__bar span {
  font-size: 0.65rem;
  color: rgba(148, 163, 184, 0.9);
}

.buy-sim-detail__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (max-width: 720px) {
  .buy-sim-detail__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.buy-sim-detail__grid > div,
.buy-sim-metrics > div {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.5rem 0.6rem;
  padding-right: 1.65rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.35);
}

.buy-sim-detail__grid span,
.buy-sim-metrics span {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-sim-detail__grid strong,
.buy-sim-metrics strong {
  font-size: 1.05rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.buy-sim-metrics:empty,
.buy-sim-reasons:empty {
  display: none !important;
}

@media (max-width: 720px) {
  .buy-sim-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.buy-sim-metrics > div {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.35);
}

.buy-sim-metrics strong.is-high { color: #fb7185; }
.buy-sim-metrics strong.is-med { color: #fbbf24; }
.buy-sim-metrics strong.is-low { color: #4ade80; }

.buy-sim-help {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  width: 1.2rem;
  height: 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: rgba(186, 230, 253, 0.95);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.buy-sim-help:hover,
.buy-sim-help:focus-visible,
.buy-sim-help.is-active {
  border-color: rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
  outline: none;
  background: rgba(56, 189, 248, 0.18);
}

.buy-sim-help-tip {
  position: fixed;
  z-index: 80;
  width: min(17.5rem, calc(100vw - 1.5rem));
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.38);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.98), rgba(8, 15, 28, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  color: rgba(226, 232, 240, 0.96);
  font-size: 0.8rem;
  line-height: 1.4;
  pointer-events: auto;
}

.buy-sim-help-tip[hidden] {
  display: none !important;
}

.buy-sim-form {
  display: grid;
  grid-template-columns: minmax(0, 22rem) max-content auto;
  gap: 0.65rem;
  align-items: end;
  justify-content: start;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .buy-sim-form {
    grid-template-columns: 1fr;
  }

  .buy-sim-field--product,
  .buy-sim-field--qty {
    max-width: none;
  }
}

.buy-sim-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.buy-sim-field--product {
  width: min(100%, 22rem);
  max-width: 22rem;
}

.buy-sim-field--qty {
  width: max-content;
  max-width: none;
}

.buy-sim-field--qty > span {
  white-space: nowrap;
}

.buy-sim-field--qty .metas-field__input {
  width: 7.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.buy-sim-combobox__trigger,
.buy-sim-field--qty .metas-field__input,
.buy-sim-suggest-btn {
  box-sizing: border-box;
  height: 2.35rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.2;
}

.buy-sim-suggest-btn {
  white-space: nowrap;
  align-self: end;
  padding-inline: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.buy-sim-field > span {
  font-size: 0.84rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-sim-combobox {
  position: relative;
  z-index: 4;
}

.buy-sim-combobox.is-open {
  z-index: 60;
}

.buy-sim-combobox__trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.buy-sim-combobox__panel {
  position: fixed;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  max-height: min(16rem, 50vh);
  box-sizing: border-box;
}

.buy-sim-combobox__panel[hidden] {
  display: none !important;
}

.buy-sim-combobox__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  max-height: 12rem;
}

.buy-sim-combobox__list li {
  margin: 0;
}

.buy-sim-combobox__list button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.45rem 0.55rem;
  border-radius: 7px;
  cursor: pointer;
}

.buy-sim-combobox__list button:hover,
.buy-sim-combobox__list button.is-active {
  background: rgba(56, 189, 248, 0.16);
}

.buy-sim-vision {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  padding: 0;
  margin: 0;
  border: none;
}

.buy-sim-vision__head,
.buy-sim-vision__run,
.buy-sim-vision__hint {
  display: none !important;
}

.buy-sim-vision__charts {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.1fr) auto;
  gap: 0.55rem;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.buy-sim-vision__charts[hidden] {
  display: none !important;
}

.buy-sim-vision__card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.45rem 0.55rem 0.4rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.4);
}

.buy-sim-vision__card-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
  flex: 0 0 auto;
  padding-right: 0.15rem;
}

.buy-sim-vision__card-head h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: rgba(226, 232, 240, 0.95);
}

.buy-sim-vision__card-head .buy-sim-help {
  position: static;
  flex: 0 0 auto;
}

.buy-sim-chart {
  width: 100%;
  height: auto;
  min-height: 8rem;
  flex: 1 1 auto;
  display: block;
  overflow: visible;
}

.buy-sim-gauges {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1 1 auto;
  min-height: 7.5rem;
  justify-content: center;
  padding: 0.55rem 0.4rem 0.55rem;
}

.buy-sim-gauge {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 0 0 auto;
  min-height: 0;
  padding: 0.15rem 0.1rem;
}

.buy-sim-gauge__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.buy-sim-gauge__head span,
.buy-sim-gauge span {
  font-size: 0.92rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-sim-gauge__track {
  height: 0.9rem;
  min-height: 0.9rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  flex: 0 0 auto;
}

.buy-sim-gauge__fill {
  height: 100%;
  min-height: 0.9rem;
  border-radius: inherit;
  background: #38bdf8;
  transition: width 0.2s ease;
}

.buy-sim-gauge__fill.is-high { background: #fb7185; }
.buy-sim-gauge__fill.is-med { background: #fbbf24; }
.buy-sim-gauge__fill.is-low { background: #4ade80; }

.buy-sim-gauge strong,
.buy-sim-gauge__head strong {
  font-size: 1.05rem;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.buy-sim-gauge__head strong.is-high { color: #fb7185; }
.buy-sim-gauge__head strong.is-med { color: #fbbf24; }
.buy-sim-gauge__head strong.is-low { color: #4ade80; }

.buy-sim-capital,
.buy-sim-scenarios {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 8rem;
  padding: 0.45rem 0.35rem 0.5rem;
  justify-content: center;
}

.buy-sim-capital__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.buy-sim-capital__row span {
  font-size: 0.9rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-sim-capital__row strong {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.buy-sim-capital__row strong.is-cap { color: #7dd3fc; }
.buy-sim-capital__row strong.is-gain { color: #86efac; }

.buy-sim-capital__track {
  height: 0.7rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.buy-sim-capital__fill {
  height: 100%;
  border-radius: inherit;
  background: #38bdf8;
}

.buy-sim-capital__note {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.92);
  line-height: 1.35;
}

.buy-sim-scenarios__legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-sim-scenarios__meta-label {
  color: #fbbf24;
  font-weight: 600;
}

.buy-sim-scenarios__plot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.buy-sim-scenarios__meta {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed rgba(251, 191, 36, 0.85);
  pointer-events: none;
  z-index: 1;
}

.buy-sim-scenarios__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 30%) minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.buy-sim-scenarios__label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.buy-sim-scenarios__label strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: rgba(226, 232, 240, 0.98);
}

.buy-sim-scenarios__label span {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.9);
}

.buy-sim-scenarios__track {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 1.55rem;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.buy-sim-scenarios__bar {
  height: 1.55rem;
  border-radius: 8px;
  min-width: 0.35rem;
}

.buy-sim-scenarios__bar.is-none { background: #f472b6; }
.buy-sim-scenarios__bar.is-sim { background: #38bdf8; }
.buy-sim-scenarios__bar.is-ai { background: #a78bfa; }

.buy-sim-scenarios__value {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.buy-sim-vision__verdict {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(74, 222, 128, 0.28);
  background: rgba(22, 101, 52, 0.22);
  color: #dcfce7;
  font-size: 0.92rem;
  line-height: 1.4;
  align-self: end;
}

.buy-sim-vision__verdict.is-warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(120, 53, 15, 0.28);
  color: #fef3c7;
}

.buy-sim-vision__verdict.is-bad {
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(127, 29, 29, 0.28);
  color: #ffe4e6;
}

@media (max-width: 1280px) {
  .buy-sim-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .buy-sim-workspace__col--charts {
    grid-column: 1 / -1;
  }

  .buy-sim-vision__charts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .buy-sim-vision__verdict {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .buy-sim-workspace {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .buy-sim-workspace__col--charts {
    grid-column: auto;
  }

  .buy-sim-modal__body {
    overflow: auto;
  }

  .buy-sim-vision__charts {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .buy-sim-chart {
    min-height: 9rem;
  }
}

@media (max-width: 800px) {
  .buy-sim-modal {
    height: auto;
    max-height: 94vh;
  }
}

.buy-list-card,
.buy-radar-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.buy-table-paged {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.55rem;
}

.buy-smart-table {
  font-size: 0.78rem;
}

.buy-smart-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.buy-smart-table th,
.buy-smart-table td {
  white-space: nowrap;
  padding: 0.45rem 0.55rem;
}

.buy-sort-th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 0.55rem !important;
  transition: color 0.15s ease, background 0.15s ease;
}

.buy-sort-th:hover,
.buy-sort-th:focus-visible {
  color: #e2e8f0;
  background: rgba(56, 189, 248, 0.1);
  outline: none;
}

.buy-sort-th__label,
.buy-sort-th__icon {
  display: inline;
  vertical-align: middle;
}

.buy-sort-th__icon {
  margin-left: 0.28rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.85);
}

.buy-sort-th__icon::before {
  content: "⇅";
}

.buy-sort-th.is-sorted {
  color: #e2e8f0;
}

.buy-sort-th.is-sorted .buy-sort-th__icon {
  color: #93c5fd;
}

.buy-sort-th.is-asc .buy-sort-th__icon::before { content: "▲"; }
.buy-sort-th.is-desc .buy-sort-th__icon::before { content: "▼"; }

.buy-smart-table td:nth-child(3) {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.buy-smart-row {
  cursor: pointer;
}

.buy-smart-row.is-active {
  background: rgba(99, 102, 241, 0.12);
}

.buy-smart-motivo {
  color: rgba(148, 163, 184, 0.95);
  white-space: nowrap;
}

.buy-sem {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  vertical-align: middle;
}

.buy-sem.is-critical { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18); }
.buy-sem.is-warn { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16); }
.buy-sem.is-ok { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16); }
.buy-sem.is-excess { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16); }

.buy-radar-card {
  min-height: 11rem;
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.buy-radar-card .dash-card__head {
  justify-content: flex-start;
  align-items: center;
  gap: 0.35rem;
  padding-right: 7.25rem; /* espaço para ícones do customizer */
  flex-wrap: nowrap;
  margin-bottom: 0.45rem;
}

.buy-radar-card .dash-card__title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.buy-radar-card .dash-card__title-with-info {
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.35rem;
}

.buy-radar-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-height: 1.55rem;
  padding: 0.18rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: rgba(226, 232, 240, 0.98);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  position: relative;
  z-index: 6;
}

.buy-radar-expand:hover {
  border-color: rgba(125, 211, 252, 0.7);
  background: rgba(30, 41, 59, 0.9);
  color: #e0f2fe;
}

.buy-radar-expand:active {
  transform: scale(0.97);
}

.buy-radar-card.is-critical { border-color: rgba(248, 113, 113, 0.28); }
.buy-radar-card.is-warn { border-color: rgba(251, 191, 36, 0.28); }
.buy-radar-card.is-ok { border-color: rgba(74, 222, 128, 0.28); }
.buy-radar-card.is-excess { border-color: rgba(148, 163, 184, 0.28); }

.buy-radar-card.has-data.is-critical {
  border-color: rgba(248, 113, 113, 0.85);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.35),
    0 0 14px rgba(239, 68, 68, 0.45),
    0 0 32px rgba(239, 68, 68, 0.22);
  animation: buy-neon-critical 2.4s ease-in-out infinite;
}

.buy-radar-card.has-data.is-warn {
  border-color: rgba(251, 191, 36, 0.9);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.35),
    0 0 14px rgba(245, 158, 11, 0.4),
    0 0 32px rgba(245, 158, 11, 0.2);
  animation: buy-neon-warn 2.4s ease-in-out infinite;
}

.buy-radar-card.has-data.is-ok {
  border-color: rgba(74, 222, 128, 0.9);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.35),
    0 0 14px rgba(34, 197, 94, 0.4),
    0 0 32px rgba(34, 197, 94, 0.2);
  animation: buy-neon-ok 2.4s ease-in-out infinite;
}

.buy-radar-card.has-data.is-excess {
  border-color: rgba(148, 163, 184, 0.9);
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.35),
    0 0 14px rgba(100, 116, 139, 0.45),
    0 0 32px rgba(100, 116, 139, 0.22);
  animation: buy-neon-excess 2.4s ease-in-out infinite;
}

@keyframes buy-neon-critical {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(248, 113, 113, 0.35),
      0 0 12px rgba(239, 68, 68, 0.35),
      0 0 26px rgba(239, 68, 68, 0.16);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(248, 113, 113, 0.7),
      0 0 18px rgba(239, 68, 68, 0.55),
      0 0 38px rgba(239, 68, 68, 0.28);
  }
}

@keyframes buy-neon-warn {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(251, 191, 36, 0.3),
      0 0 12px rgba(245, 158, 11, 0.32),
      0 0 26px rgba(245, 158, 11, 0.14);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(251, 191, 36, 0.7),
      0 0 18px rgba(245, 158, 11, 0.5),
      0 0 38px rgba(245, 158, 11, 0.26);
  }
}

@keyframes buy-neon-ok {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(74, 222, 128, 0.3),
      0 0 12px rgba(34, 197, 94, 0.32),
      0 0 26px rgba(34, 197, 94, 0.14);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(74, 222, 128, 0.7),
      0 0 18px rgba(34, 197, 94, 0.5),
      0 0 38px rgba(34, 197, 94, 0.26);
  }
}

@keyframes buy-neon-excess {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(148, 163, 184, 0.3),
      0 0 12px rgba(100, 116, 139, 0.35),
      0 0 26px rgba(100, 116, 139, 0.16);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(148, 163, 184, 0.7),
      0 0 18px rgba(100, 116, 139, 0.55),
      0 0 38px rgba(100, 116, 139, 0.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .buy-radar-card.has-data.is-critical,
  .buy-radar-card.has-data.is-warn,
  .buy-radar-card.has-data.is-ok,
  .buy-radar-card.has-data.is-excess {
    animation: none;
  }
}

.buy-radar-detail-modal {
  width: min(1280px, 96vw);
  max-width: min(1280px, 96vw);
  height: min(90vh, 900px);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
}

#buy-radar-detail-overlay.modal-overlay {
  z-index: 2400;
  align-items: center;
}

.buy-radar-detail-modal .modal__body {
  overflow: hidden;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.buy-radar-detail-wrap {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.buy-radar-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.buy-radar-detail-pager {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.buy-radar-detail-pager[hidden] {
  display: none !important;
}

.buy-radar-detail-table {
  font-size: 0.8rem;
  width: 100%;
}

.buy-radar-detail-table th,
.buy-radar-detail-table td {
  white-space: nowrap;
  padding: 0.45rem 0.55rem;
}

.buy-radar-detail-table tbody tr {
  cursor: pointer;
}

.buy-radar-detail-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.1);
}

.buy-radar-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.buy-radar-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.buy-radar-list strong {
  overflow: hidden;
  color: rgba(226, 232, 240, 0.96);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.buy-radar-list span {
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.78rem;
}

.buy-trend-grain {
  margin-left: auto;
  margin-right: 0.35rem;
}

.buy-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 0.15rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
}

.buy-trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.buy-trend-legend i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
}

.buy-trend-legend i.is-hist { background: #38bdf8; }
.buy-trend-legend i.is-ma { background: #a78bfa; }
.buy-trend-legend i.is-ml { background: #f472b6; }

[data-card-id="buy-chart-tendencia"][data-buy-trend-grain="day"] .buy-trend-legend__month-only {
  display: none;
}

[data-card-id="buy-chart-tendencia"].dash-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 24rem;
  padding: 0.7rem 0.8rem 0.55rem;
}

[data-card-id="buy-chart-tendencia"] .dash-card__head,
[data-card-id="buy-chart-tendencia"] .buy-trend-legend {
  flex: 0 0 auto;
}

[data-card-id="buy-chart-tendencia"] .dash-chart-placeholder {
  flex: 1 1 auto;
  min-height: 18rem;
  display: flex;
  align-items: stretch;
  margin-top: 0.2rem;
  padding: 0.3rem 0.25rem;
}

[data-card-id="buy-chart-tendencia"] .dash-svg-chart {
  width: 100%;
  height: 100%;
  min-height: 18rem;
  flex: 1 1 auto;
  display: block;
}

.dash-grid--2:has([data-card-id="buy-chart-tendencia"]) {
  align-items: stretch;
}

.buy-season-calendar {
  min-height: 12rem;
}

.buy-season-calendar .dash-calendar-heat__summary {
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.buy-season-day-modal {
  width: min(1100px, 94vw);
  max-width: min(1100px, 94vw);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
}

.buy-season-day-head {
  position: relative;
  align-items: flex-start;
  padding-right: 3rem;
}

.buy-season-day-head .modal__title-group {
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  flex: 1 1 auto;
}

.buy-season-day-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.45rem;
  line-height: 1;
  color: rgba(226, 232, 240, 0.85);
  background: rgba(148, 163, 184, 0.12);
}

.buy-season-day-close:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.22);
}

.buy-season-day-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  overflow: hidden;
}

.buy-season-day-metrics {
  display: block;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.buy-season-day-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.buy-season-day-kpis > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.35);
}

.buy-season-day-kpis span {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.95);
}

.buy-season-day-kpis strong {
  font-size: 1.05rem;
  font-weight: 650;
  color: #e2e8f0;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.buy-season-day-table-wrap {
  flex: 1 1 auto;
  min-height: 12rem;
  max-height: 28rem;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
}

.buy-season-day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.buy-season-day-table th,
.buy-season-day-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  white-space: nowrap;
}

.buy-season-day-table th:first-child,
.buy-season-day-table td:first-child {
  white-space: normal;
  max-width: none;
  width: 55%;
}

.buy-season-day-table th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.96);
  color: rgba(148, 163, 184, 0.95);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 1;
}

.buy-season-day-table td {
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.buy-season-day-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

.buy-season-day-table th:nth-child(2),
.buy-season-day-table th:nth-child(3),
.buy-season-day-table th:nth-child(4),
.buy-season-day-table td:nth-child(2),
.buy-season-day-table td:nth-child(3),
.buy-season-day-table td:nth-child(4) {
  text-align: right;
}

.buy-season-day-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
}

.buy-season-day-pager {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(203, 213, 225, 0.95);
}

.buy-season-day-pager[hidden] {
  display: none !important;
}

.buy-season-day-pager .dash-table-paged__btn {
  font-size: 0.84rem;
  font-weight: 550;
  padding: 0.35rem 0.7rem;
}

.buy-season-day-pager #buy-season-day-info {
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.92);
  min-width: 11rem;
  text-align: center;
}

@media (max-width: 720px) {
  .buy-season-day-modal {
    width: min(96vw, 1100px);
  }

  .buy-season-day-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .buy-season-day-table-wrap {
    max-height: 16rem;
  }
}

.buy-season-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
}

.buy-season-cell {
  position: relative;
  min-height: 3.2rem;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.35);
}

.buy-season-cell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--w, 40%);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.55), rgba(99, 102, 241, 0.35));
}

.buy-season-cell span {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0.4rem 0.45rem;
  color: rgba(226, 232, 240, 0.95);
  font-size: 0.78rem;
  font-weight: 650;
}

.buy-explain__suggest {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.96);
}

.buy-explain__reasons {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: rgba(203, 213, 225, 0.95);
  font-size: 0.84rem;
  line-height: 1.35;
}

.forn-reco {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 100%;
}

.forn-reco__empty {
  margin: 0;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.88rem;
}

.forn-reco__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.forn-reco__kicker {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.forn-reco__score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 750;
  color: rgba(226, 232, 240, 0.98);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.45), rgba(56, 189, 248, 0.28));
  border: 1px solid rgba(129, 140, 248, 0.35);
}

.forn-reco__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: rgba(248, 250, 252, 0.98);
  word-break: break-word;
}

.forn-reco__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.forn-reco__metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.35);
}

.forn-reco__m-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.92);
}

.forn-reco__metric strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.96);
  line-height: 1.2;
}

.forn-reco__metric strong.is-up {
  color: rgba(74, 222, 128, 0.95);
}

.forn-reco__metric strong.is-down {
  color: rgba(248, 113, 113, 0.95);
}

.forn-reco__foot {
  margin: 0;
  margin-top: auto;
  padding-top: 0.15rem;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.95);
  line-height: 1.35;
}

.forn-scenarios {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  align-content: start;
}

@media (max-width: 1100px) {
  .forn-scenarios {
    grid-template-columns: 1fr;
  }
}

.forn-scenario {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.28);
  min-width: 0;
}

.forn-scenario h4 {
  margin: 0 0 0.2rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.96);
}

.forn-scenario p {
  margin: 0 0 0.35rem;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.78rem;
}

.forn-scenario strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forn-scenario span {
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.78rem;
}

.dash-svg-point-label {
  fill: rgba(226, 232, 240, 0.92);
  font-size: 9.5px;
  font-weight: 600;
  pointer-events: none;
}

html[data-login-theme="light"] body.page-portal .dash-svg-point-label {
  fill: #334155;
}

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

html[data-login-theme="light"] body.page-portal .forn-reco__metric {
  background: rgba(248, 250, 252, 0.85);
  border-color: rgba(15, 23, 42, 0.08);
}

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

/* ===== Sugestão de compras: visão consolidada ===== */
.dash-grid--sug-overview {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
}

.dash-grid--sug-analysis {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.7fr);
  align-items: stretch;
}

[data-card-id="sug-chart-prioridade"].dash-card {
  display: flex;
  flex-direction: column;
  min-height: 26rem;
  padding: 0.7rem 0.75rem 0.55rem;
}

[data-card-id="sug-chart-prioridade"] .dash-card__head {
  flex: 0 0 auto;
  margin-bottom: 0.25rem;
}

.sug-priority-matrix {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  margin: 0 -0.1rem;
}

.sug-priority-matrix svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 22rem;
  flex: 1 1 auto;
}

.sug-kpi__product {
  overflow: hidden;
  font-size: clamp(0.82rem, 1.15vw, 1.05rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-demand-donut {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(130px, 1fr);
  align-items: center;
  gap: 0.65rem;
  min-height: 250px;
}

.sug-demand-donut svg {
  display: block;
  width: 100%;
  max-width: 230px;
  margin: 0 auto;
}

.sug-demand-donut__track,
.sug-demand-donut__segment {
  fill: none;
  stroke-width: 22;
}

.sug-demand-donut__track {
  stroke: rgba(148, 163, 184, 0.12);
}

.sug-demand-donut__segment {
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
}

.sug-demand-donut__value {
  fill: #e2e8f0;
  font-size: 1rem;
  font-weight: 800;
}

.sug-demand-donut__label {
  fill: var(--muted);
  font-size: 0.65rem;
}

.sug-demand-donut__legend {
  display: grid;
  align-content: center;
  gap: 0.48rem;
}

.sug-demand-donut__legend > div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.67rem;
}

.sug-demand-donut__legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sug-color);
}

.sug-demand-donut__legend span {
  overflow: hidden;
  color: #cbd5e1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-demand-donut__legend strong {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sug-priority-matrix__zone {
  stroke: rgba(148, 163, 184, 0.08);
  stroke-width: 1;
}

.sug-priority-matrix__zone.is-priority {
  fill: rgba(244, 63, 94, 0.08);
}

.sug-priority-matrix__zone.is-watch {
  fill: rgba(251, 191, 36, 0.055);
}

.sug-priority-matrix__zone.is-volume {
  fill: rgba(56, 189, 248, 0.055);
}

.sug-priority-matrix__zone.is-low {
  fill: rgba(148, 163, 184, 0.025);
}

.sug-priority-matrix__axis {
  stroke: rgba(148, 163, 184, 0.38);
  stroke-width: 1;
}

.sug-priority-matrix__axis-label,
.sug-priority-matrix__zone-label,
.sug-priority-matrix__empty {
  fill: var(--muted);
  font-size: 0.65rem;
}

.sug-priority-matrix__zone-label {
  fill: #fda4af;
  font-weight: 700;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(15, 23, 42, 0.72);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.sug-priority-matrix__zone-label.is-watch {
  fill: #fcd34d;
}

.sug-priority-matrix__zone-label.is-muted {
  fill: rgba(148, 163, 184, 0.72);
  font-weight: 600;
}

.sug-priority-matrix__point {
  stroke: rgba(15, 23, 42, 0.9);
  stroke-width: 2;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.22));
  pointer-events: none;
}

.sug-priority-matrix__hit {
  pointer-events: all;
}

.sug-priority-matrix__point-label {
  display: none;
}

.dash-chart-tooltip__extra {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: rgba(186, 230, 253, 0.92);
  line-height: 1.35;
  white-space: normal;
}

.sug-action-table td:first-child {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-priority-pill {
  display: inline-flex;
  padding: 0.2rem 0.46rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
}

.sug-priority-pill.is-high {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
}

.sug-priority-pill.is-medium {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.11);
  color: #fcd34d;
}

.sug-priority-pill.is-low {
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.09);
  color: #7dd3fc;
}

@media (max-width: 980px) {
  .dash-grid--sug-overview,
  .dash-grid--sug-analysis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sug-demand-donut {
    grid-template-columns: 1fr;
  }
}

/* ===== Limite de compras: filtros e acompanhamento ===== */
.lim-filter-bar {
  padding: 0.75rem 0.9rem;
}

.lim-filter-bar__form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(160px, 0.7fr) minmax(150px, 0.65fr) auto;
  align-items: end;
  gap: 0.7rem;
}

.lim-filter-field {
  display: grid;
  gap: 0.3rem;
}

.lim-filter-field > span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lim-filter-field > div {
  display: flex;
  align-items: center;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.45);
}

.lim-filter-field i {
  padding: 0 0.62rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.lim-filter-field input,
.lim-filter-field select {
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 9px;
  outline: none;
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.lim-filter-field > div input {
  min-height: 36px;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.lim-filter-field input:focus,
.lim-filter-field select:focus,
.lim-filter-field > div:focus-within {
  border-color: rgba(56, 189, 248, 0.48);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.lim-filter-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.lim-filter-bar__actions [role="status"] {
  width: 100%;
  color: var(--muted);
  font-size: 0.66rem;
  text-align: right;
}

.lim-filter-bar__actions [role="status"].is-ok {
  color: #4ade80;
}

.lim-filter-bar__actions [role="status"].is-warn {
  color: #fbbf24;
}

.lim-kpis {
  margin-bottom: 0.85rem;
}

.lim-calendar-card {
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lim-bottom-grid {
  grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); /* 30% / 70% */
  align-items: stretch;
}

.lim-bottom-grid > .dash-card {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

/* Na coluna estreita (30%), empilha velocímetro e detalhes */
.lim-bottom-grid .lim-usage {
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.lim-usage-card .lim-usage {
  flex: 1 1 auto;
  min-height: 0;
}

.lim-usage {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(160px, 1.15fr);
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 0.15rem;
}

.lim-usage__meter {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 0;
  padding: 0.15rem 0.2rem 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.lim-usage svg {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
}

.lim-usage__track,
.lim-usage__progress {
  fill: none;
  stroke-linecap: round;
  stroke-width: 16;
}

.lim-usage__track {
  stroke: rgba(148, 163, 184, 0.13);
}

.lim-usage__progress {
  stroke: #38bdf8;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.4s ease, stroke 0.2s ease;
}

.lim-usage-card.is-warn .lim-usage__progress {
  stroke: #fbbf24;
}

.lim-usage-card.is-over .lim-usage__progress {
  stroke: #fb7185;
}

.lim-usage__needle {
  transform: rotate(-90deg);
  transform-origin: 110px 108px;
  transition: transform 0.4s ease;
}

.lim-usage__needle line {
  stroke: #e2e8f0;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.lim-usage__pivot {
  fill: #0f172a;
  stroke: #e2e8f0;
  stroke-width: 2.5;
}

.lim-usage__value {
  fill: #e2e8f0;
  font-size: 1.15rem;
  font-weight: 800;
}

.lim-usage__tick {
  fill: var(--muted);
  font-size: 0.58rem;
}

.lim-usage__details {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  min-height: 0;
  height: 100%;
}

.lim-usage__details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.34);
}

.lim-usage__details span {
  color: var(--muted);
  font-size: 0.68rem;
}

.lim-usage__details strong {
  color: var(--text);
  font-size: 0.76rem;
}

[data-card-id="lim-chart-pagamento-cal"] .dash-calendar-heat {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.15rem;
}

/* Receita × Pagamento: preenche o card (largura total), altura controlada */
[data-card-id="lim-chart-receita-pagamento"].dash-card--chart {
  display: flex;
  flex-direction: column;
}

[data-card-id="lim-chart-receita-pagamento"] .dash-chart-placeholder {
  flex: 1 1 auto;
  margin-top: 0.25rem;
  min-height: 12.5rem;
  height: 12.5rem;
  display: flex;
  align-items: stretch;
}

[data-card-id="lim-chart-receita-pagamento"] .dash-svg-chart {
  width: 100%;
  height: 100%;
  min-height: 12.5rem;
  flex: 1 1 auto;
  display: block;
}

[data-card-id="lim-chart-receita-pagamento"] .dash-svg-legend-text {
  font-size: 9px;
}

[data-card-id="lim-chart-receita-pagamento"] .dash-svg-axis {
  font-size: 9px;
}

[data-card-id="lim-chart-receita-pagamento"] .dash-svg-bar-label,
[data-card-id="lim-chart-receita-pagamento"] .dash-svg-combo-label {
  font-size: 8px;
  font-weight: 600;
}

.lim-config-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

.lim-config-modal .modal__head {
  flex: 0 0 auto;
}

.lim-config-modal .modal__body {
  min-height: 0;
  padding: 1.1rem 1.25rem;
  overflow-y: auto;
}

.lim-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.lim-config-modal .metas-field__suffix {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.lim-config-modal .metas-field__input-wrap:has(.metas-field__suffix) .metas-field__input {
  padding-right: 2rem;
}

.lim-saved {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.lim-saved__table {
  margin-top: 0.65rem;
}

.lim-saved__table tr.is-active td {
  background: rgba(168, 85, 247, 0.08);
}

.lim-saved__edit {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-transform: capitalize;
  cursor: pointer;
}

.lim-saved__edit:hover {
  color: #c084fc;
}

.lim-config-modal__foot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: var(--surface);
}

.lim-config-modal__foot [role="status"] {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.lim-config-modal__foot [role="status"].is-ok {
  color: #4ade80;
}

.lim-config-modal__foot [role="status"].is-warn {
  color: #fbbf24;
}

@media (max-width: 980px) {
  .lim-filter-bar__form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lim-filter-bar__actions {
    justify-content: flex-start;
  }

  .lim-filter-bar__actions [role="status"] {
    text-align: left;
  }

  .lim-bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .lim-filter-bar__form,
  .lim-modal-grid,
  .lim-usage {
    grid-template-columns: 1fr;
  }

  .lim-config-modal__foot {
    flex-wrap: wrap;
    padding: 0.8rem 1rem;
  }

  .lim-config-modal__foot [role="status"] {
    width: 100%;
  }

  .lim-config-modal__foot .btn {
    flex: 1 1 0;
  }
}

.dash-seg__btn--accent {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.dash-seg__btn--accent:hover {
  background: rgba(56, 189, 248, 0.28);
  color: #f8fafc;
}

.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;
  /* Sub-páginas densas (ex.: Produtos) passam da viewport; sem isto o
     pai `.analytics-views { overflow: hidden }` corta o último card
     (Lista de Produtos) sem permitir rolar. Faturamento continua cabendo
     via flex interno e não gera barra. */
  overflow-x: hidden;
  overflow-y: auto;
}

.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 > [data-card-id="cmcl-chart-regiao"] .dash-geomap__svg {
  max-height: 100%;
  height: 100%;
}

.analytics-stage--fullscreen [data-absorbed="faturamento"] .dash-grid--faturamento-charts .ml2__svg {
  max-height: none;
}

/* ================================================================
 * Fullscreen — Comercial · Clientes / Produtos (listas paginadas).
 *
 * Ao contrário de Faturamento, estes blocos têm muito conteúdo acima da
 * lista ranqueada. A Lista de Clientes/Produtos precisa altura mínima
 * para 5+5 itens + paginador; o scroll fica na view ativa (acima).
 * ================================================================ */
.analytics-stage--fullscreen [data-absorbed="clientes"],
.analytics-stage--fullscreen [data-absorbed="produtos"] {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 0 0 auto;
  min-height: min-content;
  padding-bottom: 0.35rem;
}

.analytics-stage--fullscreen [data-absorbed="clientes"] > .dash-kpi-row,
.analytics-stage--fullscreen [data-absorbed="clientes"] > .dash-grid,
.analytics-stage--fullscreen [data-absorbed="produtos"] > .dash-kpi-row,
.analytics-stage--fullscreen [data-absorbed="produtos"] > .dash-grid {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.analytics-stage--fullscreen [data-absorbed="clientes"] > .dash-card--wide,
.analytics-stage--fullscreen [data-absorbed="produtos"] > .dash-card--wide {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

/* Altura mínima: ~5 linhas por coluna + paginador (como Lista de Clientes). */
.analytics-stage--fullscreen [data-absorbed="clientes"] .dash-rank-paged,
.analytics-stage--fullscreen [data-absorbed="produtos"] .dash-rank-paged {
  flex: 0 0 auto;
  min-height: 15.5rem;
}

.analytics-stage--fullscreen [data-absorbed="clientes"] .dash-rank-paged__cols,
.analytics-stage--fullscreen [data-absorbed="produtos"] .dash-rank-paged__cols {
  flex: 0 0 auto;
}

.analytics-stage--fullscreen [data-absorbed="clientes"] .dash-rank-paged__pager,
.analytics-stage--fullscreen [data-absorbed="produtos"] .dash-rank-paged__pager {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

/* ================================================================
 * 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%;
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    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;
  color-scheme: light;
}

html[data-login-theme="light"] body.page-portal .analytics-select option {
  background-color: #ffffff;
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .analytics-select option:checked,
html[data-login-theme="light"] body.page-portal .analytics-select option:hover {
  background-color: #dbeafe;
  color: #0f172a;
}

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-card--dre .dash-dre thead th {
  background: rgba(255, 255, 255, 0.96);
}

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--target {
  border-color: rgba(18, 40, 63, 0.1);
  background: rgba(255, 255, 255, 0.92);
}

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;
}

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

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

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

html[data-login-theme="light"] body.page-portal .dash-ml-side-kpi--hero {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.05));
}

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

html[data-login-theme="light"] body.page-portal .dash-ml-side-kpi--hero .dash-ml-side-kpi__v {
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .dash-ml-side-kpi__v--signal {
  color: #15803d;
}

html[data-login-theme="light"] body.page-portal .dash-ml-side-kpi__hint,
html[data-login-theme="light"] body.page-portal .dash-ml-side-kpi__k {
  color: #64748b;
}

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

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

html[data-login-theme="light"] body.page-portal .dash-ml-chip--accent {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.06);
}

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

/* 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-color: #0f172a;
  color: #e2e8f0;
  color-scheme: dark;
  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: #0f172a;
  color: #e2e8f0;
}

select.metas-field__input option:checked,
select.metas-field__input option:hover {
  background-color: #1d4ed8;
  color: #f8fafc;
}

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-config__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--border);
}

.metas-config__save-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.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;
}

.chart-config-lineage {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.15rem 0.1rem 0.5rem;
}

.chart-config-lineage__feed {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(186, 230, 253, 0.95);
}

.chart-config-lineage__uses {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chart-config-lineage__note {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.chart-config-lineage__table {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
}

.chart-config-lineage__table h4 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 650;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}

.chart-config-lineage__table ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chart-config-lineage__table li {
  display: grid;
  grid-template-columns: minmax(10rem, max-content) 1fr;
  gap: 0.45rem 0.75rem;
  align-items: start;
  font-size: 0.84rem;
  line-height: 1.35;
}

.chart-config-lineage__table code {
  font-size: 0.82rem;
  color: rgba(167, 139, 250, 0.95);
}

html[data-login-theme="light"] body.page-portal .chart-config-lineage__feed {
  color: #0369a1;
}

html[data-login-theme="light"] body.page-portal .chart-config-lineage__table code {
  color: #6d28d9;
}

.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-filters__btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.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-filters__btns {
    flex: 1 1 100%;
    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;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.58rem 0.68rem;
  border-radius: 10px;
  cursor: default;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.sync-row__check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.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__load {
  margin-left: 1.8rem;
  padding: 0.4rem 0.55rem 0.45rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sync-row__load[hidden] {
  display: none;
}

.sync-row__load-label {
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.sync-row__load-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  min-height: 2rem;
}

.sync-row__load-select,
.sync-row__load-mode select {
  min-width: 8.5rem;
}

.sync-row__inc-btn,
.sync-row__count-btn {
  flex: 0 0 auto;
  height: 2rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.7rem;
  font-size: 0.8rem;
  line-height: 1;
  margin: 0;
}

.sync-row__rowcount {
  flex: 0 1 auto;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.sync-row__rowcount--ok {
  color: #86efac;
  font-variant-numeric: tabular-nums;
}

.sync-row__rowcount--err {
  color: #fca5a5;
}

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

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

.sync-row__inc-btn--warn {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
}

.sync-row__inc-summary {
  flex: 1 1 10rem;
  font-size: 0.75rem;
  line-height: 1.25;
  min-width: 0;
  align-self: center;
}

.modal-overlay--nested {
  z-index: 1200;
  background: rgba(2, 6, 23, 0.72);
}

.modal--table-inc {
  width: min(860px, calc(100vw - 1.5rem));
  max-height: min(94vh, 920px);
}

.modal--table-inc .modal__body {
  padding-bottom: 0.5rem;
}

.table-inc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}

.table-inc-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 0;
}

.table-inc-form__field--wide {
  grid-column: 1 / -1;
}

.table-inc-form__hint {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0.1rem 0 0;
}

.table-inc-form__field .cq-combo,
.table-inc-form__field .cq-card__select {
  text-transform: none;
  letter-spacing: 0;
}

.table-inc-form__field.is-lookback-disabled .cq-combo__btn,
.table-inc-form__field.is-lookback-disabled .cq-card__select {
  opacity: 0.55;
  pointer-events: none;
}

.table-inc-form__keys {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.table-inc-form__keys[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .table-inc-form {
    grid-template-columns: 1fr;
  }
}

html[data-login-theme="light"] body.page-portal .sync-row__inc-btn--warn {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.35);
}

html[data-login-theme="light"] body.page-portal .modal-overlay--nested {
  background: rgba(15, 23, 42, 0.45);
}

.sync-row__load-mode select,
.sync-row__load-select,
.sync-row__inc select,
.cq-card__select {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background-color: #0f172a;
  background-image: none;
  color: #e2e8f0;
  color-scheme: dark;
}

.sync-row__load-mode select option,
.sync-row__load-select option,
.sync-row__inc select option,
.cq-card__select option {
  background-color: #0f172a;
  color: #e2e8f0;
}

.sync-row__load-mode select option:checked,
.sync-row__load-select option:checked,
.sync-row__inc select option:checked,
.cq-card__select option:checked,
.sync-row__load-mode select option:hover,
.sync-row__load-select option:hover,
.sync-row__inc select option:hover,
.cq-card__select option:hover {
  background-color: #1d4ed8;
  color: #f8fafc;
}

.sync-row__load-select:focus,
.sync-row__load-mode select:focus,
.sync-row__inc select:focus,
.cq-card__select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.sync-row__load-select {
  height: 2rem;
  box-sizing: border-box;
  padding: 0 1.6rem 0 0.5rem;
  line-height: 1.2;
  min-width: 8.5rem;
}

.sync-row__inc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem 0.75rem;
}

.sync-row__inc[hidden] {
  display: none;
}

.sync-row__inc > label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sync-row__inc-keys {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sync-row__inc-keys[hidden] {
  display: none;
}

.sync-row__inc-keys-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sync-row__inc-keys-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.sync-inc__key {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  color: #cbd5e1;
  cursor: pointer;
}

.sync-custom__load {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.45rem;
}

.sync-custom__load-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1.1rem;
}

.sync-custom__load-mode {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 220px;
}

.sync-custom__load-hint {
  margin: 0;
  flex: 1 1 220px;
  font-size: 0.8rem;
  line-height: 1.35;
  align-self: center;
}

.sync-custom__inc {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 0.9rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.28);
}

@media (min-width: 900px) {
  .sync-custom__inc {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.sync-custom__inc[hidden] {
  display: none;
}

.sync-custom__inc > label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.sync-custom__since-hint,
.sync-custom__since-warn {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
}

.sync-custom__since-hint code,
.sync-custom__since-warn code {
  font-size: 0.85em;
}

.sync-custom__since-warn {
  color: #fbbf24;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.sync-custom__since-warn[hidden] {
  display: none;
}

.sync-custom__src-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.25rem;
}

.sync-custom__src-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sync-custom__src-filters-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sync-custom__src-filters-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sync-custom__src-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: end;
}

.sync-custom__src-row label {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.78);
}

.sync-custom__src-tables-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.cq-combo {
  position: relative;
  min-width: 0;
  width: 100%;
}

.cq-combo__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.cq-combo__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  padding: 0.28rem 1.7rem 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%94a3b8' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}

.cq-combo__btn.is-placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.cq-combo__btn:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.cq-combo.is-open .cq-combo__btn {
  border-color: rgba(96, 165, 250, 0.55);
}

.cq-combo__panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.cq-combo__panel[hidden] {
  display: none !important;
}

.cq-combo__q {
  width: 100%;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.32rem 0.5rem;
  outline: none;
  flex: 0 0 auto;
}

.cq-combo__q::placeholder {
  color: rgba(148, 163, 184, 0.75);
}

.cq-combo__q:focus {
  border-color: rgba(96, 165, 250, 0.55);
}

.cq-combo__list {
  overflow: auto;
  max-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cq-combo__option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
}

.cq-combo__option:hover,
.cq-combo__option:focus {
  background: rgba(59, 130, 246, 0.22);
  outline: none;
}

.cq-combo__option.is-selected {
  background: rgba(59, 130, 246, 0.28);
}

.cq-combo__option.is-empty {
  color: rgba(148, 163, 184, 0.9);
}

.cq-combo__empty {
  padding: 0.45rem;
  font-size: 0.78rem;
  color: rgba(148, 163, 184, 0.85);
}

html[data-login-theme="light"] body.page-portal .cq-combo__btn {
  background-color: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%64748b' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
}

html[data-login-theme="light"] body.page-portal .cq-combo__btn.is-placeholder {
  color: rgba(100, 116, 139, 0.9);
}

html[data-login-theme="light"] body.page-portal .cq-combo__panel {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

html[data-login-theme="light"] body.page-portal .cq-combo__q {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
}

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

html[data-login-theme="light"] body.page-portal .cq-combo__option:hover,
html[data-login-theme="light"] body.page-portal .cq-combo__option:focus,
html[data-login-theme="light"] body.page-portal .cq-combo__option.is-selected {
  background: rgba(37, 99, 235, 0.1);
}

.sync-custom__lookback-hint[hidden] {
  display: none;
}

.sync-custom__inc-keys {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sync-custom__inc-keys[hidden] {
  display: none;
}

.cq-list-item__mode {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  vertical-align: middle;
}

.cq-list-item__mode--inc {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.18);
}

html[data-login-theme="light"] body.page-portal .sync-row__load {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-login-theme="light"] body.page-portal .sync-row__load-mode select,
html[data-login-theme="light"] body.page-portal .sync-row__load-select,
html[data-login-theme="light"] body.page-portal .sync-row__inc select,
html[data-login-theme="light"] body.page-portal .cq-card__select {
  background-color: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
  color-scheme: light;
}

html[data-login-theme="light"] body.page-portal .sync-row__load-mode select option,
html[data-login-theme="light"] body.page-portal .sync-row__load-select option,
html[data-login-theme="light"] body.page-portal .sync-row__inc select option,
html[data-login-theme="light"] body.page-portal .cq-card__select option {
  background-color: #fff;
  color: #0f172a;
}

html[data-login-theme="light"] body.page-portal .sync-row__load-mode select option:checked,
html[data-login-theme="light"] body.page-portal .sync-row__load-select option:checked,
html[data-login-theme="light"] body.page-portal .sync-row__inc select option:checked,
html[data-login-theme="light"] body.page-portal .cq-card__select option:checked,
html[data-login-theme="light"] body.page-portal .sync-row__load-mode select option:hover,
html[data-login-theme="light"] body.page-portal .sync-row__load-select option:hover,
html[data-login-theme="light"] body.page-portal .sync-row__inc select option:hover,
html[data-login-theme="light"] body.page-portal .cq-card__select option:hover {
  background-color: #dbeafe;
  color: #0f172a;
}

.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;
  /* Altura fixa: filtrar tabelas/views não pode encolher o modal. */
  height: min(90vh, calc(100vh - 2.5rem));
  height: min(90dvh, calc(100svh - 2.5rem));
  min-height: min(90vh, calc(100vh - 2.5rem));
  min-height: min(90dvh, calc(100svh - 2.5rem));
  max-height: min(90vh, calc(100vh - 2.5rem));
  max-height: min(90dvh, calc(100svh - 2.5rem));
}

/* 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 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.views-body {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  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 8px;
}

.views-side__search {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font-size: 0.86rem;
}

.views-side__search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.views-side__search:focus {
  outline: none;
  border-color: rgba(120, 168, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(120, 168, 255, 0.15);
}

.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;
  }
  .mapping-modal.views-modal {
    height: min(92vh, calc(100vh - 1.5rem));
    height: min(92dvh, calc(100svh - 1.5rem));
    min-height: min(92vh, calc(100vh - 1.5rem));
    min-height: min(92dvh, calc(100svh - 1.5rem));
  }
  .views-side--tables {
    border-right: 0;
    border-bottom: 1px solid var(--modal-divider, rgba(255, 255, 255, 0.08));
    min-height: 220px;
  }
  .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));
    min-height: 180px;
  }
}

/* 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 — mesma paleta do cq-combo */
.views-modal .analytics-select,
.views-builder .analytics-select,
.views-modal select:not(.views-mode-btn) {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background-color: #0f172a;
  color: #e2e8f0;
  color-scheme: dark;
  box-shadow: none;
}

.views-modal .analytics-select:focus,
.views-builder .analytics-select:focus,
.views-modal select:not(.views-mode-btn):focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

#views-name {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background-color: #0f172a;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: none;
  color-scheme: dark;
}
#views-name:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

#vb-limit {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background-color: #0f172a;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 180px;
  color-scheme: dark;
}

.views-modal option,
.views-builder option {
  background-color: #0f172a;
  color: #e2e8f0;
}

.views-modal option:checked,
.views-builder option:checked,
.views-modal option:hover,
.views-builder option:hover {
  background-color: #1d4ed8;
  color: #f8fafc;
}
.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-action {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.65rem;
}

.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-dre__row--expandable:hover > td,
html[data-login-theme="light"] body.page-portal .dash-dre__row--open > td {
  background: rgba(2, 132, 199, 0.08);
}

html[data-login-theme="light"] body.page-portal .dash-dre__child td {
  background: rgba(241, 245, 249, 0.9);
  color: #334155;
}

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

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

html[data-login-theme="light"] body.page-portal .dash-planner-field input,
html[data-login-theme="light"] body.page-portal .orc-inp {
  border-color: rgba(18, 40, 63, 0.14);
  background: rgba(248, 250, 252, 0.95);
  color: #12283f;
}

html[data-login-theme="light"] body.page-portal .dash-planner-field input:hover,
html[data-login-theme="light"] body.page-portal .orc-inp:hover {
  border-color: rgba(18, 40, 63, 0.22);
  background: #ffffff;
}

html[data-login-theme="light"] body.page-portal .dash-planner-field input:focus-visible,
html[data-login-theme="light"] body.page-portal .orc-inp:focus-visible {
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

html[data-login-theme="light"] body.page-portal .orc-table tfoot td {
  color: #12283f;
  background: rgba(241, 245, 249, 0.9);
  border-top-color: rgba(18, 40, 63, 0.1);
}

html[data-login-theme="light"] body.page-portal .orc-del {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(254, 226, 226, 0.65);
  color: #b91c1c;
}

html[data-login-theme="light"] body.page-portal .orc-del:hover {
  background: rgba(254, 202, 202, 0.9);
  border-color: rgba(220, 38, 38, 0.4);
  color: #991b1b;
}

html[data-login-theme="light"] body.page-portal .dash-seg__btn--accent {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

html[data-login-theme="light"] body.page-portal .dash-seg__btn--accent:hover {
  background: rgba(37, 99, 235, 0.2);
  color: #1e3a8a;
}

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-side__search {
  background: #fff;
  border-color: rgba(18, 40, 63, 0.14);
  color: #0f172a;
}

html[data-login-theme="light"] .views-side__search::placeholder {
  color: #94a3b8;
}

html[data-login-theme="light"] .views-side__search:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

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;
}

/* =====================================================================
   Notificações
   ===================================================================== */
.notif-overlay {
  align-items: flex-start;
}

.notif-modal,
.notif-detail-modal {
  width: 100%;
  max-width: min(920px, calc(100vw - 2rem));
}

.notif-modal__head {
  align-items: flex-start;
  gap: 0.75rem;
}

.notif-modal__heading {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.notif-modal__sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.notif-modal .notif-list-body {
  max-height: min(78vh, 760px);
  overflow-y: auto;
  padding-top: 0.35rem;
}

/* Chips de severidade */
.notif-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.notif-chip.is-info {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.4);
}
.notif-chip.is-warning {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}
.notif-chip.is-emergency {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}
.notif-chip.is-bug {
  background: rgba(167, 139, 250, 0.16);
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.45);
}

/* Lista */
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.notif-item__btn {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.notif-item__btn:hover {
  border-color: rgba(56, 189, 248, 0.42);
  background: rgba(30, 41, 59, 0.72);
  transform: translateY(-1px);
}

.notif-item__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.28);
}

.notif-item__rail {
  flex: 0 0 4px;
  background: rgba(56, 189, 248, 0.55);
}

.notif-item.is-warning .notif-item__rail { background: rgba(251, 191, 36, 0.7); }
.notif-item.is-emergency .notif-item__rail { background: rgba(248, 113, 113, 0.85); }
.notif-item.is-bug .notif-item__rail { background: rgba(167, 139, 250, 0.8); }
.notif-item.is-info .notif-item__rail { background: rgba(56, 189, 248, 0.55); }

.notif-item__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem 0.9rem;
}

.notif-item__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.notif-item__meta .notif-chip {
  flex: 0 0 auto;
}

.notif-item__time {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.95);
  white-space: nowrap;
}

.notif-item__dot {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.notif-item.is-emergency .notif-item__dot { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.22); }
.notif-item.is-warning .notif-item__dot { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.22); }
.notif-item.is-bug .notif-item__dot { background: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.22); }

.notif-item__title {
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.35;
  color: rgba(248, 250, 252, 0.98);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item.is-read .notif-item__title {
  font-weight: 550;
  color: rgba(203, 213, 225, 0.92);
}

.notif-item.is-unread .notif-item__btn {
  background: rgba(30, 41, 59, 0.78);
  border-color: rgba(56, 189, 248, 0.28);
}

.notif-item.is-unread.is-emergency .notif-item__btn {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(69, 10, 10, 0.28);
}

.notif-item__preview {
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(186, 198, 214, 0.95);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.notif-empty {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0.5rem;
  font-size: 0.92rem;
}

/* Detalhe */
.notif-detail-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.notif-detail-time {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.notif-detail-body {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text);
  font-size: 0.95rem;
}

@media (max-width: 560px) {
  .notif-modal,
  .notif-detail-modal {
    max-width: calc(100vw - 1.25rem);
  }
  .notif-item__main {
    padding: 0.75rem 0.8rem 0.8rem;
  }
  .notif-item__title {
    font-size: 0.92rem;
  }
  .notif-item__preview {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
  }
}

/* Banner de alerta de bug */
.notif-banner-host {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.notif-banner-host:empty {
  display: none;
}
.notif-bug-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.22), rgba(129, 140, 248, 0.16));
  border-bottom: 1px solid rgba(167, 139, 250, 0.4);
  color: var(--text);
}
.notif-bug-banner__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.35);
  color: #fff;
  font-weight: 800;
}
.notif-bug-banner__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.notif-bug-banner__text strong {
  font-size: 0.85rem;
}
.notif-bug-banner__text span {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-bug-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.notif-bug-banner__link {
  border: 1px solid rgba(167, 139, 250, 0.5);
  background: transparent;
  color: #c4b5fd;
  border-radius: 8px;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.notif-bug-banner__link:hover {
  background: rgba(167, 139, 250, 0.15);
}
.notif-bug-banner__close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
}
.notif-bug-banner__close:hover {
  color: var(--text);
}

/* Central admin */
.notif-admin-modal {
  width: 100%;
  max-width: 920px;
}
.notif-admin-body {
  max-height: min(80vh, 720px);
  overflow-y: auto;
  padding: 1.25rem 1.4rem 1.4rem;
}
.notif-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.6rem;
}
.notif-admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.notif-admin-form .field {
  margin: 0;
}
.notif-admin-sent {
  padding-left: 1.6rem;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.notif-admin-form__title {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.notif-admin-form textarea {
  resize: vertical;
  min-height: 92px;
}
.notif-admin-target {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.notif-admin-target .check--inline {
  align-self: flex-start;
}
.notif-admin-spaces {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 190px;
  overflow-y: auto;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.notif-admin-spaces .check {
  align-self: stretch;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  color: var(--text);
  transition: background 0.12s ease;
}
.notif-admin-spaces .check:hover {
  background: rgba(56, 189, 248, 0.08);
}
.notif-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
}
.notif-admin-list > .muted {
  margin: auto 0;
  text-align: center;
  padding: 1.5rem 0;
}
.notif-admin-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
}
.notif-admin-row.is-closed {
  opacity: 0.6;
}
.notif-admin-row__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.notif-admin-row__title {
  font-size: 0.9rem;
}
.notif-admin-row__status {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.notif-admin-row__body {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: pre-wrap;
}
.notif-admin-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.notif-admin-row__actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
#notif-admin-msg.is-ok {
  color: #4ade80;
}
#notif-admin-msg.is-error {
  color: var(--danger);
}

@media (max-width: 720px) {
  .notif-admin-grid {
    grid-template-columns: 1fr;
  }
  .notif-admin-sent {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 1.1rem;
  }
}

/* =====================================================================
   Visão Geral — espelho dos chart-configs reais das subopções
   ===================================================================== */
#view-visao-geral .home-hero--compact {
  grid-template-columns: 1fr;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#view-visao-geral .home-hero__right {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.7rem;
}

#view-visao-geral .home-hero__right:not(.is-real-ready) > *,
#view-visao-geral .overview-charts-grid:not(.is-real-ready) > * {
  display: none;
}

#view-visao-geral .overview-real-kpi {
  min-height: 104px;
  padding: 0.8rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 2px solid rgb(var(--accent, 56, 189, 248));
}

#view-visao-geral .overview-real-kpi[data-accent="sky"] { --accent: 56, 189, 248; }
#view-visao-geral .overview-real-kpi[data-accent="violet"] { --accent: 167, 139, 250; }
#view-visao-geral .overview-real-kpi[data-accent="emerald"] { --accent: 52, 211, 153; }
#view-visao-geral .overview-real-kpi[data-accent="amber"] { --accent: 251, 191, 36; }
#view-visao-geral .overview-real-kpi[data-accent="rose"] { --accent: 244, 114, 182; }
#view-visao-geral .overview-real-kpi[data-accent="indigo"] { --accent: 129, 140, 248; }

#view-visao-geral .overview-real-kpi .home-kpi__value {
  display: block;
  margin-top: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1rem, 1.35vw, 1.28rem);
}

#view-visao-geral .overview-real-kpi__area,
#view-visao-geral .overview-real-panel__area {
  display: block;
  color: rgb(var(--accent, 56, 189, 248));
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#view-visao-geral .overview-real-kpi__area {
  white-space: nowrap;
}

#view-visao-geral .overview-real-state {
  display: grid;
  place-items: center;
  min-height: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

#view-visao-geral .overview-real-kpi > .overview-real-state {
  display: block;
  min-height: auto;
  margin-top: 0.35rem;
  text-align: left;
  font-size: 0.65rem;
}

#view-visao-geral .overview-real-state.is-error {
  color: var(--danger);
}

#view-visao-geral .overview-real-state.is-unconfigured {
  padding: 1rem;
  color: #fbbf24;
}

#view-visao-geral .overview-real-kpi.home-kpi--real::after {
  display: none;
}

#view-visao-geral .overview-charts-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#view-visao-geral .overview-real-panel {
  min-height: 228px;
}

#view-visao-geral .overview-real-panel__area {
  margin-bottom: 0.2rem;
}

#view-visao-geral .overview-real-panel__chart {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 150px;
  padding: 0.7rem 0.8rem;
  box-sizing: border-box;
}

#view-visao-geral .overview-real-svg {
  width: 100%;
  height: auto;
  max-height: none;
  flex: 0 0 auto;
  align-self: stretch;
}

#view-visao-geral .overview-real-gridline {
  stroke: rgba(148, 163, 184, 0.16);
  stroke-width: 1;
}

#view-visao-geral .overview-real-axis,
#view-visao-geral .overview-real-value {
  fill: currentColor;
  color: var(--muted);
  font: 8px system-ui, sans-serif;
}

#view-visao-geral .overview-real-value {
  font-size: 8.5px;
  font-weight: 600;
}

#view-visao-geral .overview-real-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
  min-height: calc(150px - 1.4rem);
}

#view-visao-geral .overview-real-bar__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.22rem;
  font-size: 0.69rem;
}

#view-visao-geral .overview-real-bar__head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

#view-visao-geral .overview-real-bar__head strong {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 650;
}

#view-visao-geral .overview-real-bar__track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.13);
}

#view-visao-geral .overview-real-bar__track i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  border-radius: inherit;
}

#view-visao-geral .overview-real-bar__track .overview-real-bar__budget {
  background: rgba(148, 163, 184, 0.32);
}

@media (max-width: 1280px) {
  #view-visao-geral .home-hero__right {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #view-visao-geral .overview-charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #view-visao-geral .home-hero__right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #view-visao-geral .overview-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  #view-visao-geral .home-hero__right {
    grid-template-columns: 1fr;
  }
}

/* ---- Comprador inteligente: filtros, config e contexto do simulador ---- */
.buy-list-card__head {
  align-items: center;
  gap: 0.5rem;
}

.buy-list-card__head .dash-card__title-with-info {
  flex: 1 1 auto;
  min-width: 0;
}

.buy-list-filters {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0 1rem 0.65rem;
}

.buy-list-filters:not(:has(.buy-list-filters__panel:not([hidden]))) {
  padding-bottom: 0;
  margin: 0;
}

.buy-list-card__head .buy-list-filters__toggle {
  margin-left: auto;
  flex-shrink: 0;
}

.buy-list-filters__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(145deg, #7c3aed 0%, #4f46e5 52%, #2563eb 100%);
  color: #ffffff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.22),
    0 4px 14px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.buy-list-filters__toggle-ico {
  font-size: 0.78rem;
  opacity: 1;
  line-height: 1;
  color: #ffffff;
}

.buy-list-filters__toggle-label {
  opacity: 1;
  color: #ffffff;
}

.buy-list-filters__toggle.is-open,
.buy-list-filters__toggle:hover {
  filter: brightness(1.06);
  box-shadow:
    0 3px 10px rgba(15, 23, 42, 0.26),
    0 6px 16px rgba(79, 70, 229, 0.42);
}

.buy-list-filters__toggle.is-open {
  filter: brightness(0.96);
  box-shadow:
    0 1px 6px rgba(15, 23, 42, 0.2),
    0 3px 10px rgba(79, 70, 229, 0.3);
}

.buy-list-filters__toggle-meta {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buy-list-filters__chevron {
  margin-left: 0.05rem;
  opacity: 0.9;
  font-size: 0.65rem;
  color: #ffffff;
  transition: transform 0.15s ease;
}

.buy-list-filters__toggle.is-open .buy-list-filters__chevron {
  transform: rotate(180deg);
}

.buy-list-filters__panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.55rem;
  align-items: flex-end;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

/* `display:flex` acima anula o [hidden] do UA — forçar esconder. */
.buy-list-filters__panel[hidden] {
  display: none !important;
}

.buy-filter-combo {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 0 1 8.5rem;
  min-width: 7.25rem;
  max-width: 10rem;
}

.buy-filter-combo--grow {
  flex: 0 1 12rem;
  min-width: 9.5rem;
  max-width: 14rem;
}

.buy-list-filters__label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(148, 163, 184, 0.95);
}

.buy-filter-combo__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-height: 0;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.buy-filter-combo__trigger::after {
  content: "";
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(148, 163, 184, 0.95);
  margin-top: 1px;
  transition: transform 0.15s ease;
}

.buy-filter-combo__trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.buy-filter-combo__trigger [data-buy-filter-label] {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buy-filter-combo.has-value .buy-filter-combo__trigger {
  border-color: rgba(167, 139, 250, 0.4);
}

.buy-filter-combo__search.metas-field__input {
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.2;
}

.buy-list-filters__panel .btn--sm {
  padding: 0.28rem 0.55rem;
  min-height: 0;
  line-height: 1.2;
}

.buy-filter-combo__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 14rem;
  max-height: 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.buy-filter-combo__panel[hidden] {
  display: none !important;
}

.buy-filter-combo__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  max-height: 12rem;
}

.buy-filter-combo__opt {
  display: block;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.buy-filter-combo__opt:hover,
.buy-filter-combo__opt.is-active {
  background: rgba(167, 139, 250, 0.16);
}

.buy-filter-combo__empty {
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
}

.buy-smart-row {
  cursor: pointer;
}

.buy-sales-history-modal {
  width: min(1280px, 96vw);
  max-width: min(1280px, 96vw);
  max-height: min(94vh, 960px);
  display: flex;
  flex-direction: column;
}

.buy-sales-history-modal .modal__body,
.buy-sales-history__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.35rem;
}

.buy-sales-history__layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 3fr) minmax(320px, 7fr);
  gap: 1rem;
  align-items: stretch;
}

.buy-sales-history__col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.buy-sales-history__col--list,
.buy-sales-history__table-wrap {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.buy-sales-history__table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.buy-sales-history__charts {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: visible;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.buy-sales-history__chart-card {
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.7rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  overflow: visible;
}

.buy-sales-history__chart-card--solo {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.buy-sales-history__chart-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
  overflow: visible;
  z-index: 4;
}

.buy-sales-history__chart-head .dash-card__title-with-info {
  flex: 0 1 auto;
}

.buy-sales-history__chart-head .ml2__info {
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
}

.buy-sales-history__chart-head .ml2__help-pop {
  z-index: 50;
  width: min(22.5rem, calc(100vw - 3rem));
}

.buy-sales-history__chart-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: rgba(226, 232, 240, 0.92);
}

.buy-sales-history__chart {
  margin: 0;
  flex: 1 1 auto;
  min-height: 240px;
  display: flex;
  align-items: stretch;
  overflow: visible;
}

.buy-sales-history__chart svg {
  width: 100%;
  height: 100%;
  min-height: 240px;
  display: block;
  overflow: visible;
}

.buy-sales-history__chart svg text {
  font-family: inherit;
}

.buy-sales-history__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.95);
  flex-shrink: 0;
}

.buy-sales-history__legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 0.3rem;
  vertical-align: middle;
  border-radius: 2px;
}

.buy-sales-history__legend i.is-hist {
  background: rgba(56, 189, 248, 0.95);
}

.buy-sales-history__legend i.is-fc {
  background: rgba(244, 114, 182, 0.95);
}

.buy-sales-history__table-wrap .dash-table-paged__pager {
  margin-top: 0.55rem;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .buy-sales-history__layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .buy-sales-history-modal .modal__body,
  .buy-sales-history__body {
    overflow: auto;
  }
}

.buy-config-modal {
  width: min(920px, 96vw);
  max-width: min(920px, 96vw);
  max-height: min(92vh, 920px);
}

.buy-config-lead {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.buy-config-defaults {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  justify-content: start;
  align-items: end;
}

.buy-config-defaults .metas-field__label {
  white-space: nowrap;
}

.buy-config-defaults .metas-field__input,
.buy-config-defaults .metas-field__input-wrap {
  width: 7.25rem;
  max-width: 7.25rem;
}

.buy-config-defaults .metas-field__input-wrap .metas-field__input {
  max-width: none;
  width: 100%;
}

@media (max-width: 520px) {
  .buy-config-defaults {
    grid-template-columns: 1fr;
  }
}

.buy-config-rules .dash-card__head {
  margin-bottom: 0.5rem;
}

.buy-config-table {
  table-layout: fixed;
  width: 100%;
}

.buy-config-table th:nth-child(1),
.buy-config-table td:nth-child(1) {
  width: 7.5rem;
}

.buy-config-table th:nth-child(2),
.buy-config-table td:nth-child(2) {
  width: auto;
}

.buy-config-table th:nth-child(3),
.buy-config-table td:nth-child(3),
.buy-config-table th:nth-child(4),
.buy-config-table td:nth-child(4),
.buy-config-table th:nth-child(5),
.buy-config-table td:nth-child(5) {
  width: 5.5rem;
}

.buy-config-table th:nth-child(6),
.buy-config-table td:nth-child(6) {
  width: 3rem;
  text-align: center;
}

.buy-config-table .metas-field__input {
  min-width: 0;
  width: 100%;
}

.buy-config-table select.metas-field__input[data-buy-cfg="type"],
.buy-config-table select.buy-config-type {
  min-width: 6.75rem;
  padding-right: 1.75rem;
  font-size: 0.82rem;
}

.buy-config-table select.metas-field__input[data-buy-cfg="key"] {
  max-width: 100%;
}

.buy-config-modal .btn--danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
}

.buy-config-modal .btn--danger:hover:not(:disabled) {
  background: #ef4444;
  border-color: #dc2626;
  filter: none;
}

#buy-config-status.is-ok { color: #4ade80; }
#buy-config-status.is-bad { color: #fb7185; }

/* ---- Assistente BI (chat n8n) — canto inferior esquerdo ---- */
body.page-portal .duby-ai-chat {
  position: fixed;
  bottom: clamp(1rem, 2vh, 1.5rem);
  left: clamp(1rem, 2vw, 1.5rem);
  z-index: 230;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  pointer-events: none;
}

/* display:flex do root/panel vence [hidden] sem !important (mesmo padrão de .views-pane). */
body.page-portal .duby-ai-chat[hidden] {
  display: none !important;
}

.duby-ai-chat > * {
  pointer-events: auto;
}

.duby-ai-chat__fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%);
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.28),
    0 10px 28px rgba(37, 99, 235, 0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.duby-ai-chat__fab:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.06);
}

.duby-ai-chat.is-open .duby-ai-chat__fab {
  transform: scale(0.96);
  filter: brightness(0.95);
}

.duby-ai-chat__fab-icon {
  width: 24px;
  height: 24px;
}

.duby-ai-chat__panel {
  position: relative;
  width: min(28rem, calc(100vw - 2rem));
  height: min(38rem, calc(100vh - 5.5rem));
  display: none;
  flex-direction: row;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    0 18px 50px rgba(2, 6, 23, 0.55),
    0 0 0 1px rgba(56, 189, 248, 0.08);
  backdrop-filter: blur(12px);
  transition: width 0.22s ease, height 0.22s ease;
}

.duby-ai-chat.is-open .duby-ai-chat__panel {
  display: flex;
}

/* Modo expandido: quase tela cheia, sem cobrir a topbar. */
body.page-portal .duby-ai-chat.is-expanded.is-open {
  top: calc(var(--topbar-h, 57px) + 0.25rem);
  right: 0.25rem;
  bottom: 0.25rem;
  left: 0.25rem;
  align-items: stretch;
  gap: 0;
}

.duby-ai-chat.is-expanded .duby-ai-chat__panel {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0.75rem;
  /* Opaco: não deixa o dashboard/gráfico vazar por trás. */
  background: #0c0f14;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.duby-ai-chat.is-expanded .duby-ai-chat__main,
.duby-ai-chat.is-expanded .duby-ai-chat__messages,
.duby-ai-chat.is-expanded .duby-ai-chat__sidebar {
  background: #0c0f14;
}

.duby-ai-chat.is-expanded .duby-ai-chat__form {
  background: #0c0f14;
  border-top-color: rgba(148, 163, 184, 0.16);
}

.duby-ai-chat.is-expanded.is-open .duby-ai-chat__fab {
  display: none;
}

.duby-ai-chat__panel[hidden] {
  display: none !important;
}

.duby-ai-chat__sidebar {
  width: 15.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.45);
}

.duby-ai-chat__sidebar[hidden] {
  display: none !important;
}

.duby-ai-chat__sidebar-head {
  padding: 0.85rem 0.75rem 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.duby-ai-chat__sidebar-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.duby-ai-chat__new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 0.55rem;
  background: rgba(37, 99, 235, 0.22);
  color: #e0f2fe;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.duby-ai-chat__new-btn:hover {
  background: rgba(37, 99, 235, 0.38);
}

.duby-ai-chat__new-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}

.duby-ai-chat__history {
  flex: 1;
  overflow: auto;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.duby-ai-chat__history-empty {
  margin: 0.75rem 0.4rem;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
}

.duby-ai-chat__history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.duby-ai-chat__history-item:hover {
  background: rgba(148, 163, 184, 0.12);
}

.duby-ai-chat__history-item.is-active {
  background: rgba(37, 99, 235, 0.28);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.25);
}

.duby-ai-chat__history-title {
  font-size: 0.78rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.duby-ai-chat__history-meta {
  font-size: 0.68rem;
  color: #94a3b8;
}

.duby-ai-chat__main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.duby-ai-chat__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.18), transparent);
}

.duby-ai-chat__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: #f8fafc;
}

.duby-ai-chat__meta {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.35;
}

.duby-ai-chat__head-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.duby-ai-chat__usage-wrap {
  position: relative;
}

.duby-ai-chat__usage-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
}

.duby-ai-chat__usage-pct {
  position: absolute;
  inset: 0;
  display: none; /* percentual só no popover ao clicar */
  place-items: center;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e2e8f0;
  pointer-events: none;
}

.duby-ai-chat__usage-pct[hidden] {
  display: none !important;
}

.duby-ai-chat__usage-btn:hover,
.duby-ai-chat__usage-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.duby-ai-chat__usage-ring {
  width: 1.15rem;
  height: 1.15rem;
  transform: rotate(-90deg);
}

.duby-ai-chat__usage-track {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 3.5;
}

.duby-ai-chat__usage-prog {
  stroke: #ffffff;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 88;
  stroke-dashoffset: 88;
  transition: stroke-dashoffset 0.35s ease, stroke 0.2s ease;
}

.duby-ai-chat__usage-btn.is-warn .duby-ai-chat__usage-prog {
  stroke: #fbbf24;
}

.duby-ai-chat__usage-btn.is-limit .duby-ai-chat__usage-prog {
  stroke: #fb7185;
}

.duby-ai-chat__usage-pop {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 5;
  width: min(16.5rem, calc(100vw - 3rem));
  padding: 0.7rem 0.8rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.45);
}

.duby-ai-chat__usage-pop[hidden] {
  display: none !important;
}

.duby-ai-chat__usage-pop-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #94a3b8;
}

.duby-ai-chat__usage-pop-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #e2e8f0;
}

.duby-ai-chat__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
}

.duby-ai-chat__icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.duby-ai-chat__icon-btn svg,
.duby-ai-chat__icon-btn img {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

/* display:block acima vence o [hidden] do UA — forçar ocultar. */
.duby-ai-chat__icon-btn img[hidden],
.duby-ai-chat__icon-expand[hidden],
.duby-ai-chat__icon-collapse[hidden] {
  display: none !important;
}

.duby-ai-chat__messages {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.duby-ai-chat__messages.is-empty {
  justify-content: center;
  align-items: center;
}

.duby-ai-chat__empty {
  display: none;
  width: min(100%, 26rem);
  text-align: center;
  padding: 1rem 0.75rem;
}

.duby-ai-chat__messages.is-empty .duby-ai-chat__empty {
  display: block;
}

.duby-ai-chat__welcome {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 500;
  color: #dbe7f5;
  text-wrap: balance;
}

.duby-ai-chat__bubble {
  max-width: 92%;
  padding: 0.75rem 0.9rem 0.5rem;
  border-radius: 0.85rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #e2e8f0;
}

.duby-ai-chat__bubble p {
  margin: 0;
}

.duby-ai-chat__rich {
  display: block;
}

.duby-ai-chat__rich > :first-child {
  margin-top: 0;
}

.duby-ai-chat__rich > :last-child {
  margin-bottom: 0;
}

.duby-ai-chat__rich p {
  margin: 0 0 0.55rem;
}

.duby-ai-chat__rich p:last-child {
  margin-bottom: 0;
}

.duby-ai-chat__rich h1,
.duby-ai-chat__rich h2,
.duby-ai-chat__rich h3,
.duby-ai-chat__rich h4 {
  margin: 0.55rem 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  color: #f1f5f9;
}

.duby-ai-chat__rich ul,
.duby-ai-chat__rich ol {
  margin: 0.35rem 0 0.55rem;
  padding-left: 1.15rem;
}

.duby-ai-chat__rich li {
  margin: 0.15rem 0;
}

.duby-ai-chat__rich strong,
.duby-ai-chat__rich b {
  font-weight: 650;
  color: #f8fafc;
}

.duby-ai-chat__rich code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78em;
  padding: 0.05rem 0.3rem;
  border-radius: 0.3rem;
  background: rgba(15, 23, 42, 0.55);
}

.duby-ai-chat__rich pre {
  margin: 0.45rem 0;
  padding: 0.55rem 0.65rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.65);
  font-size: 0.75rem;
}

.duby-ai-chat__rich table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.45rem 0;
  font-size: 0.9rem;
}

.duby-ai-chat__rich th,
.duby-ai-chat__rich td {
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 0.3rem 0.45rem;
  text-align: left;
}

.duby-ai-chat__rich th {
  background: rgba(15, 23, 42, 0.45);
  font-weight: 600;
}

.duby-ai-chat__rich a {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.duby-ai-chat__figure,
.duby-ai-chat__rich figure {
  margin: 0.55rem 0 0.2rem;
}

.duby-ai-chat__figure img,
.duby-ai-chat__rich img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.duby-ai-chat__rich figcaption {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: #94a3b8;
}

.duby-ai-chat__time {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.66rem;
  line-height: 1;
  color: #94a3b8;
  opacity: 0.9;
}

.duby-ai-chat__bubble--user .duby-ai-chat__time {
  text-align: right;
  color: rgba(226, 232, 240, 0.72);
}

.duby-ai-chat__bubble--assistant {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.duby-ai-chat__bubble--user {
  align-self: flex-end;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.55), rgba(79, 70, 229, 0.5));
  border: 1px solid rgba(147, 197, 253, 0.25);
}

.duby-ai-chat__bubble.is-error {
  border-color: rgba(244, 63, 94, 0.45);
  color: #fecdd3;
}

.duby-ai-chat__bubble.is-interview {
  max-width: 100%;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
}

.duby-ai-chat__bubble.is-interview .duby-ai-chat__rich[hidden],
.duby-ai-chat__bubble.is-interview .duby-ai-chat__time[hidden] {
  display: none !important;
}

.duby-ai-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.duby-ai-chat__suggestions--starter {
  padding: 0 0.9rem 0.75rem;
  margin-top: 0;
}

/* Sugestões iniciais só no modo expandido */
.duby-ai-chat:not(.is-expanded) .duby-ai-chat__suggestions--starter {
  display: none !important;
}

.duby-ai-chat__chip {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.45);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.duby-ai-chat__chip:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.45);
}

.duby-ai-chat__chip--option {
  border-radius: 0.65rem;
  background: rgba(56, 189, 248, 0.08);
}

.duby-ai-chat__interview {
  align-self: stretch;
  max-width: 100%;
  margin: 0.15rem 0 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1rem;
  background: rgba(21, 26, 34, 0.96);
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.35);
  overflow: hidden;
}

.duby-ai-chat__interview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.duby-ai-chat__interview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: #f1f5f9;
}

.duby-ai-chat__interview-close {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.duby-ai-chat__interview-close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

.duby-ai-chat__interview-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.duby-ai-chat__interview-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  transition: background 0.15s ease;
}

.duby-ai-chat__interview-item:hover {
  background: rgba(56, 189, 248, 0.08);
}

.duby-ai-chat__interview-num {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 650;
}

.duby-ai-chat__interview-item:hover .duby-ai-chat__interview-num {
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}

.duby-ai-chat__interview-foot {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem 0.75rem;
}

.duby-ai-chat__interview-other {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
}

.duby-ai-chat__interview-other svg {
  width: 0.95rem;
  height: 0.95rem;
  color: #94a3b8;
  flex: 0 0 auto;
}

.duby-ai-chat__interview-other input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.86rem;
  outline: none;
}

.duby-ai-chat__interview-other input::placeholder {
  color: #64748b;
}

.duby-ai-chat__interview-skip {
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: #cbd5e1;
  border-radius: 0.55rem;
  padding: 0.42rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.duby-ai-chat__interview-skip:hover {
  border-color: rgba(56, 189, 248, 0.45);
  color: #e2e8f0;
  background: rgba(56, 189, 248, 0.08);
}

.duby-ai-chat__interview-hint {
  margin: 0;
  padding: 0 0.9rem 0.7rem;
  font-size: 0.72rem;
  color: #64748b;
}

.duby-ai-chat__settings {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(2px);
}

.duby-ai-chat__settings[hidden] {
  display: none !important;
}

.duby-ai-chat__settings-card {
  width: min(100%, 26rem);
  background: #151a22;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.9rem;
  padding: 0.9rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.duby-ai-chat__settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.duby-ai-chat__settings-head h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #f1f5f9;
}

.duby-ai-chat__settings-hint {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: #94a3b8;
}

.duby-ai-chat__settings-text {
  width: 100%;
  min-height: 9rem;
  resize: vertical;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.duby-ai-chat__settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

.duby-ai-chat__settings-save {
  border: 0;
  border-radius: 0.55rem;
  padding: 0.45rem 0.9rem;
  background: #0284c7;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.duby-ai-chat__dl a {
  color: #7dd3fc;
  font-weight: 600;
}

.duby-ai-chat__feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.duby-ai-chat__fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 2rem;
  height: 1.85rem;
  padding: 0 0.55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.duby-ai-chat__fb-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}

.duby-ai-chat__fb-btn:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
}

.duby-ai-chat__fb-btn.is-active[data-fb="up"] {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.14);
}

.duby-ai-chat__fb-btn.is-active[data-fb="down"] {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.14);
}

.duby-ai-chat__feedback.is-saving {
  opacity: 0.55;
  pointer-events: none;
}

.duby-ai-chat__sql {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  color: #94a3b8;
}

.duby-ai-chat__sql summary {
  cursor: pointer;
  color: #7dd3fc;
}

.duby-ai-chat__sql pre {
  margin: 0.4rem 0 0;
  padding: 0.5rem;
  overflow: auto;
  max-height: 8rem;
  border-radius: 0.45rem;
  background: rgba(2, 6, 23, 0.55);
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

.duby-ai-chat__form {
  padding: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.35);
}

.duby-ai-chat__composer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.3rem 0.35rem 0.3rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.duby-ai-chat__composer:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.duby-ai-chat__mic {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
}

.duby-ai-chat__attach {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
}

.duby-ai-chat__attach:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #fff;
}

.duby-ai-chat__attach svg {
  width: 1.15rem;
  height: 1.15rem;
}

.duby-ai-chat__attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.15rem 0.55rem;
}

.duby-ai-chat__attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  font-size: 0.75rem;
}

.duby-ai-chat__attach-name {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duby-ai-chat__attach-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: none;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.duby-ai-chat__attach-remove:hover {
  background: rgba(244, 63, 94, 0.35);
  color: #fff;
}

.duby-ai-chat__thinking-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: #94a3b8;
}

.duby-ai-chat__thinking-gear {
  flex: 0 0 auto;
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
  color: #38bdf8;
  animation: duby-ai-gear-spin 1.4s linear infinite;
}

.duby-ai-chat__thinking-gear svg {
  width: 100%;
  height: 100%;
}

@keyframes duby-ai-gear-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

html.duby-ai-chat-scroll-lock,
body.duby-ai-chat-scroll-lock {
  overflow: hidden !important;
}

.duby-ai-chat__mic:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #fff;
}

.duby-ai-chat__mic.is-recording {
  color: #fff;
  background: rgba(244, 63, 94, 0.45);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.4);
  animation: duby-ai-rec-pulse 1.2s ease-in-out infinite;
}

.duby-ai-chat__rec-badge {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0 0.35rem;
  color: #fda4af;
  font-size: 0.84rem;
  font-weight: 600;
}

.duby-ai-chat__rec-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.45);
  animation: duby-ai-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes duby-ai-rec-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.75; }
}

.duby-ai-chat.is-recording .duby-ai-chat__think,
.duby-ai-chat.is-recording .duby-ai-chat__send {
  opacity: 0.35;
  pointer-events: none;
}

.duby-ai-chat__bubble.has-audio {
  max-width: min(92%, 18.5rem);
  padding: 0.55rem 0.7rem 0.45rem;
}

.duby-ai-chat__voice {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  row-gap: 0.15rem;
  align-items: center;
  width: 100%;
  min-width: 12rem;
}

.duby-ai-chat__voice audio {
  display: none;
}

.duby-ai-chat__voice-avatar {
  grid-row: 1 / span 2;
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: rgba(15, 23, 42, 0.45);
  color: #7dd3fc;
  border: 1px solid rgba(148, 163, 184, 0.28);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.duby-ai-chat__voice-avatar--img {
  overflow: hidden;
  border: none;
  background: rgba(15, 23, 42, 0.35);
}

.duby-ai-chat__voice-avatar--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.duby-ai-chat__voice-ini {
  line-height: 1;
}

.duby-ai-chat__bubble--user .duby-ai-chat__voice-avatar {
  background: rgba(15, 23, 42, 0.35);
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, 0.35);
}

.duby-ai-chat__voice-mic {
  position: absolute;
  right: -0.1rem;
  bottom: -0.05rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #38bdf8;
  color: #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.55);
  z-index: 1;
}

.duby-ai-chat__voice-mic svg {
  width: 0.55rem;
  height: 0.55rem;
}

.duby-ai-chat__voice-play {
  grid-row: 1 / span 2;
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #f8fafc;
  cursor: pointer;
  padding: 0;
}

.duby-ai-chat__voice-play:hover {
  color: #fff;
}

.duby-ai-chat__voice-play svg {
  width: 1.15rem;
  height: 1.15rem;
}

.duby-ai-chat__voice-play .duby-ai-chat__voice-ico-pause[hidden],
.duby-ai-chat__voice-play .duby-ai-chat__voice-ico-play[hidden] {
  display: none !important;
}

.duby-ai-chat__voice-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.duby-ai-chat__voice-wave {
  --progress: 0%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 1.35rem;
  cursor: pointer;
  user-select: none;
}

.duby-ai-chat__voice-wave i {
  flex: 1 1 0;
  height: var(--h, 40%);
  min-width: 2px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.4);
  transition: background 0.05s linear;
}

.duby-ai-chat__bubble--user .duby-ai-chat__voice-wave i {
  background: rgba(186, 230, 253, 0.35);
}

.duby-ai-chat__voice-wave i.is-played {
  background: #7dd3fc;
}

.duby-ai-chat__bubble--user .duby-ai-chat__voice-wave i.is-played {
  background: #e0f2fe;
}

.duby-ai-chat__voice-wave::after {
  content: "";
  position: absolute;
  left: var(--progress);
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: -0.22rem;
  margin-top: -0.22rem;
  border-radius: 50%;
  background: #7dd3fc;
  box-shadow: 0 0 0 1.5px rgba(15, 23, 42, 0.35);
  pointer-events: none;
}

.duby-ai-chat__bubble--user .duby-ai-chat__voice-wave::after {
  background: #f8fafc;
}

.duby-ai-chat__voice-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.duby-ai-chat__voice-dur {
  font-size: 0.68rem;
  line-height: 1;
  color: #94a3b8;
}

.duby-ai-chat__bubble--user .duby-ai-chat__voice-dur,
.duby-ai-chat__bubble--user .duby-ai-chat__voice-meta .duby-ai-chat__time {
  color: rgba(226, 232, 240, 0.78);
}

.duby-ai-chat__voice-meta .duby-ai-chat__time {
  margin-top: 0;
}

.duby-ai-chat__mic svg {
  width: 1.1rem;
  height: 1.1rem;
}

.duby-ai-chat__input {
  box-sizing: border-box;
  flex: 1 1 auto;
  resize: none;
  width: 100%;
  min-width: 0;
  height: 2.15rem;
  min-height: 2.15rem;
  max-height: 7rem;
  padding: 0.45rem 0.35rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #f1f5f9;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-y: auto;
}

.duby-ai-chat__input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.duby-ai-chat__input::placeholder {
  color: #94a3b8;
}

.duby-ai-chat__composer-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.duby-ai-chat__think {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  color: #7dd3fc;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, width 0.18s ease, padding 0.18s ease;
}

.duby-ai-chat__think span {
  display: none;
}

.duby-ai-chat__think-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  color: #94a3b8;
  transition: color 0.18s ease, filter 0.18s ease;
}

.duby-ai-chat__think-bulb {
  fill: transparent;
  transition: fill 0.18s ease, stroke 0.18s ease;
}

.duby-ai-chat__think:hover {
  background: rgba(37, 99, 235, 0.24);
}

.duby-ai-chat__think:hover .duby-ai-chat__think-icon {
  color: #cbd5e1;
}

.duby-ai-chat__think.is-on {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde68a;
}

.duby-ai-chat__think.is-on .duby-ai-chat__think-icon {
  color: #facc15;
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.55));
}

.duby-ai-chat__think.is-on .duby-ai-chat__think-bulb {
  fill: #facc15;
  stroke: #fde047;
}

.duby-ai-chat__send {
  box-sizing: border-box;
  width: 2.15rem;
  height: 2.15rem;
  min-height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #0ea5e9, #2563eb 55%, #4f46e5);
  flex: 0 0 auto;
}

.duby-ai-chat__send:hover {
  filter: brightness(1.06);
}

.duby-ai-chat__send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.duby-ai-chat__send svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* Composer mais destacado no modo expandido. */
.duby-ai-chat.is-expanded .duby-ai-chat__form {
  padding: 0.9rem 1.1rem 1.05rem;
  background: #0c0f14;
  border-top-color: rgba(148, 163, 184, 0.12);
}

.duby-ai-chat.is-expanded .duby-ai-chat__composer {
  min-height: 3.35rem;
  padding: 0.4rem 0.45rem 0.4rem 0.55rem;
  gap: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow:
    0 10px 28px rgba(2, 6, 23, 0.35),
    inset 0 0 0 1px rgba(56, 189, 248, 0.06);
}

.duby-ai-chat.is-expanded .duby-ai-chat__input {
  height: auto;
  min-height: 2.4rem;
  max-height: 8rem;
  padding: 0.55rem 0.4rem;
  font-size: 0.92rem;
}

.duby-ai-chat.is-expanded .duby-ai-chat__think {
  display: inline-flex;
  width: auto;
  height: 2rem;
  padding: 0 0.7rem 0 0.55rem;
}

.duby-ai-chat.is-expanded .duby-ai-chat__think span {
  display: inline;
}

.duby-ai-chat.is-expanded .duby-ai-chat__attach,
.duby-ai-chat.is-expanded .duby-ai-chat__mic,
.duby-ai-chat.is-expanded .duby-ai-chat__send {
  width: 2.4rem;
  height: 2.4rem;
}

.duby-ai-chat.is-busy .duby-ai-chat__fab {
  animation: duby-ai-pulse 1.4s ease-in-out infinite;
}

@keyframes duby-ai-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28), 0 0 0 0 rgba(56, 189, 248, 0.35); }
  50% { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28), 0 0 0 10px rgba(56, 189, 248, 0); }
}

html[data-login-theme="light"] .duby-ai-chat__panel {
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.22);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

html[data-login-theme="light"] .duby-ai-chat.is-expanded .duby-ai-chat__panel,
html[data-login-theme="light"] .duby-ai-chat.is-expanded .duby-ai-chat__main,
html[data-login-theme="light"] .duby-ai-chat.is-expanded .duby-ai-chat__messages,
html[data-login-theme="light"] .duby-ai-chat.is-expanded .duby-ai-chat__sidebar,
html[data-login-theme="light"] .duby-ai-chat.is-expanded .duby-ai-chat__form {
  background: #f8fafc;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html[data-login-theme="light"] .duby-ai-chat__title { color: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__meta { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__icon-btn { color: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__icon-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__usage-btn { color: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__usage-btn:hover,
html[data-login-theme="light"] .duby-ai-chat__usage-btn[aria-expanded="true"] {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__usage-track { stroke: rgba(15, 23, 42, 0.22); }
html[data-login-theme="light"] .duby-ai-chat__usage-prog { stroke: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__usage-pop {
  background: #fff;
  border-color: rgba(100, 116, 139, 0.25);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
html[data-login-theme="light"] .duby-ai-chat__usage-pop-title { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__usage-pop-text { color: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__sidebar {
  background: rgba(241, 245, 249, 0.9);
  border-right-color: rgba(100, 116, 139, 0.18);
}
html[data-login-theme="light"] .duby-ai-chat__sidebar-title { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__history-item { color: #0f172a; }
html[data-login-theme="light"] .duby-ai-chat__history-item:hover {
  background: rgba(100, 116, 139, 0.12);
}
html[data-login-theme="light"] .duby-ai-chat__history-item.is-active {
  background: rgba(37, 99, 235, 0.12);
}
html[data-login-theme="light"] .duby-ai-chat__history-meta { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__new-btn {
  color: #1e3a8a;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.28);
}
html[data-login-theme="light"] .duby-ai-chat__bubble--assistant {
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(100, 116, 139, 0.18);
}
html[data-login-theme="light"] .duby-ai-chat__bubble--user {
  color: #f8fafc;
}
html[data-login-theme="light"] .duby-ai-chat__time { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__bubble--user .duby-ai-chat__time {
  color: rgba(248, 250, 252, 0.8);
}
html[data-login-theme="light"] .duby-ai-chat__fb-btn { color: #64748b; }
html[data-login-theme="light"] .duby-ai-chat__fb-btn:hover {
  background: rgba(100, 116, 139, 0.12);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__fb-btn.is-active[data-fb="up"] {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
}
html[data-login-theme="light"] .duby-ai-chat__fb-btn.is-active[data-fb="down"] {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.1);
}
html[data-login-theme="light"] .duby-ai-chat__composer {
  background: #fff;
  border-color: rgba(100, 116, 139, 0.28);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}
html[data-login-theme="light"] .duby-ai-chat__input {
  background: transparent;
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__input::placeholder {
  color: #94a3b8;
}
html[data-login-theme="light"] .duby-ai-chat__mic {
  color: #475569;
}
html[data-login-theme="light"] .duby-ai-chat__mic:hover {
  background: rgba(100, 116, 139, 0.12);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__attach {
  color: #475569;
}
html[data-login-theme="light"] .duby-ai-chat__attach:hover {
  background: rgba(100, 116, 139, 0.12);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__attach-chip {
  background: #e2e8f0;
  border-color: rgba(100, 116, 139, 0.28);
  color: #0f172a;
}
html[data-login-theme="light"] .duby-ai-chat__think {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.22);
}
html[data-login-theme="light"] .duby-ai-chat__think-icon {
  color: #64748b;
}
html[data-login-theme="light"] .duby-ai-chat__think.is-on {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(202, 138, 4, 0.4);
  color: #a16207;
}
html[data-login-theme="light"] .duby-ai-chat__think.is-on .duby-ai-chat__think-icon {
  color: #eab308;
}
html[data-login-theme="light"] .duby-ai-chat__think.is-on .duby-ai-chat__think-bulb {
  fill: #facc15;
  stroke: #ca8a04;
}

@media (max-width: 640px) {
  body.page-portal .duby-ai-chat {
    left: 0.75rem;
    right: auto;
  }
  .duby-ai-chat__panel {
    width: min(100vw - 1.5rem, 28rem);
    height: min(78vh, 36rem);
  }
  body.page-portal .duby-ai-chat.is-expanded.is-open {
    top: calc(var(--topbar-h, 57px) + 0.2rem);
    left: 0.2rem;
    right: 0.2rem;
    bottom: 0.2rem;
  }
  .duby-ai-chat.is-expanded .duby-ai-chat__panel {
    width: 100%;
    height: 100%;
  }
  .duby-ai-chat__sidebar {
    width: 11.5rem;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Evolução mensal (Pedidos): preenche a altura do card ao lado do calendário. */
[data-card-id="ped-chart-evolucao-valor"] {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

[data-card-id="ped-chart-evolucao-valor"] .dash-chart-placeholder {
  flex: 1 1 auto;
  min-height: 16rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: stretch;
}

[data-card-id="ped-chart-evolucao-valor"] .dash-svg-chart {
  width: 100%;
  height: 100%;
  min-height: 16rem;
  flex: 1 1 auto;
  display: block;
}

/* ========================================================================
   Suporte / tickets
   ======================================================================== */
.support-overlay .support-modal {
  width: min(720px, 96vw);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
}
.support-modal__head { align-items: flex-start; gap: 0.75rem; }
.support-modal__sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.9);
}
.support-modal__body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 280px;
}
.support-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}
.support-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.support-filter {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: transparent;
  color: rgba(226, 232, 240, 0.88);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.support-filter.is-active {
  background: rgba(129, 140, 248, 0.22);
  border-color: rgba(129, 140, 248, 0.55);
}
.support-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.support-list__btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.45);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
}
.support-list__btn:hover { border-color: rgba(129, 140, 248, 0.45); }
.support-list__top { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.support-list__time { margin-left: auto; font-size: 0.75rem; color: rgba(148, 163, 184, 0.85); }
.support-list__subject { font-weight: 600; }
.support-list__meta,
.support-list__preview { font-size: 0.8rem; color: rgba(148, 163, 184, 0.9); }
.support-empty { margin: 1.5rem 0; text-align: center; color: rgba(148, 163, 184, 0.9); }
.support-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}
.support-chip.is-open { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; }
.support-chip.is-progress { background: rgba(167, 139, 250, 0.22); color: #c4b5fd; }
.support-chip.is-wait { background: rgba(251, 191, 36, 0.22); color: #fcd34d; }
.support-chip.is-done { background: rgba(52, 211, 153, 0.22); color: #6ee7b7; }
.support-chip.is-closed { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.support-form,
.support-reply { display: grid; gap: 0.75rem; }
.support-form__actions,
.support-reply__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}
.support-form__error { color: #fca5a5; margin: 0; font-size: 0.85rem; }
.support-file-preview { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.75rem; color: rgba(148, 163, 184, 0.9); }
.support-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.95);
}
.support-admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.25);
}
.support-admin-bar label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.88);
}
.support-admin-bar select {
  min-width: 140px;
}
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 340px;
  overflow: auto;
  padding-right: 0.2rem;
}
.support-msg {
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.support-msg.is-admin { border-color: rgba(129, 140, 248, 0.35); background: rgba(67, 56, 202, 0.18); }
.support-msg.is-internal { opacity: 0.85; border-style: dashed; }
.support-msg header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  color: rgba(148, 163, 184, 0.95);
}
.support-msg p { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.support-atts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.support-att img {
  width: 88px;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.support-internal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.88);
}
.support-closed-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}
.space-head__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.support-admin-badge {
  display: inline-flex;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  background: #f43f5e;
  color: #fff;
}

/* ========================================================================
   Página /support — inbox + chat (full-bleed + controles na paleta)
   ======================================================================== */
.page-support {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.page-support .topbar .container {
  max-width: none;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
.support-page {
  flex: 1;
  min-height: 0;
  padding: 0.55rem 0.75rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
}
.support-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  height: calc(100vh - 4.75rem);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: relative;
}
.support-shell.is-inbox-collapsed {
  grid-template-columns: 52px minmax(0, 1fr);
}
.support-inbox {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.38);
  min-width: 0;
  overflow: hidden;
}
.support-shell.is-inbox-collapsed .support-inbox {
  display: none;
}
.support-inbox__head {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.05rem 1.1rem 0.7rem;
  flex-shrink: 0;
}
.support-inbox__head-main {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}
.support-inbox__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.support-inbox__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.support-inbox__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.support-inbox__lead {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.support-inbox__new { white-space: nowrap; flex-shrink: 0; }
.support-collapse-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--accent-dim);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.support-collapse-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
}
.support-inbox-expand {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.85rem 0.35rem;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  z-index: auto;
}
.support-shell.is-inbox-collapsed .support-inbox-expand {
  display: flex;
}
.support-inbox-expand[hidden] {
  display: none !important;
}
.support-inbox-expand span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.04em;
}
.support-inbox-expand:hover {
  background: var(--accent-dim);
  color: #e0f2fe;
}
.support-inbox__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1.1rem 0.55rem;
}
.support-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.support-pill:hover {
  border-color: rgba(56, 189, 248, 0.4);
}
.support-pill.is-active {
  background: var(--accent-dim);
  border-color: rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
}
.support-rag-open {
  margin: 0;
  align-self: stretch;
  justify-content: center;
}
.support-inbox__admin-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  margin: 0 1.1rem 0.65rem;
}
.support-inbox__admin-actions[hidden],
[data-admin-only][hidden],
[data-support-admin-only][hidden] {
  display: none !important;
}
.support-inbox__admin-actions .btn {
  width: 100%;
  justify-content: center;
}
.support-sla-gear {
  width: 2.55rem !important;
  min-width: 2.55rem;
  padding: 0 !important;
}
.support-inbox__search { padding: 0 1.1rem 0.75rem; }

/* Inputs de uma linha — sem min-height de textarea */
.support-inbox__search-input,
body.page-support .field input:not([type="file"]),
body.page-support input.support-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  min-height: 2.4rem;
  height: 2.4rem;
  resize: none;
}
body.page-support textarea.support-input,
body.page-support .field textarea,
body.page-support .support-chat__composer-row textarea,
body.page-support #support-csat-comment {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  min-height: 5.5rem;
  height: auto;
  resize: vertical;
}
.support-inbox__search-input:focus,
body.page-support input.support-input:focus,
body.page-support .field input:focus,
body.page-support textarea.support-input:focus,
body.page-support .field textarea:focus,
body.page-support .support-select:focus,
body.page-support .support-chat__composer-row textarea:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.support-inbox__stats {
  padding: 0 1.1rem 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.support-inbox__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.support-inbox__empty {
  margin: 1.5rem 0.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.support-ticket-card {
  text-align: left;
  border: 1px solid transparent;
  background: rgba(30, 41, 59, 0.5);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 0.22rem;
  width: 100%;
}
.support-ticket-card:hover {
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(30, 41, 59, 0.78);
}
.support-ticket-card.is-active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: inset 3px 0 0 var(--accent);
}
.support-ticket-card__top {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
.support-ticket-card__top time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
}
.support-ticket-card__subject {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}
.support-ticket-card__meta,
.support-ticket-card__preview {
  font-size: 0.78rem;
  color: var(--muted);
}
.support-ticket-card__preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.support-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(15, 23, 42, 0.28);
}

/* Garante que painéis ocultos não vazem (display:flex sobrescreve [hidden] do UA) */
.support-compose[hidden],
.support-chat[hidden],
.support-empty-state[hidden],
.support-rag[hidden],
.support-chat__admin[hidden],
.support-csat[hidden],
.support-csat-done[hidden],
.support-chat__closed[hidden],
.support-form__error[hidden],
.support-rag-ok[hidden],
.support-context-hint[hidden],
.support-field[hidden],
#support-close-reason-wrap[hidden],
#support-internal-wrap[hidden],
#support-admin-claim[hidden],
#support-rag-modal-error[hidden],
#support-rag-modal-ok[hidden],
#support-btn-new[hidden],
#support-empty-new[hidden],
#support-reopen-new[hidden],
#support-attachments[hidden],
#support-sla-banner[hidden],
#support-sla-modal-error[hidden],
#support-sla-modal-ok[hidden],
[data-user-only][hidden],
[data-admin-only][hidden],
[data-support-admin-only][hidden],
.support-inbox__admin-actions[hidden] {
  display: none !important;
}

.support-empty-state {
  margin: auto;
  max-width: 380px;
  text-align: center;
  padding: 2rem 1.25rem;
}
.support-empty-state__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent);
}
.support-empty-state__icon svg { width: 32px; height: 32px; }
.support-empty-state h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  color: var(--text);
}
.support-empty-state p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.support-compose,
.support-chat,
.support-rag {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
}

.support-compose__head,
.support-chat__head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.95rem 1.2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.support-compose__head h2,
.support-chat__identity h2 {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--text);
}
.support-compose__head p,
.support-chat__meta {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.support-back {
  border: 1px solid var(--border);
  background: var(--accent-dim);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.support-back--mobile { display: none; }
.support-chat__code-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}
.support-chat__identity { flex: 1; min-width: 0; }
.support-chat__subject-row {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}
.support-chat__subject-row h2 {
  margin: 0;
}
.support-chat__when {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Barra admin — largura total, grade alinhada */
.support-chat__admin {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.28);
  padding: 0.45rem 1.2rem 0.75rem;
}
.support-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.support-panel-toggle svg {
  transition: transform 0.15s ease;
}
.support-panel-toggle.is-collapsed svg {
  transform: rotate(-90deg);
}
.support-admin-panel {
  display: grid;
  gap: 0.7rem;
}
.support-admin-panel[hidden] {
  display: none !important;
}
.support-admin-panel__assign {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  justify-content: flex-end;
}
.support-assign__label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: auto;
}
.support-assign__label[hidden] {
  display: none !important;
}
.support-admin-panel__assign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: end;
}
.support-admin-panel__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}
body.page-support .support-admin-panel .btn--sm {
  min-height: 2.35rem;
  height: 2.35rem;
  padding: 0 0.95rem;
  font-size: 0.82rem;
  box-sizing: border-box;
}
body.page-support .support-admin-panel .support-select {
  min-height: 2.35rem;
  height: 2.35rem;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
.support-field {
  display: grid;
  gap: 0.22rem;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 9.5rem;
}
.support-field > span { font-weight: 500; }

body.page-support .support-select,
body.page-support .field select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 9.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  color: var(--text);
  padding: 0.48rem 2rem 0.48rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
body.page-support .support-select option,
body.page-support .field select option {
  background: var(--bg-elevated);
  color: var(--text);
}
body.page-support .support-file {
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

body.page-support .btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
}
body.page-support .btn--primary {
  background: var(--accent);
  color: #0b1220;
  border: 1px solid transparent;
}
body.page-support .btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}
body.page-support .btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
body.page-support .btn--ghost:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--accent-dim);
}
.btn--sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

.support-compose__form {
  overflow: auto;
  padding: 1rem 1.2rem 1.35rem;
  display: grid;
  gap: 0.85rem;
}
.support-compose__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.support-compose__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.support-chat__thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background:
    radial-gradient(ellipse at top, rgba(56, 189, 248, 0.05), transparent 55%),
    rgba(2, 6, 23, 0.18);
}
.support-day-sep {
  display: flex;
  justify-content: center;
  margin: 0.35rem 0 0.15rem;
}
.support-day-sep span {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.support-bubble {
  max-width: min(72%, 640px);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.72);
  align-self: flex-start;
}
.support-bubble.is-mine {
  align-self: flex-end;
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
}
.support-bubble.is-staff:not(.is-mine) {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(129, 140, 248, 0.35);
}
.support-bubble.is-bot {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.12);
}
.support-bubble.is-bot header strong { color: #7dd3fc; }
.support-bubble.is-internal {
  border-style: dashed;
  opacity: 0.92;
}
.support-bubble header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.support-bubble p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.92rem;
  color: var(--text);
}
.support-bubble__atts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.support-bubble__att img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.support-chat__composer {
  border-top: 1px solid var(--border);
  padding: 0.8rem 1.2rem 0.95rem;
  background: rgba(2, 6, 23, 0.38);
  display: grid;
  gap: 0.5rem;
  flex-shrink: 0;
}
.support-internal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  width: fit-content;
}
.support-chat__composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: center;
}
.support-chat__composer-row textarea {
  resize: none;
  min-height: 2.35rem;
  height: 2.35rem;
  max-height: 2.35rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  line-height: 1.3;
  overflow-y: auto;
}
.support-chat__composer-tools {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.support-attach-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  color: var(--text);
}
.support-attach-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--accent-dim);
}
body.page-support #support-reply-send {
  min-height: 2.35rem;
  height: 2.35rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

.support-attachments {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 1.2rem 0.75rem;
  background: rgba(2, 6, 23, 0.22);
  display: grid;
  gap: 0.35rem;
}
.support-attachments__body[hidden] {
  display: none !important;
}
.support-attachments__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.support-attachments__item a {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-decoration: none;
  color: inherit;
  max-width: 140px;
}
.support-attachments__item img {
  width: 120px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
}
.support-attachments__item span {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.support-attachments__empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.support-sla-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.support-sla-chip.is-ok {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.support-sla-chip.is-warn {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}
.support-sla-chip.is-critical,
.support-sla-chip.is-breached {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}
.support-sla-chip.is-done {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}
.support-sla-banner {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.support-sla-banner.is-ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.support-sla-banner.is-warn {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}
.support-sla-banner.is-critical,
.support-sla-banner.is-breached {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}
.support-sla-banner.is-done {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}
.support-sla-modal.modal-overlay {
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 80;
}
.support-sla-modal.modal-overlay--hidden {
  display: none !important;
}
.support-sla-modal__dialog {
  width: min(680px, 96vw);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.support-sla-modal__body {
  padding-top: 1.1rem;
}
.support-sla-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.support-sla-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.35);
  cursor: text;
}
.support-sla-card__badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.support-sla-card__hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.support-sla-card__unit {
  font-size: 0.72rem;
  color: var(--muted);
}
.support-sla-card--high {
  border-color: rgba(248, 113, 113, 0.35);
}
.support-sla-card--high .support-sla-card__badge { color: #fca5a5; }
.support-sla-card--normal {
  border-color: rgba(56, 189, 248, 0.35);
}
.support-sla-card--normal .support-sla-card__badge { color: #7dd3fc; }
.support-sla-card--low {
  border-color: rgba(148, 163, 184, 0.35);
}
.support-sla-card--low .support-sla-card__badge { color: #cbd5e1; }
@media (max-width: 640px) {
  .support-sla-grid { grid-template-columns: 1fr; }
}

.support-chat__closed {
  margin: 0;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
}
.support-form__error {
  color: #fca5a5;
  margin: 0;
  font-size: 0.85rem;
}
.support-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.support-context-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #7dd3fc;
}
.support-context-box {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.78rem;
  color: rgba(203, 213, 225, 0.95);
}
.support-context-box__url {
  opacity: 0.8;
  word-break: break-all;
  margin-top: 0.25rem;
}
.support-csat {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.55), rgba(15, 23, 42, 0.4));
}
.support-csat__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}
.support-csat__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.support-csat__hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.support-csat__rate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.support-csat__scale {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 2.4rem;
}
.support-csat__stars {
  display: flex;
  gap: 0.4rem;
}
.support-csat__stars button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(148, 163, 184, 0.55);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.support-csat__stars button:hover {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, so.45);
  background: rgba(251, 191, 36, 0.12);
  transform: translateY(-1px);
}
.support-csat__stars button.is-active {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.65);
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}
.support-csat__stars button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.28);
}
.support-csat__comment-label {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.support-csat__comment-label span {
  opacity: 0.75;
  font-weight: 400;
}
.support-csat__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.15rem;
}
.support-csat__actions .btn {
  min-height: 2.4rem;
  padding: 0.55rem 1.15rem;
  width: auto;
  min-width: 10.5rem;
}
body.page-support #support-csat-comment:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.support-csat-done {
  margin: 0.5rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(6, 78, 59, 0.25);
  font-size: 0.88rem;
  color: rgba(167, 243, 208, 0.98);
}
.support-csat-done__stars {
  letter-spacing: 0.12em;
  color: #fbbf24;
  margin-right: 0.35rem;
}

.support-rag {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  padding: 0;
}
.support-rag .support-compose__head {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, 0.96);
}
.support-rag__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.85rem 1.2rem 1.4rem;
}
.support-rag__upload {
  flex-shrink: 0;
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.45);
}
.support-rag__upload textarea.support-input {
  min-height: 6.5rem;
  max-height: 14rem;
  resize: vertical;
}
.support-rag__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0;
}
.support-rag__list-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
}
.support-rag__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.support-rag__card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.45);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 7.5rem;
}
.support-rag__card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(14, 165, 233, 0.1);
}
.support-rag__card strong {
  color: var(--text);
  font-size: 0.95rem;
  word-break: break-word;
}
.support-rag__card span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.support-rag__card-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}
.support-rag-ok {
  margin: 0;
  color: rgba(110, 231, 183, 0.95);
  font-size: 0.85rem;
}

.support-rag-modal.modal-overlay {
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 80;
}
.support-rag-modal.modal-overlay--hidden {
  display: none !important;
}
.support-rag-modal__dialog {
  width: min(920px, 96vw);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.support-rag-modal__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.support-rag-modal__head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.support-rag-modal__meta {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.support-rag-modal__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.75rem;
}
.support-rag-modal__textarea {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
}
.support-rag-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.25);
}


@media (max-width: 900px) {
  .support-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 4.5rem);
  }
  .support-shell.is-inbox-collapsed {
    grid-template-columns: 1fr;
  }
  .support-inbox { border-right: 0; }
  .support-shell.is-chat-open .support-inbox { display: none; }
  .support-shell.is-chat-open .support-inbox-expand,
  .support-shell.is-chat-open.is-inbox-collapsed .support-inbox-expand {
    display: none !important;
  }
  .support-shell:not(.is-chat-open) .support-stage { display: none; }
  .support-shell:not(.is-chat-open) .support-inbox-collapse { display: none; }
  .support-back--mobile { display: inline-flex; align-items: center; justify-content: center; }
  .support-compose__grid { grid-template-columns: 1fr; }
  .support-bubble { max-width: 92%; }
  .support-admin-panel__assign { flex-direction: column; align-items: stretch; }
}

html[data-login-theme="light"] body.page-support .support-shell {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-login-theme="light"] body.page-support .support-inbox,
html[data-login-theme="light"] body.page-support .support-chat__admin,
html[data-login-theme="light"] body.page-support .support-chat__composer {
  background: rgba(248, 250, 252, 0.95);
}
html[data-login-theme="light"] body.page-support .support-ticket-card {
  background: #fff;
}
html[data-login-theme="light"] body.page-support .support-bubble.is-mine {
  background: rgba(37, 99, 235, 0.1);
}
html[data-login-theme="light"] body.page-support .support-pill.is-active {
  color: #1e3a8a;
}
html[data-login-theme="light"] body.page-support .btn--primary {
  color: #fff;
}

/* ——— Auditoria da IA ——— */
body.page-ai-audit {
  min-height: 100vh;
}

.ai-audit-back-pill {
  max-width: none;
}

.ai-audit-back-pill .actas-pill__btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.ai-audit-back-pill .actas-pill__btn:hover,
.ai-audit-back-pill .actas-pill__btn:visited {
  text-decoration: none;
}

@media (max-width: 900px) {
  .actas-pill.ai-audit-back-pill:not([hidden]) {
    display: inline-flex;
  }
}

.ai-audit {
  padding: 1.5rem 0 3rem;
}

.ai-audit__inner {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.ai-audit__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ai-audit__title {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  letter-spacing: -0.03em;
}

.ai-audit-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.ai-audit-kpi {
  margin: 0;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.72);
  text-align: left;
  color: inherit;
  font: inherit;
}

.ai-audit-kpi--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ai-audit-kpi--clickable:hover {
  border-color: rgba(244, 63, 94, 0.55);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.18);
  transform: translateY(-1px);
}

.ai-audit-kpi__label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.ai-audit-kpi__value {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.ai-audit-kpi__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #fb7185;
}

.ai-audit-panel {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
}

.ai-audit-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.ai-audit-panel__title {
  margin: 0;
  font-size: 1.05rem;
}

.ai-audit-search__input {
  min-width: min(18rem, 70vw);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.45);
  color: #e2e8f0;
}

.ai-audit-table-wrap {
  overflow-x: auto;
}

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

.ai-audit-table th,
.ai-audit-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: middle;
}

.ai-audit-table th {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

.ai-audit-table .is-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ai-audit-table .ai-audit-cell-user {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.ai-audit-table .ai-audit-cell-user strong,
.ai-audit-table .ai-audit-cell-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-audit-table--dislikes {
  table-layout: fixed;
}

.ai-audit-table--dislikes th:nth-child(1),
.ai-audit-table--dislikes td:nth-child(1) { width: 18%; }
.ai-audit-table--dislikes th:nth-child(2),
.ai-audit-table--dislikes td:nth-child(2) { width: 12%; }
.ai-audit-table--dislikes th:nth-child(3),
.ai-audit-table--dislikes td:nth-child(3) { width: 42%; }
.ai-audit-table--dislikes th:nth-child(4),
.ai-audit-table--dislikes td:nth-child(4) { width: 16%; }
.ai-audit-table--dislikes th:nth-child(5),
.ai-audit-table--dislikes td:nth-child(5) { width: 12%; text-align: right; }

.ai-audit-table--dislikes td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-audit-table--dislikes .ai-audit-cell-user {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.ai-audit-table--dislikes .ai-audit-cell-user strong,
.ai-audit-table--dislikes .ai-audit-cell-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-audit-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.ai-audit-row:hover,
.ai-audit-row:focus {
  background: rgba(56, 189, 248, 0.08);
  outline: none;
}

/* Sobrescreve .modal { max-width: 520px } */
.modal.ai-audit-modal {
  width: min(1080px, calc(100vw - 2rem));
  max-width: min(1080px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  margin: auto;
}

.modal.ai-audit-modal--dislikes {
  width: min(1200px, calc(100vw - 2rem));
  max-width: min(1200px, calc(100vw - 2rem));
}

.modal.ai-audit-modal--wide {
  width: min(1280px, calc(100vw - 1.5rem));
  max-width: min(1280px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
}

.modal.ai-audit-modal--qa {
  width: min(860px, calc(100vw - 2rem));
  max-width: min(860px, calc(100vw - 2rem));
}

.ai-audit-modal__head {
  align-items: flex-start;
}

.ai-audit-modal__head-text {
  min-width: 0;
}

.ai-audit-modal__head-text .muted {
  margin: 0.2rem 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-audit-modal__body {
  overflow: auto;
  padding: 1rem 1.25rem 1.35rem;
  flex: 1 1 auto;
  min-height: 0;
}

.ai-audit-qa {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ai-audit-qa__bubble {
  border-radius: 14px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.ai-audit-qa__bubble h3 {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.ai-audit-qa__bubble--user {
  background: rgba(99, 102, 241, 0.16);
  align-self: stretch;
  max-width: 100%;
}

.ai-audit-qa__bubble--assistant {
  background: rgba(30, 41, 59, 0.85);
  max-width: 100%;
}

.ai-audit-qa__content {
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
  line-height: 1.45;
}

.ai-audit-qa__rich {
  white-space: normal;
}

.ai-audit-qa__rich p { margin: 0 0 0.55rem; }
.ai-audit-qa__rich table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}
.ai-audit-qa__rich th,
.ai-audit-qa__rich td {
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.35rem 0.5rem;
}

.ai-audit-user-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.ai-audit-user-stats > div {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.ai-audit-user-stats > div > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
}

.ai-audit-user-stats strong {
  font-size: 1.15rem;
  white-space: nowrap;
}

.ai-audit-user-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.ai-audit-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.3);
  padding: 0.95rem 1.1rem 1.1rem;
  margin-bottom: 0.85rem;
}

.ai-audit-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.ai-audit-chart {
  width: 100%;
  height: auto;
  display: block;
  min-height: 200px;
}

.ai-audit-chart--hours {
  min-height: 150px;
}

.ai-audit-chart__tick,
.ai-audit-chart__val {
  fill: #94a3b8;
  font-size: 11px;
}

.ai-audit-chart__val {
  fill: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
}

.ai-audit-ratio__bar {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.2);
  background-image: linear-gradient(90deg, #34d399 0 var(--up), #f43f5e var(--up) 100%);
}

.ai-audit-ratio__legend {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.55rem;
  font-size: 0.84rem;
  color: #cbd5e1;
  white-space: nowrap;
}

.ai-audit-hbar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ai-audit-hbar__row {
  display: grid;
  grid-template-columns: minmax(10rem, 34%) minmax(0, 1fr) 3.25rem;
  align-items: center;
  gap: 0.65rem 0.75rem;
}

.ai-audit-hbar__label {
  font-size: 0.84rem;
  color: #e2e8f0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-audit-hbar__track {
  height: 0.72rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.ai-audit-hbar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8 55%, #7dd3fc);
  min-width: 0.35rem;
}

.ai-audit-hbar__value {
  text-align: right;
  font-size: 0.8rem;
  font-weight: 650;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .ai-audit-hbar__row {
    grid-template-columns: 1fr 3rem;
    grid-template-areas:
      "label value"
      "track track";
  }
  .ai-audit-hbar__label { grid-area: label; white-space: normal; }
  .ai-audit-hbar__value { grid-area: value; }
  .ai-audit-hbar__track { grid-area: track; }
}

.ai-audit-cols {
  display: grid;
  gap: 0.85rem 1.25rem;
}

.ai-audit-cols--2 { grid-template-columns: 1fr 1fr; }
.ai-audit-cols--3 { grid-template-columns: 1fr 1fr 1fr; }

.ai-audit-rank,
.ai-audit-recent {
  margin: 0;
  padding-left: 1.15rem;
}

.ai-audit-rank li {
  margin-bottom: 0.55rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai-audit-rank__q {
  display: block;
  color: #e2e8f0;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ai-audit-rank__n {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: #38bdf8;
  white-space: nowrap;
}

.ai-audit-recent {
  list-style: none;
  padding-left: 0;
}

.ai-audit-recent li {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.45);
  margin-bottom: 0.55rem;
}

.ai-audit-recent time {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.ai-audit-recent p {
  margin: 0 0 0.25rem;
  font-size: 0.84rem;
  line-height: 1.35;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .ai-audit-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ai-audit-user-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .ai-audit-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-audit-user-grid,
  .ai-audit-cols--2,
  .ai-audit-cols--3 {
    grid-template-columns: 1fr;
  }
  .ai-audit-user-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-audit-rank__q,
  .ai-audit-recent p {
    white-space: normal;
  }
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-kpi,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-panel,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-card,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-user-stats > div {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(100, 116, 139, 0.2);
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-kpi__value,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-rank__q,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-recent p,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-qa__content {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-search__input {
  background: #fff;
  color: #0f172a;
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-qa__bubble--user {
  background: rgba(99, 102, 241, 0.12);
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-qa__bubble--assistant,
html[data-login-theme="light"] body.page-ai-audit .ai-audit-recent li {
  background: #f8fafc;
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-hbar__label {
  color: #0f172a;
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-hbar__track {
  background: rgba(100, 116, 139, 0.18);
}

html[data-login-theme="light"] body.page-ai-audit .ai-audit-chart__tick {
  fill: #64748b;
}
