/* ==========================================================================
   Report Builder · aba 18 do Portfolio Report (Sprint S3)
   Prefixo `rb-`. Nada aqui mexe nas outras 17 abas: tudo sai de `.rb-*`, de `#report-report-builder` ou do marcador
   `body[data-pf-report="report-builder"]` (posto pelo orquestrador só enquanto esta aba está ativa).
   Estrutura:  .rb-shell  = [ .rb-side (menu lateral) | .rb-stage (palco) ]  +  .rb-toast-host
   Estados do shell (atributos, escritos por report-builder.js):
     data-mode="full|solo"        solo = sem menu (acesso negado, indisponível, erro)
     data-collapsed="true|false"  menu em trilho (56 px, só ícones) ou expandido (280 px)
     data-narrow="true|false"     < 768 px: lista e palco viram painéis alternados (mestre → detalhe), somente leitura
     data-panel="list|stage"      painel visível quando estreito
   O menu de contexto (.rb-menu) e o modal (.rb-modal-overlay) são anexados ao <body>, por isso têm tokens próprios.
   ========================================================================== */

.rb-shell,
.rb-menu,
.rb-modal-overlay {
  --rb-ink: #1e293b;
  --rb-ink-2: #475569;
  --rb-ink-3: #64748b;
  --rb-line: #e2e8f0;
  --rb-soft: #f1f5f9;
  --rb-bg: #f8fafc;
  --rb-brand: #1e3a8a;
  --rb-brand-2: #2f4eb2;
  --rb-brand-dark: #0f2a5a;
  --rb-focus: #3b82f6;
  --rb-tint: #e8eeff;
  --rb-tint-2: #dbe6ff;
  --rb-danger: #b91c1c;
  --rb-warn-bg: #fffbeb;
  --rb-warn-line: #fcd34d;
  --rb-warn-ink: #78350f;
  --rb-info-bg: #eff6ff;
  --rb-info-line: #bfdbfe;
  --rb-ok: #15803d;
  --rb-amber: #b45309;
  --rb-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  color: var(--rb-ink);
}

/* `hidden` precisa vencer qualquer `display:` de classe daqui */
.rb-shell [hidden],
.rb-menu [hidden],
.rb-modal-overlay [hidden] {
  display: none !important;
}

.rb-shell *,
.rb-shell *::before,
.rb-shell *::after,
.rb-menu *,
.rb-modal-overlay *,
.rb-modal-overlay *::before,
.rb-modal-overlay *::after {
  box-sizing: border-box;
}

/* ---- só para leitores de tela --------------------------------------------------------------------------------------------------- */
.rb-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- foco visível (teclado) em tudo ------------------------------------------------------------------------------------------- */
.rb-shell :focus-visible,
.rb-menu :focus-visible,
.rb-modal-overlay :focus-visible {
  outline: 2px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-shell .rb-item-main:focus-visible,
.rb-shell .rb-menu-item:focus-visible,
.rb-menu .rb-menu-item:focus-visible {
  outline-offset: -2px;
}

/* ==========================================================================
   Página: a barra de filtros do portfólio não se aplica a esta aba (o Report Builder tem a própria busca)
   ========================================================================== */
body[data-pf-report='report-builder'] .pf-filters {
  display: none;
}
body[data-pf-report='report-builder'] .pf-main {
  padding-top: 12px;
  padding-bottom: 16px;
  max-height: none;
  overflow: visible;
}
#report-report-builder.pf-report-section {
  /* a animação de entrada das outras abas move o conteúdo 8 px: aqui o menu e o palco ficam quietos */
  animation: none;
}

/* ==========================================================================
   Casca
   ========================================================================== */
.rb-shell {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  /* o cabeçalho e as abas da página ocupam ~400 px acima do shell; a página rola, e o shell quase preenche a janela quando chega ao topo */
  height: clamp(560px, calc(100vh - 160px), 980px);
  background: #fff;
  border: 1px solid var(--rb-line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}
.rb-shell[data-collapsed='true'] {
  grid-template-columns: 56px minmax(0, 1fr);
}
.rb-shell[data-mode='solo'] {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: 360px;
}
.rb-shell[data-mode='solo'] .rb-side {
  display: none;
}

/* ==========================================================================
   Menu lateral
   ========================================================================== */
.rb-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--rb-bg);
  border-right: 1px solid var(--rb-line);
}
.rb-side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
}
.rb-side-logo {
  flex: none;
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.rb-side-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--rb-brand-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-side-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 0 12px 12px;
}

/* botões */
.rb-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rb-ink-2);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.rb-icon-btn:hover {
  background: var(--rb-soft);
  color: var(--rb-ink);
}
.rb-icon-btn:active {
  background: var(--rb-line);
}
.rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.rb-btn-primary {
  background: var(--rb-brand);
  color: #fff;
}
.rb-btn-primary:hover:not(:disabled) {
  background: var(--rb-brand-2);
}
.rb-btn-primary:active:not(:disabled) {
  background: var(--rb-brand-dark);
}
.rb-btn-ghost {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--rb-ink);
}
.rb-btn-ghost:hover:not(:disabled) {
  background: var(--rb-soft);
  border-color: #94a3b8;
}
.rb-btn:disabled {
  background: var(--rb-soft);
  border-color: var(--rb-line);
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
.rb-side-new {
  width: 100%;
}

/* busca */
.rb-search {
  position: relative;
  display: flex;
  align-items: center;
}
.rb-search > .rb-ico {
  position: absolute;
  left: 10px;
  color: var(--rb-ink-3);
  pointer-events: none;
}
.rb-search-input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 32px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
}
.rb-search-input::placeholder {
  color: var(--rb-ink-3);
}
.rb-search-input:hover {
  border-color: #94a3b8;
}
.rb-search-input:focus {
  outline: none;
  border-color: var(--rb-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* lista */
.rb-nav {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
  scrollbar-width: thin;
}
.rb-sec + .rb-sec {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rb-line);
}
.rb-sec-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rb-ink-3);
}
.rb-sec-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.rb-sec-toggle:hover {
  background: var(--rb-soft);
  color: var(--rb-ink);
}
.rb-count {
  margin-left: auto;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--rb-line);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  letter-spacing: 0;
  color: var(--rb-ink-2);
}
.rb-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 10px;
}
.rb-item-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.rb-item-main:hover {
  background: var(--rb-tint);
}
.rb-item.is-active .rb-item-main {
  background: var(--rb-tint-2);
  color: var(--rb-brand-dark);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--rb-brand-2);
}
.rb-item-kind {
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--rb-brand-2);
}
.rb-item-text {
  min-width: 0;
  flex: 1;
}
.rb-item-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rb-item.is-archived .rb-item-main {
  color: var(--rb-ink-2);
  font-style: italic;
}
.rb-item.is-archived .rb-item-kind {
  color: var(--rb-ink-3);
}

/* estrela e «⋯»: aparecem ao passar o mouse, ao focar dentro da linha e sempre que estão ligadas ou em telas de toque */
.rb-item-fav,
.rb-item-more {
  width: 28px;
  height: 28px;
  opacity: 0;
}
.rb-item:hover .rb-item-fav,
.rb-item:hover .rb-item-more,
.rb-item:focus-within .rb-item-fav,
.rb-item:focus-within .rb-item-more,
.rb-item-fav.is-on,
.rb-item-more[aria-expanded='true'] {
  opacity: 1;
}
.rb-item-fav.is-on {
  color: #b45309;
}
@media (hover: none), (pointer: coarse) {
  .rb-item-fav,
  .rb-item-more {
    opacity: 1;
    width: 40px;
    height: 40px;
  }
  .rb-item-main {
    min-height: 44px;
  }
  .rb-icon-btn {
    min-width: 40px;
    min-height: 40px;
  }
}

.rb-side-note {
  margin: 8px 4px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
  color: var(--rb-ink-2);
}
.rb-side-note p {
  margin: 0 0 8px;
}
p.rb-side-note {
  margin: 8px 4px;
}

/* esqueleto */
.rb-skel {
  height: 14px;
  margin: 12px 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
  background-size: 400% 100%;
  animation: rb-shimmer 1.4s ease infinite;
}
.rb-skel-list {
  padding: 6px 4px;
}
@keyframes rb-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---- trilho (recolhido) ---------------------------------------------------------------------------------------------------------- */
.rb-side[data-collapsed='true'] .rb-side-head {
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}
.rb-side[data-collapsed='true'] .rb-side-title,
.rb-side[data-collapsed='true'] .rb-new-label,
.rb-side[data-collapsed='true'] .rb-sec-title,
.rb-side[data-collapsed='true'] .rb-item-title {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.rb-side[data-collapsed='true'] .rb-side-body {
  align-items: center;
  padding: 0 8px 8px;
}
.rb-side[data-collapsed='true'] .rb-side-new {
  width: 40px;
  min-width: 40px;
  padding: 0;
}
.rb-side[data-collapsed='true'] .rb-search,
.rb-side[data-collapsed='true'] .rb-item-fav,
.rb-side[data-collapsed='true'] .rb-item-more,
.rb-side[data-collapsed='true'] .rb-sec[data-key='archived'] {
  display: none;
}
.rb-side[data-collapsed='true'] .rb-nav {
  width: 100%;
  margin: 0;
  padding: 0;
}
.rb-side[data-collapsed='true'] .rb-item-main {
  justify-content: center;
  padding: 6px;
}
.rb-side[data-collapsed='true'] .rb-item.is-active .rb-item-main {
  box-shadow: inset 3px 0 0 var(--rb-brand-2);
}

/* ==========================================================================
   Menu de contexto (anexado ao <body>)
   ========================================================================== */
.rb-menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--rb-shadow);
}
.rb-menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
  text-align: left;
  cursor: pointer;
}
.rb-menu-item:hover,
.rb-menu-item:focus {
  background: var(--rb-tint);
  color: var(--rb-brand-dark);
}

/* ==========================================================================
   Palco
   ========================================================================== */
.rb-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}
.rb-stage-skel {
  max-width: 880px;
  padding: 28px 24px;
}
.rb-back {
  display: none;
}

/* estados (acesso negado, indisponível, erro) */
.rb-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  padding: 64px 24px;
  text-align: center;
}
.rb-state-ico {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--rb-tint);
  color: var(--rb-brand);
}
.rb-state-title {
  margin: 4px 0 0;
  font-size: 18px;
  color: var(--rb-brand-dark);
}
.rb-state-body {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--rb-ink-2);
}

/* ---- estado vazio / escolha ----------------------------------------------------------------------------------------------------- */
.rb-landing {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}
.rb-landing-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.rb-landing-logo {
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.rb-landing-title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--rb-brand-dark);
}
.rb-landing-title:focus {
  outline: none;
}
.rb-landing-intro {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--rb-ink-2);
}
.rb-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--rb-info-line);
  border-radius: 10px;
  background: var(--rb-info-bg);
  font-size: 13px;
  color: var(--rb-brand-dark);
}
.rb-subtitle {
  margin: 8px 0 -6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rb-ink-3);
}
.rb-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.rb-cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.rb-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  font: inherit;
  color: var(--rb-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.rb-card:hover:not(:disabled) {
  border-color: var(--rb-focus);
  box-shadow: 0 10px 22px rgba(30, 58, 138, 0.14);
  transform: translateY(-1px);
}
.rb-card:active:not(:disabled) {
  transform: translateY(0);
}
.rb-card:disabled {
  background: var(--rb-bg);
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
.rb-card-ico {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: var(--rb-tint);
  color: var(--rb-brand);
}
.rb-card:disabled .rb-card-ico {
  background: var(--rb-soft);
  color: var(--rb-ink-3);
}
.rb-card-tpl .rb-card-ico {
  width: 36px;
  height: 36px;
}
.rb-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--rb-brand-dark);
}
.rb-card:disabled .rb-card-title {
  color: var(--rb-ink-2);
}
.rb-card-tpl .rb-card-title {
  font-size: 14px;
}
.rb-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--rb-ink-2);
}

/* ---- relatório aberto ---------------------------------------------------------------------------------------------------------- */
.rb-report {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.rb-banner-host {
  display: flex;
  flex-direction: column;
}
.rb-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-size: 13px;
  line-height: 1.45;
}
.rb-banner-info {
  background: var(--rb-info-bg);
  border-bottom: 1px solid var(--rb-info-line);
  color: var(--rb-brand-dark);
}
.rb-banner-warn {
  background: var(--rb-warn-bg);
  border-bottom: 1px solid var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-banner-msg {
  flex: 1 1 260px;
  min-width: 0;
}
.rb-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rb-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--rb-soft);
}
.rb-head-main {
  flex: 1 1 300px;
  min-width: 0;
}
.rb-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--rb-brand-dark);
}
.rb-title:focus {
  outline: none;
}
.rb-title-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: -3px -9px;
  padding: 2px 8px;
  border: 1px dashed transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: text;
}
.rb-title-btn .rb-ico {
  flex: none;
  color: var(--rb-ink-3);
  opacity: 0;
}
.rb-title-btn:hover,
.rb-title-btn:focus-visible {
  border-color: #94a3b8;
  background: var(--rb-bg);
}
.rb-title-btn:hover .rb-ico,
.rb-title-btn:focus-visible .rb-ico {
  opacity: 1;
}
@media (hover: none), (pointer: coarse) {
  .rb-title-btn .rb-ico {
    opacity: 1;
  }
}
.rb-title-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.rb-title-input {
  width: 100%;
  margin: -3px 0;
  padding: 2px 8px;
  border: 2px solid var(--rb-focus);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--rb-ink);
}
.rb-title-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.rb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--rb-tint);
  font-weight: 700;
  color: var(--rb-brand);
}
.rb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rb-fav-btn.is-on {
  color: #b45309;
}
.rb-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-ink-2);
}
.rb-save-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rb-ok);
}
.rb-save[data-state='dirty'] .rb-save-dot,
.rb-save[data-state='saving'] .rb-save-dot {
  background: var(--rb-amber);
}
.rb-save[data-state='saving'] .rb-save-dot {
  animation: rb-pulse 1s ease-in-out infinite;
}
.rb-save[data-state='error'],
.rb-save[data-state='invalid'],
.rb-save[data-state='conflict'],
.rb-save[data-state='blocked'] {
  color: var(--rb-danger);
}
.rb-save[data-state='error'] .rb-save-dot,
.rb-save[data-state='invalid'] .rb-save-dot,
.rb-save[data-state='conflict'] .rb-save-dot,
.rb-save[data-state='blocked'] .rb-save-dot {
  background: var(--rb-danger);
}
@keyframes rb-pulse {
  50% {
    opacity: 0.35;
  }
}

.rb-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 880px;
  padding: 20px 24px 40px;
}
.rb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rb-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-desc,
.rb-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--rb-ink);
}
.rb-desc {
  min-height: 84px;
  resize: vertical;
}
.rb-desc::placeholder,
.rb-input::placeholder {
  color: var(--rb-ink-3);
}
.rb-desc:hover,
.rb-input:hover {
  border-color: #94a3b8;
}
.rb-desc:focus,
.rb-input:focus {
  outline: none;
  border-color: var(--rb-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.rb-desc[aria-disabled='true'] {
  background: var(--rb-bg);
  color: var(--rb-ink-2);
}
.rb-hint-inline {
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-soon {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px dashed #94a3b8;
  border-radius: 14px;
  background: var(--rb-bg);
}
.rb-soon-ico {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--rb-tint);
  color: var(--rb-brand);
}
.rb-soon-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--rb-brand-dark);
}
.rb-soon-body {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--rb-ink-2);
}
.rb-soon-summary {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--rb-line);
  font-size: 12px;
  color: var(--rb-ink-3);
}

/* ==========================================================================
   Aviso curto (dentro do shell, parte de baixo)
   ========================================================================== */
.rb-toast-host {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}
.rb-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 8px 8px 16px;
  border-radius: 12px;
  background: #0f172a;
  box-shadow: var(--rb-shadow);
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  pointer-events: auto;
}
.rb-toast.is-error {
  background: #7f1d1d;
}
.rb-toast-msg {
  min-width: 0;
  overflow-wrap: anywhere;
}
.rb-toast-action {
  flex: none;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  font: inherit;
  font-weight: 700;
  color: #bfdbfe;
  cursor: pointer;
}
.rb-toast-action:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.rb-toast .rb-icon-btn {
  color: #fff;
}
.rb-toast .rb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.rb-toast :focus-visible {
  outline-color: #fff;
}

/* ==========================================================================
   «Novo relatório» (anexado ao <body>; fica abaixo da confirmação do MaestroModalGuard)
   ========================================================================== */
.rb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
}
.rb-modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  padding: 22px 24px;
  overflow-y: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}
.rb-modal-title {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--rb-brand-dark);
}
.rb-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rb-field-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.rb-counter {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--rb-ink-3);
}
.rb-field-error {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-danger);
}
.rb-field-error:empty {
  display: none;
}
.rb-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.rb-fieldset .rb-label {
  margin-bottom: 6px;
  padding: 0;
}
.rb-kinds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.rb-kind {
  position: relative;
  display: block;
  cursor: pointer;
}
.rb-kind input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.rb-kind-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 12px 36px 12px 12px;
  border: 2px solid var(--rb-line);
  border-radius: 12px;
  color: var(--rb-brand);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rb-kind:hover .rb-kind-body {
  border-color: #94a3b8;
}
.rb-kind-body::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 16px;
  height: 16px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  background: #fff;
}
.rb-kind input:checked + .rb-kind-body {
  border-color: var(--rb-brand-2);
  background: var(--rb-tint);
}
.rb-kind input:checked + .rb-kind-body::after {
  border-color: var(--rb-brand-2);
  background: var(--rb-brand-2);
  box-shadow: inset 0 0 0 3px #fff;
}
.rb-kind input:focus-visible + .rb-kind-body {
  outline: 2px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-kind input:disabled + .rb-kind-body {
  background: var(--rb-bg);
  border-style: dashed;
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
.rb-kind input:disabled {
  cursor: not-allowed;
}
.rb-kind-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--rb-brand-dark);
}
.rb-kind input:disabled + .rb-kind-body .rb-kind-title {
  color: var(--rb-ink-2);
}
.rb-kind-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--rb-ink-2);
}
.rb-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Estreito (< 768 px): mestre → detalhe, somente leitura (a regra de «editar» é do JS)
   ========================================================================== */
.rb-shell[data-narrow='true'] {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: 480px;
  overflow: visible;
  border-radius: 12px;
}
.rb-shell[data-narrow='true'][data-panel='list'] .rb-stage,
.rb-shell[data-narrow='true'][data-panel='stage'] .rb-side {
  display: none;
}
.rb-shell[data-narrow='true'] .rb-side {
  border-right: 0;
  border-radius: 12px;
}
.rb-shell[data-narrow='true'] .rb-side-toggle {
  display: none;
}
.rb-shell[data-narrow='true'] .rb-nav {
  overflow: visible;
}
.rb-shell[data-narrow='true'] .rb-stage {
  overflow: visible;
}
.rb-shell[data-narrow='true'] .rb-back {
  display: inline-flex;
  flex: none;
}
.rb-shell[data-narrow='true'] .rb-stage-head {
  padding: 14px 16px 12px;
}
.rb-shell[data-narrow='true'] .rb-banner {
  padding-inline: 16px;
}
.rb-shell[data-narrow='true'] .rb-body {
  padding: 16px 16px 32px;
}
.rb-shell[data-narrow='true'] .rb-landing {
  padding: 20px 16px 32px;
}
.rb-shell[data-narrow='true'] .rb-cards,
.rb-shell[data-narrow='true'] .rb-cards-3 {
  grid-template-columns: minmax(0, 1fr);
}
.rb-shell[data-narrow='true'] .rb-toast-host {
  position: fixed;
  bottom: 12px;
}
.rb-shell[data-narrow='true'] .rb-title {
  font-size: 19px;
}
@media (max-width: 767px) {
  .rb-kinds {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-modal {
    padding: 18px 16px;
  }
}
/* tablet / janelas médias: o menu cede espaço ao palco */
@media (min-width: 768px) and (max-width: 1023px) {
  .rb-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .rb-shell[data-collapsed='true'] {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .rb-cards-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rb-stage-head,
  .rb-banner {
    padding-inline: 18px;
  }
  .rb-body {
    padding-inline: 18px;
  }
}

/* ---- movimento reduzido ---------------------------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .rb-shell,
  .rb-card,
  .rb-btn,
  .rb-icon-btn,
  .rb-item-main,
  .rb-kind-body {
    transition: none;
  }
  .rb-skel,
  .rb-save[data-state='saving'] .rb-save-dot {
    animation: none;
  }
  .rb-card:hover:not(:disabled) {
    transform: none;
  }
}

/* ---- alto contraste do sistema ---------------------------------------------------------------------------------------------------- */
@media (forced-colors: active) {
  .rb-item.is-active .rb-item-main {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
  .rb-kind input:checked + .rb-kind-body {
    outline: 2px solid Highlight;
  }
}

/* ==========================================================================
   S4 · Construtor de consultas (`rb-qb-*`) e exportação
   Estrutura:  .rb-qb > .rb-qb-layout = [ .rb-qb-fields (campos) | .rb-qb-main ]
   .rb-qb-main = fonte · zonas · filtros · opções · barra do resultado · avisos · grade · «Como é calculada»
   Estados no atributo `data-state` do .rb-qb: loading | pick | gone | error | ready. Menu (`.rb-qb-pop`) é `fixed` na raiz do construtor.
   ========================================================================== */
.rb-body-wide {
  max-width: none;
}
.rb-desc-details {
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-desc-sum {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-desc-details[open] > .rb-desc-sum {
  border-bottom: 1px solid var(--rb-line);
}
.rb-desc-details > .rb-field {
  padding: 12px 14px 14px;
}

.rb-qb {
  position: relative;
  min-width: 0;
}
.rb-qb-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.rb-qb-layout.is-readonly {
  grid-template-columns: minmax(0, 1fr);
}
.rb-qb-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.rb-qb-h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--rb-brand-dark);
}
.rb-qb-h3 {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rb-ink-3);
}

/* ---- campos de formulário do construtor --------------------------------------------------------------------------------------- */
.rb-qb-select,
.rb-qb-input {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
}
.rb-qb-select:hover,
.rb-qb-input:hover {
  border-color: #94a3b8;
}
.rb-qb-select:focus,
.rb-qb-input:focus {
  outline: none;
  border-color: var(--rb-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.rb-qb-select:disabled,
.rb-qb-input:disabled {
  background: var(--rb-bg);
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
.rb-qb-limit {
  width: 110px;
}

/* ---- lista de campos ----------------------------------------------------------------------------------------------------------- */
.rb-qb-fields {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-search {
  position: relative;
  display: flex;
  align-items: center;
}
.rb-qb-search > .rb-ico {
  position: absolute;
  left: 10px;
  color: var(--rb-ink-3);
  pointer-events: none;
}
.rb-qb-search .rb-qb-input {
  width: 100%;
  padding-left: 32px;
}
.rb-qb-flist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-qb-field {
  display: flex;
  align-items: center;
  border-radius: 8px;
  cursor: grab;
}
.rb-qb-field:hover {
  background: var(--rb-soft);
}
.rb-qb-field-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
  text-align: left;
  cursor: pointer;
}
.rb-qb-field-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-qb-field-ico,
.rb-qb-chip-ico {
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--rb-brand);
}
.rb-qb-grip {
  display: inline-grid;
  place-items: center;
  flex: none;
  color: #94a3b8;
}
.rb-qb-field:hover .rb-qb-grip {
  color: var(--rb-ink-2);
}
.rb-qb-used {
  flex: none;
  font-size: 9px;
  color: var(--rb-brand-2);
}
.rb-qb-field.is-used .rb-qb-field-name {
  font-weight: 700;
}
.rb-qb-menu-host {
  position: relative;
  display: inline-flex;
  flex: none;
}

/* menu «Adicionar a…» e «Exportar» */
.rb-qb-pop {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  max-width: 320px;
  padding: 4px;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--rb-shadow);
}
.rb-qb-pop-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--rb-ink);
  text-align: left;
  cursor: pointer;
}
.rb-qb-pop-item:hover,
.rb-qb-pop-item:focus {
  background: var(--rb-tint);
  outline: none;
}
.rb-qb-pop-item:focus-visible {
  outline: 2px solid var(--rb-focus);
  outline-offset: -2px;
}
.rb-qb-pop-item.is-disabled {
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
.rb-qb-pop-item.is-disabled:hover {
  background: var(--rb-soft);
}
.rb-qb-pop-why {
  font-size: 11px;
  line-height: 1.35;
  color: var(--rb-amber);
}

/* ---- fonte de dados / zonas ------------------------------------------------------------------------------------------------------- */
.rb-qb-src {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.rb-qb-opt-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-qb-optnote {
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-qb-zones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.rb-qb-zone {
  min-height: 84px;
  padding: 8px 10px 10px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--rb-bg);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rb-qb.is-dragging .rb-qb-zone {
  border-color: #93c5fd;
}
.rb-qb-zone.is-over {
  border: 1.5px solid var(--rb-focus);
  background: var(--rb-tint);
}
.rb-qb-zone.is-refused {
  border-color: #fca5a5;
  background: #fef2f2;
  cursor: not-allowed;
}
.rb-qb-zone.is-refused::after {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--rb-danger);
  content: attr(data-why);
}
.rb-qb-zone-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--rb-ink-2);
}
.rb-qb-count {
  min-width: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--rb-tint-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--rb-brand-dark);
  text-align: center;
}
.rb-qb-count:empty {
  display: none;
}
.rb-qb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rb-qb-zone-empty {
  font-size: 12px;
  line-height: 1.4;
  color: var(--rb-ink-3);
}
.rb-qb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 4px 2px 6px;
  border: 1px solid var(--rb-tint-2);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  cursor: grab;
}
.rb-qb-chip.is-value {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  padding: 4px 4px 6px 6px;
  border-radius: 12px;
}
.rb-qb-chip-top {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.rb-qb-chip-top > .rb-qb-chip-name {
  flex: 1;
}
.rb-qb-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.rb-qb-chip-acts {
  display: inline-flex;
  align-items: center;
}
.rb-qb-mini {
  width: 24px;
  height: 24px;
}
.rb-qb-agg {
  width: calc(100% - 6px);
  min-height: 28px;
  padding: 2px 6px;
  font-size: 12px;
}
.rb-qb-flash {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--rb-warn-line);
  border-radius: 10px;
  background: var(--rb-warn-bg);
  font-size: 13px;
  line-height: 1.45;
  color: var(--rb-warn-ink);
}

/* ---- filtros --------------------------------------------------------------------------------------------------------------------------- */
.rb-qb-filters {
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-filters-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-qb-filters[open] > .rb-qb-filters-sum {
  border-bottom: 1px solid var(--rb-line);
}
.rb-qb-filters-body {
  padding: 12px 14px 14px;
}
.rb-qb-fgroup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-qb-fgroup.is-sub {
  padding: 10px;
  border: 1px solid var(--rb-info-line);
  border-radius: 10px;
  background: var(--rb-info-bg);
}
.rb-qb-fgroup-head,
.rb-qb-fgroup-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rb-qb-fgroup-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-qb-leaf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 8px;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: #fff;
}
.rb-qb-leaf.is-pending {
  border-color: var(--rb-warn-line);
  background: var(--rb-warn-bg);
}
.rb-qb-leaf.is-bad {
  border-color: #fca5a5;
}
.rb-qb-pending {
  font-size: 12px;
  color: var(--rb-amber);
}
.rb-qb-valuebox {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.rb-qb-inline {
  font-size: 13px;
  color: var(--rb-ink-2);
}
.rb-qb-valuebox .rb-qb-input[type='number'] {
  width: 96px;
}
.rb-qb-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-height: 148px;
  overflow: auto;
  padding: 4px 6px;
  border: 1px solid var(--rb-line);
  border-radius: 8px;
}
.rb-qb-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-size: 13px;
  cursor: pointer;
}
.rb-qb-empty-line {
  margin: 0;
  font-size: 13px;
  color: var(--rb-ink-3);
}
.rb-qb-small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

/* ---- opções ------------------------------------------------------------------------------------------------------------------------------ */
.rb-qb-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 8px 12px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-opt {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
}
/* a página tem regra global de `select` em 100%: aqui o seletor tem a largura do conteúdo, na mesma linha do rótulo */
.rb-qb-opts .rb-qb-select {
  width: auto;
  min-width: 150px;
  max-width: 100%;
}
.rb-qb-opt-label {
  white-space: nowrap;
}
.rb-qb-segs {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.rb-qb-seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 12px;
  border: 0;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-qb-seg + .rb-qb-seg {
  border-left: 1px solid #cbd5e1;
}
.rb-qb-seg:hover:not(:disabled) {
  background: var(--rb-soft);
}
.rb-qb-seg.is-on {
  background: var(--rb-brand);
  color: #fff;
}
.rb-qb-seg:disabled {
  background: var(--rb-bg);
  color: var(--rb-ink-3);
  cursor: not-allowed;
}
/* desabilitado não apaga o estado: o formato em uso continua marcado (somente leitura, celular) */
.rb-qb-seg.is-on:disabled {
  background: var(--rb-brand);
  color: #fff;
  opacity: 0.75;
}

/* ---- resultado --------------------------------------------------------------------------------------------------------------------------- */
.rb-qb-resulthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.rb-qb-status {
  flex: 1;
  min-width: 160px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-ink-2);
}
.rb-qb-exporting {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--rb-brand);
}
.rb-qb-head-acts {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rb-qb-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-qb-banner {
  padding: 8px 12px;
  border: 1px solid var(--rb-warn-line);
  border-radius: 10px;
}
.rb-qb-result {
  min-height: 120px;
}
.rb-qb-result.is-updating .rb-qb-gridbox {
  opacity: 0.55;
}
.rb-qb-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 24px;
  border: 1px dashed #94a3b8;
  border-radius: 14px;
  background: var(--rb-bg);
}
.rb-qb-state.is-error {
  border-color: #fca5a5;
}
.rb-qb-state-title {
  margin: 0;
  font-size: 15px;
  color: var(--rb-brand-dark);
}
.rb-qb-state-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--rb-ink-2);
}
.rb-qb-skel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-qb-pick {
  max-width: 880px;
}
.rb-qb-cards {
  margin-top: 12px;
}

/* ---- grade virtualizada ------------------------------------------------------------------------------------------------------------------ */
.rb-qb-gridbox {
  position: relative;
  max-height: min(560px, 70vh);
  overflow: auto;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-inner {
  position: relative;
}
.rb-qb-head {
  position: sticky;
  top: 0;
  z-index: 4;
}
.rb-qb-headrow {
  display: flex;
}
.rb-qb-body {
  position: relative;
}
.rb-qb-row {
  display: flex;
  height: 32px;
}
.rb-qb-body > .rb-qb-row {
  position: absolute;
  left: 0;
}
.rb-qb-cell {
  box-sizing: border-box;
  height: 32px;
  padding: 0 10px;
  overflow: hidden;
  border-right: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  font-size: 13px;
  line-height: 31px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-qb-cell.is-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.rb-qb-cell.is-head {
  background: var(--rb-soft);
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-qb-row.is-odd .rb-qb-cell:not(.is-head) {
  background: #f8fafc;
}
.rb-qb-cell.is-lead {
  position: sticky;
  z-index: 2;
}
.rb-qb-cell.is-head.is-lead {
  z-index: 5;
}
.rb-qb-cell.is-lead-last {
  border-right: 1px solid #cbd5e1;
}
.rb-qb-row.is-total .rb-qb-cell:not(.is-head),
.rb-qb-cell.is-coltotal:not(.is-head) {
  background: var(--rb-info-bg);
  font-weight: 700;
}
.rb-qb-row.is-grand .rb-qb-cell:not(.is-head) {
  border-top: 2px solid var(--rb-brand);
  background: var(--rb-tint);
  font-weight: 800;
}
.rb-qb-cell.is-head.is-coltotal {
  background: var(--rb-tint-2);
}

/* ---- «Como esta consulta é calculada» ------------------------------------------------------------------------------------------------- */
.rb-qb-how {
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-how-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-qb-how-list {
  margin: 0;
  padding: 4px 14px 4px 34px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--rb-ink);
}
.rb-qb-how-note {
  margin: 0;
  padding: 4px 14px 12px;
  font-size: 12px;
  color: var(--rb-ink-3);
}

/* ---- responsivo ------------------------------------------------------------------------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 1100px) {
  .rb-qb-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
  }
  .rb-qb-zones {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 767px) {
  .rb-qb-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-qb-zones {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-qb-gridbox {
    max-height: 60vh;
  }
  .rb-qb-head-acts {
    width: 100%;
  }
}
@media (hover: none), (pointer: coarse) {
  .rb-qb-mini {
    width: 32px;
    height: 32px;
  }
  .rb-qb-field-main,
  .rb-qb-pop-item {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rb-qb-zone {
    transition: none;
  }
}
@media (forced-colors: active) {
  .rb-qb-zone.is-over {
    outline: 2px solid Highlight;
  }
  .rb-qb-seg.is-on {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
  .rb-qb-cell {
    border-color: CanvasText;
  }
}
@media print {
  .rb-qb-fields,
  .rb-qb-zones,
  .rb-qb-opts,
  .rb-qb-head-acts {
    display: none;
  }
  .rb-qb-gridbox {
    max-height: none;
    overflow: visible;
  }
}

/* S4 · ajustes finos dos seletores do filtro, do menu e do invólucro */
.rb-qb-slot,
.rb-qb-fgroup-list {
  min-width: 0;
}
/* `styles.css` põe `select { width: 100% }` em toda a página: nos filtros os controles ficam lado a lado, cada um com a largura do conteúdo */
.rb-qb-leaf .rb-qb-select,
.rb-qb-leaf .rb-qb-input,
.rb-qb-fgroup-head .rb-qb-select,
.rb-qb-fgroup-foot .rb-qb-select {
  width: auto;
  max-width: 100%;
}
.rb-qb-leaf .rb-qb-input:not([type='number']):not([type='checkbox']) {
  min-width: 200px;
}
.rb-qb-f-field {
  min-width: 140px;
}
.rb-qb-f-op {
  min-width: 130px;
}
.rb-qb-f-gop {
  font-weight: 700;
}
.rb-qb-f-add {
  max-width: 240px;
}
.rb-qb-leaf-x {
  margin-left: auto;
}
.rb-qb-field-menu {
  width: 28px;
  height: 28px;
}
.rb-qb-pop-label {
  font-weight: 600;
}

/* ==========================================================================
   S5 · Dashboard Builder (`rb-dash-*`, `rb-dw-*` = cartão/widget, `rb-ins-*` = inspetor)
   Estrutura:  .rb-dash = [ barra | filtros | paleta (faixa) ] + .rb-dash-main = [ palco(.rb-dash-stagewrap > .rb-dash-canvas) | inspetor ]
   Atributos escritos por rb-dashboard.js:  .rb-dash[data-mode="edit|view"]  [data-state="loading|ready|error"]
   O canvas é uma CSS Grid de 12 colunas SEM borda nem padding (a matemática de arrastar mede o próprio retângulo dele);
   a posição de cada cartão (grid-column/grid-row) é inline e escrita pelo JS a partir do rb-layout.
   ========================================================================== */
.rb-dash {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px 16px 24px;
  container-type: inline-size;
  container-name: rbdash;
}
.rb-body-dash {
  max-width: none;
  padding: 0;
  gap: 0;
}
.rb-dash-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.rb-dash-spacer {
  flex: 1 1 0;
}
.rb-dash-modes,
.rb-dash-hist {
  display: inline-flex;
  gap: 4px;
}
.rb-dash-modes {
  padding: 3px;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: var(--rb-bg);
}
.rb-dash-seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rb-ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rb-dash-seg:hover:not(:disabled) {
  background: var(--rb-soft);
}
.rb-dash-seg.is-on {
  background: var(--rb-brand);
  color: #fff;
}
.rb-dash-seg:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.rb-dash-lbl {
  font-size: 13px;
}
.rb-dash-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--rb-ink-3);
}

/* filtros do dashboard (chips) */
.rb-dash-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: var(--rb-bg);
}
.rb-dash-filters-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-dash-filters-none,
.rb-dash-filters-note {
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-dash-filters-note {
  flex-basis: 100%;
}
.rb-dash-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--rb-tint-2);
  border-radius: 999px;
  background: var(--rb-tint);
  color: var(--rb-brand-dark);
  font-size: 12px;
}
.rb-dash-chip.is-pending {
  border-style: dashed;
  background: var(--rb-warn-bg);
  color: var(--rb-warn-ink);
}
.rb-dash-chip-body {
  padding: 4px 8px 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
}
button.rb-dash-chip-body {
  cursor: pointer;
}
span.rb-dash-chip-body {
  padding-right: 12px;
}
.rb-dash-chip-x {
  width: 24px;
  height: 24px;
  margin-right: 2px;
}
.rb-dash-addfilter {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.rb-dash-pop {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  max-width: min(440px, calc(100vw - 16px));
  max-height: 60vh;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--rb-shadow);
}
.rb-dash-pop-item {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rb-ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rb-dash-pop-item:hover,
.rb-dash-pop-item:focus-visible {
  background: var(--rb-tint);
}
.rb-dash-pop-note {
  margin: 4px 2px;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-dash-pop-actions {
  display: flex;
  justify-content: flex-end;
}
.rb-dash-pop-filter .rb-qb-leaf {
  border: 0;
  padding: 0;
}

/* palco | inspetor (a paleta é uma faixa acima: o canvas precisa de largura) */
.rb-dash-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 12px;
  align-items: start;
  min-width: 0;
}
.rb-dash[data-mode='view'] .rb-dash-main {
  grid-template-columns: minmax(0, 1fr);
}
.rb-dash-inspector {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-dash-inspector[hidden] {
  display: none;
}
.rb-dash-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 10px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-dash-palette[hidden] {
  display: none;
}
.rb-dash-pal-title {
  margin: 0;
  font-size: 13px;
  color: var(--rb-brand-dark);
}
.rb-dash-pal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-dash-pal-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--rb-line);
  border-radius: 999px;
  background: var(--rb-bg);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.rb-dash-pal-item:hover {
  border-color: var(--rb-focus);
  background: var(--rb-tint);
}
.rb-dash-pal-grip {
  display: inline-flex;
  color: var(--rb-ink-3);
  touch-action: none;
}
.rb-dash-pal-ico {
  display: inline-flex;
  color: var(--rb-brand);
}
.rb-dash-pal-text {
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
}
.rb-dash-pal-name {
  font-size: 13px;
  font-weight: 700;
}
.rb-dash-pal-desc {
  display: none;
}
.rb-dash-pal-addlbl {
  font-size: 12px;
}
.rb-dash-pal-add {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}
.rb-dash-pal-note {
  flex: 1 1 220px;
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--rb-ink-3);
}
.rb-ins-keys {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--rb-soft);
}
.rb-dash-dragghost {
  position: fixed;
  z-index: 100000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  background: #e8eeff;
  color: #0f2a5a;
  font: 600 13px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
  pointer-events: none;
}

/* palco e canvas */
.rb-dash-stagewrap {
  position: relative;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: var(--dw-bg, #fff);
}
.rb-dash-canvas {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--dash-row, 40px);
  gap: var(--dash-gap, 12px);
  min-width: 0;
  min-height: 160px;
}
.rb-dash[data-mode='edit'] .rb-dash-canvas {
  /* guias das 12 colunas, só na edição */
  background-image: linear-gradient(to right, rgba(148, 163, 184, 0.14) calc(100% - var(--dash-gap, 12px)), transparent 0);
  background-size: calc((100% + var(--dash-gap, 12px)) / 12) 100%;
}
.rb-dash-ghost {
  z-index: 1;
  border: 2px dashed var(--rb-focus);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  pointer-events: none;
}
.rb-dash-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}
.rb-dash-empty[hidden] {
  display: none;
}
.rb-dash-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 420px;
  text-align: center;
  color: var(--rb-ink-3);
}
.rb-dash-empty-title {
  margin: 0;
  font-size: 16px;
  color: var(--rb-ink);
}
.rb-dash-empty-body {
  margin: 0;
  font-size: 13px;
}

/* cartão (widget) */
.rb-dw {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: #fff;
  color: var(--rb-ink);
}
.rb-dash[data-mode='edit'] .rb-dw {
  cursor: default;
}
.rb-dw.is-selected {
  border-color: var(--rb-focus);
  box-shadow: 0 0 0 2px var(--rb-focus);
}
.rb-dw:focus-visible {
  outline: 3px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-dw.is-dragging {
  z-index: 3;
  opacity: 0.9;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
}
.rb-dw.is-updating .rb-dw-body {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.rb-dw-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 2px 6px 2px 8px;
  border-bottom: 1px solid var(--rb-soft);
  background: var(--rb-bg);
}
.rb-dw-head[hidden] {
  display: none;
}
.rb-dash[data-mode='edit'] .rb-dw-head {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.rb-dw.is-dragging .rb-dw-head {
  cursor: grabbing;
}
.rb-dw-grip {
  display: inline-flex;
  color: var(--rb-ink-3);
  touch-action: none;
}
.rb-dw-type {
  display: inline-flex;
  color: var(--rb-brand);
}
.rb-dw-title {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.rb-dw-acts {
  display: inline-flex;
  gap: 2px;
}
.rb-dw-btn {
  width: 28px;
  height: 28px;
}
.rb-dw-badge {
  display: inline-flex;
  align-items: center;
  max-width: 45%;
  padding: 2px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--rb-info-line);
  border-radius: 999px;
  background: var(--rb-info-bg);
  color: var(--rb-brand);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.rb-dw-badge.has-ignored {
  border-color: var(--rb-warn-line);
  background: var(--rb-warn-bg);
  color: var(--rb-warn-ink);
}
.rb-dw-body {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
.rb-dw-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  padding: 1px 4px 1px 10px;
  border-top: 1px solid var(--rb-soft);
  font-size: 11px;
  color: var(--rb-ink-3);
}
.rb-dw-foot[hidden] {
  display: none;
}
.rb-dw-asof {
  flex: 1 1 80px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-dw-trunc {
  display: inline-flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 4px;
  order: 3;
  color: var(--rb-warn-ink);
}
.rb-dw-foot .rb-dw-btn {
  flex: none;
  /* S9.6: WCAG 2.5.8 (AA) pede alvo de pelo menos 24×24 px (eram 22). A margem negativa de 1 px mantém o espaço que o botão ocupa no rodapé: o layout dos cartões não muda. */
  width: 24px;
  height: 24px;
  margin: -1px;
}

/* alças de redimensionar (só na edição) */
.rb-dw-handle {
  position: absolute;
  z-index: 2;
  touch-action: none;
}
.rb-dw-handle.is-e {
  top: 12px;
  right: 0;
  bottom: 12px;
  width: 8px;
  cursor: ew-resize;
}
.rb-dw-handle.is-s {
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 8px;
  cursor: ns-resize;
}
.rb-dw-handle.is-se {
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, var(--rb-ink-3) 55%, var(--rb-ink-3) 65%, transparent 65%, transparent 78%, var(--rb-ink-3) 78%, var(--rb-ink-3) 88%, transparent 88%);
}
.rb-dash[data-mode='view'] .rb-dw-handle {
  display: none;
}
.rb-dw-handle.is-e:hover,
.rb-dw.is-selected .rb-dw-handle.is-e {
  background: rgba(59, 130, 246, 0.35);
}
.rb-dw-handle.is-s:hover,
.rb-dw.is-selected .rb-dw-handle.is-s {
  background: rgba(59, 130, 246, 0.35);
}

/* corpo: texto */
.rb-dw-text {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.rb-dw-text.is-empty {
  color: var(--rb-ink-3) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  font-style: italic !important;
}

/* corpo: KPI. O status nunca é só cor: sempre ícone + texto */
.rb-dw-kpi {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  height: 100%;
  padding: 8px 14px;
  border-left: 4px solid var(--dw-accent, transparent);
  overflow: hidden;
}
.rb-dw-kpi-label {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-ink-2);
}
.rb-dw[data-type='kpi'] .rb-dw-body {
  container-type: size;
}
.rb-dw-kpi-value {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(22px, 3.2vw, 38px);
  font-size: clamp(18px, 34cqh, 40px);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--rb-ink);
}
.rb-dw-kpi-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
.rb-dw-kpi.is-ok .rb-dw-kpi-status {
  color: #15803d;
}
.rb-dw-kpi.is-warn .rb-dw-kpi-status {
  color: #b45309;
}
.rb-dw-kpi.is-bad .rb-dw-kpi-status {
  color: #b91c1c;
}
.rb-dw-kpi-goal {
  margin: 0;
  font-size: 11px;
  color: var(--rb-ink-3);
}

/* corpo: tabela e pivot reaproveitam a grade da S4 */
.rb-dw-body .rb-qb-gridbox {
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
}

/* corpo: estados */
.rb-dw-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  padding: 12px;
  text-align: center;
  overflow: auto;
}
.rb-dw-state-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.rb-dw-state-body {
  margin: 0;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-dw-state.is-error .rb-dw-state-title {
  color: var(--rb-danger);
}
.rb-dw-state.is-denied .rb-dw-state-title {
  color: var(--rb-ink-2);
}
.rb-dw-state-extra {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.rb-dw-act {
  min-height: 30px;
  font-size: 12px;
}
.rb-dw-skel {
  padding: 8px 12px;
}

/* editor de dados do widget (o construtor de consultas da S4 num diálogo) */
.rb-modal.rb-dash-data-modal {
  display: flex;
  flex-direction: column;
  max-width: min(1240px, calc(100vw - 24px));
  height: calc(100vh - 32px);
}
.rb-dash-data-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.rb-dash-data-modal .rb-modal-actions {
  margin-top: 12px;
}

/* inspetor */
.rb-ins-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rb-ins-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-ins-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--rb-brand-dark);
}
.rb-ins-sub {
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--rb-ink-2);
}
.rb-ins-head .rb-ins-title {
  flex: 1 1 0;
}
.rb-ins-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rb-line);
}
.rb-ins-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--rb-ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rb-ins-tab:hover {
  color: var(--rb-ink);
}
.rb-ins-tab.is-on {
  border-bottom-color: var(--rb-brand);
  color: var(--rb-brand);
}
.rb-ins-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rb-ins-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rb-ins-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-ins-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--rb-ink-3);
}
.rb-ins-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.rb-ins-textarea {
  min-height: 96px;
  resize: vertical;
}
.rb-ins-btn {
  align-self: flex-start;
}
.rb-ins-how {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 8px 8px 8px 24px;
  border-radius: 8px;
  background: var(--rb-bg);
  font-size: 12px;
  color: var(--rb-ink-2);
}
.rb-ins-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.rb-ins-color {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--rb-line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.rb-ins-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--rb-line);
  cursor: pointer;
}
.rb-ins-swatch.is-on {
  box-shadow: 0 0 0 2px var(--rb-brand);
}
.rb-ins-none {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
.rb-ins-strip {
  display: flex;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--rb-line);
}
.rb-ins-strip-c {
  flex: 1 1 0;
  height: 16px;
}
.rb-ins-warn {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0 0;
  padding: 6px 8px;
  border: 1px solid var(--rb-warn-line);
  border-radius: 8px;
  background: var(--rb-warn-bg);
  color: var(--rb-warn-ink);
  font-size: 12px;
}
.rb-ins-seg {
  display: inline-flex;
  gap: 2px;
}
.rb-ins-segbtn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--rb-line);
  background: #fff;
  color: var(--rb-ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.rb-ins-segbtn.is-on {
  border-color: var(--rb-brand);
  background: var(--rb-tint);
  color: var(--rb-brand-dark);
  font-weight: 700;
}
.rb-ins-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  font-size: 13px;
}
.rb-ins-fieldset {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
}
.rb-ins-rule {
  margin: 0;
  font-size: 12px;
  color: var(--rb-ink-2);
}
.rb-ins-eff {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-ins-eff-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--rb-line);
  border-radius: 8px;
  font-size: 12px;
}
.rb-ins-eff-item.is-ignored,
.rb-ins-eff-item.is-na,
.rb-ins-eff-item.is-incomplete {
  background: var(--rb-bg);
  color: var(--rb-ink-3);
}
.rb-ins-eff-text {
  overflow-wrap: anywhere;
}
.rb-ins-eff-note {
  font-style: italic;
}
.rb-ins-leaves {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-dash-inspector .rb-qb-leaf .rb-qb-input:not([type='number']):not([type='checkbox']) {
  min-width: 0;
  width: 100%;
}
.rb-dash-inspector .rb-qb-leaf .rb-qb-select {
  width: 100%;
}

/* contêiner estreito (menu aberto + tela média): o inspetor desce para baixo do palco */
@container rbdash (max-width: 899px) {
  .rb-dash-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-dash-inspector {
    position: static;
    max-height: none;
  }
}
/* < 768 px: somente leitura, uma coluna, na ordem de leitura (a do DOM) */
@media (max-width: 767px) {
  .rb-dash {
    padding: 8px 8px 20px;
  }
  .rb-dash-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-dash-stagewrap {
    padding: 8px;
  }
  .rb-dash-canvas {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none !important;
    grid-auto-rows: auto;
    min-height: 0 !important;
    background-image: none !important;
  }
  .rb-dw {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    min-height: 120px;
  }
  .rb-dw[data-type='table'],
  .rb-dw[data-type='pivot'] {
    height: 360px;
  }
  /* gráfico: sem altura definida o corpo (flex) colapsa e o desenho some; 340 px dão o gráfico, a legenda e as notas */
  .rb-dw[data-type='bar'],
  .rb-dw[data-type='line'],
  .rb-dw[data-type='pie'],
  .rb-dw[data-type='pareto'],
  .rb-dw[data-type='boxplot'] {
    height: 340px;
  }
  .rb-dw[data-type='kpi'] {
    min-height: 150px;
  }
  .rb-dw[data-type='text'] {
    min-height: 0;
  }
  .rb-dw[data-type='text'] .rb-dw-body {
    flex: 0 0 auto;
    overflow: visible;
  }
  .rb-dw[data-type='text'] .rb-dw-text {
    height: auto;
    overflow: visible;
  }
  .rb-dw-handle,
  .rb-dash-palette,
  .rb-dash-inspector {
    display: none !important;
  }
}
@media (hover: none), (pointer: coarse) {
  .rb-dw-btn,
  .rb-dash-chip-x {
    width: 36px;
    height: 36px;
  }
  .rb-dw-handle.is-e {
    width: 16px;
  }
  .rb-dw-handle.is-s {
    height: 16px;
  }
  .rb-dw-handle.is-se {
    width: 24px;
    height: 24px;
  }
  .rb-dash-seg {
    min-height: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rb-dw.is-updating .rb-dw-body {
    transition: none;
  }
}
@media (forced-colors: active) {
  .rb-dw.is-selected {
    outline: 3px solid Highlight;
  }
  .rb-dash-ghost {
    border-color: Highlight;
  }
  .rb-dash-seg.is-on {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
@media print {
  .rb-dash-bar,
  .rb-dash-palette,
  .rb-dash-inspector,
  .rb-dw-handle,
  .rb-dw-acts,
  .rb-dw-foot {
    display: none !important;
  }
  .rb-dash-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-dw {
    break-inside: avoid;
  }
}

/* ---- cruzamento de tabelas (S5.12) ---------------------------------------------------------------------------------------------- */
.rb-qb-h4 {
  margin: 8px 0 2px;
  font-size: 12px;
  font-weight: 800;
  color: var(--rb-ink-2);
}
.rb-qb-cross-list {
  margin-top: 12px;
  border-top: 1px solid var(--rb-line);
  padding-top: 8px;
}
.rb-qb-cross-sum {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-qb-cross-chev {
  display: inline-flex;
  margin-left: auto;
  color: var(--rb-ink-3);
  transition: transform 0.15s ease;
}
.rb-qb-cross-list[open] > .rb-qb-cross-sum .rb-qb-cross-chev {
  transform: rotate(180deg);
}
@media (prefers-reduced-motion: reduce) {
  .rb-qb-cross-chev {
    transition: none;
  }
}
.rb-qb-cross-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rb-qb-cross-warn strong {
  flex: none;
  white-space: nowrap;
}
.rb-qb-cross-warn svg {
  flex: none;
  margin-top: 1px;
}
.rb-qb-cross-hint {
  margin: 4px 0 6px;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-qb-cross-table {
  margin-top: 4px;
}
.rb-qb-cross {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--rb-tint-2);
  border-radius: 12px;
  background: #fff;
}
.rb-qb-cross[hidden] {
  display: none;
}
.rb-qb-cross-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.rb-qb-cross-tables {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-qb-cross-warn,
.rb-qb-cross-nolink,
.rb-qb-cross-note,
.rb-qb-cross-filter-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.rb-qb-cross-warn {
  padding: 6px 8px;
  border: 1px solid var(--rb-warn-line);
  border-radius: 8px;
  background: var(--rb-warn-bg);
  color: var(--rb-warn-ink);
}
.rb-qb-cross-nolink {
  color: var(--rb-warn-ink);
  font-weight: 700;
}
.rb-qb-cross-note,
.rb-qb-cross-filter-note {
  color: var(--rb-ink-3);
}
.rb-qb-cross-filter-note {
  margin-bottom: 8px;
}
.rb-qb-chip.is-foreign {
  border-style: dashed;
}
.rb-qb-chip.is-gone {
  opacity: 0.75;
  border-color: var(--rb-warn-line);
  background: var(--rb-warn-bg);
}
.rb-cross-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--rb-warn-line);
  border-radius: 999px;
  background: var(--rb-warn-bg);
  color: var(--rb-warn-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- gráficos (S6) --------------------------------------------------------------------------------------------------------------- */
/* Regras que valem para TODO gráfico:
   • a cor de cada série vem como atributo de apresentação do SVG (fill/stroke) e NÃO é sobrescrita aqui — este arquivo só dá
     espessura, tinta de texto, grade e a «folga» da cor da superfície entre áreas que se tocam;
   • o cartão do widget é branco (.rb-dw), então a tinta é a escura fixa; os tokens abaixo são os do validador de paleta. */
.rb-ch {
  --rb-ch-ink: #0f172a;
  --rb-ch-muted: #475569;
  --rb-ch-grid: #e2e8f0;
  --rb-ch-surface: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 4px 8px 4px;
  box-sizing: border-box;
  color: var(--rb-ch-ink);
}
.rb-ch-bar {
  display: flex;
  justify-content: flex-end;
  flex: none;
}
.rb-ch-toggle {
  min-height: 24px;
  padding: 0 8px;
  gap: 4px;
  font-size: 11px;
  color: var(--rb-ch-muted);
}
.rb-ch-toggle[aria-pressed='true'] {
  color: var(--rb-brand-dark);
  background: var(--rb-tint);
}
.rb-ch-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
}
.rb-ch-stage:focus-visible,
.rb-ch-tablewrap:focus-visible {
  outline: 3px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-ch-tableslot {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}
.rb-ch-tableslot[hidden],
.rb-ch-stage[hidden],
.rb-ch-legend[hidden],
.rb-ch-notes[hidden] {
  display: none;
}
.rb-ch-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  font-family: inherit;
}

/* texto do desenho: sempre tinta de texto, nunca a cor da série */
.rb-ch-t {
  fill: var(--rb-ch-ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.rb-ch-tick {
  fill: var(--rb-ch-muted);
}
.rb-ch-axis-title {
  fill: var(--rb-ch-muted);
  font-weight: 700;
}
.rb-ch-value {
  fill: var(--rb-ch-ink);
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--rb-ch-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.rb-ch-value-in {
  font-weight: 700;
  pointer-events: none;
}
.rb-ch-value-in.rb-ch-ink-dark {
  fill: #0f172a;
}
.rb-ch-value-in.rb-ch-ink-light {
  fill: #ffffff;
}
.rb-ch-value-in.has-plate {
  /* sobre um padrão listrado o número perderia contraste: ganha uma «placa» da cor da superfície */
  fill: var(--rb-ch-ink);
  paint-order: stroke;
  stroke: var(--rb-ch-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.rb-ch-center-value {
  fill: var(--rb-ch-ink);
  font-size: 16px;
  font-weight: 800;
}

/* grupos do desenho: só agrupam. O ponteiro é resolvido por COORDENADA no widget (geo.hit — o mesmo caminho do teclado),
   então nenhuma marca precisa receber o evento; assim o SVG inteiro responde igual em qualquer tamanho. */
.rb-ch-frame,
.rb-ch-cats,
.rb-ch-bars,
.rb-ch-labels,
.rb-ch-areas,
.rb-ch-lines,
.rb-ch-markers,
.rb-ch-cum,
.rb-ch-slices,
.rb-ch-center,
.rb-ch-boxes {
  pointer-events: none;
}

/* moldura */
.rb-ch-grid {
  stroke: var(--rb-ch-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.rb-ch-grid.is-zero {
  stroke: var(--rb-ch-muted);
}
.rb-ch-baseline {
  stroke: var(--rb-ch-muted);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.rb-ch-cross {
  stroke: var(--rb-ch-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

/* marcas */
.rb-ch-seg {
  transition: opacity 0.12s ease;
}
.rb-ch-seg.is-stacked,
.rb-ch-seg.is-slice {
  /* a «folga» de 2px entre áreas que se tocam é o traço da cor da superfície */
  stroke: var(--rb-ch-surface);
  stroke-width: 2px;
  stroke-linejoin: round;
}
.rb-ch-seg.is-active {
  filter: brightness(0.9);
}
.rb-ch-line {
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rb-ch-line.is-single {
  /* ponto isolado (vizinhos sem dado): a linha some e o marcador carrega o ponto */
  stroke-width: 0;
}
.rb-ch-area {
  stroke: none;
}
.rb-ch-mk:not(.rb-ch-mk-line):not(.rb-ch-mk-ring) {
  stroke: var(--rb-ch-surface);
  stroke-width: 2px;
}
.rb-ch-mk-ring {
  fill: var(--rb-ch-surface);
  stroke-width: 2px;
}
.rb-ch-mk-line {
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
}
.rb-ch-mk.is-active {
  stroke-width: 3px;
}
.rb-ch-threshold {
  stroke: var(--rb-ch-muted);
  stroke-width: 1px;
  stroke-dasharray: 5 4;
}
.rb-ch-threshold-label {
  fill: var(--rb-ch-muted);
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--rb-ch-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.rb-ch-whisker {
  stroke-width: 1.5px;
  stroke-linecap: round;
}
.rb-ch-boxbody {
  stroke-width: 1.5px;
}
.rb-ch-median {
  stroke-width: 3px;
  stroke-linecap: round;
}
.rb-ch-box.is-low-n .rb-ch-boxbody {
  /* poucos dados: o traçado tracejado avisa que os quartis são frágeis */
  stroke-dasharray: 4 3;
}
.rb-ch-box.is-active .rb-ch-boxbody {
  stroke-width: 2.5px;
}

/* dica (mesma função do texto do leitor de tela) */
.rb-ch-tip {
  position: absolute;
  z-index: 3;
  min-width: 120px;
  max-width: 260px;
  padding: 6px 8px;
  border: 1px solid var(--rb-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  color: var(--rb-ch-ink);
  font-size: 12px;
  pointer-events: none;
}
.rb-ch-tip[hidden] {
  display: none;
}
.rb-ch-tip-title {
  margin-bottom: 4px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.rb-ch-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}
.rb-ch-tip-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--rb-ch-muted);
  overflow-wrap: anywhere;
}
.rb-ch-tip-value {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* legenda e notas */
.rb-ch-legend,
.rb-ch-notes {
  flex: none;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-ch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  padding-top: 4px;
  max-height: 64px;
  overflow: auto;
}
.rb-ch-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  color: var(--rb-ch-ink);
}
.rb-ch-swatch {
  flex: none;
}
.rb-ch-legend-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.rb-ch-legend-detail {
  color: var(--rb-ch-muted);
  font-variant-numeric: tabular-nums;
}
.rb-ch-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
  max-height: 56px;
  overflow: auto;
}
.rb-ch-note {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--rb-ink-3);
}
.rb-ch-note svg {
  flex: none;
  margin-top: 1px;
}

/* a mesma informação, em tabela */
.rb-ch-tablewrap {
  height: 100%;
  overflow: auto;
}
.rb-ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.rb-ch-caption {
  padding: 4px 0;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--rb-ink-3);
}
.rb-ch-table th,
.rb-ch-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--rb-soft);
  text-align: left;
}
.rb-ch-table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--rb-line);
  font-weight: 800;
  color: var(--rb-ink-2);
}
.rb-ch-table tbody th {
  font-weight: 600;
}
.rb-ch-table .is-num {
  text-align: right;
}

/* só para o leitor de tela */
.rb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* estado «esta consulta não cabe neste gráfico» */
.rb-dw-state.is-invalid .rb-dw-state-title {
  color: var(--rb-warn-ink);
}

/* inspetor: tipo de gráfico, sugestão e cores por série */
.rb-ins-ctypes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rb-ins-ctypes .rb-ins-segbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}
.rb-ins-suggest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--rb-tint-2);
  border-radius: 8px;
  background: var(--rb-tint);
}
.rb-ins-suggest .rb-ins-hint {
  color: var(--rb-ink-2);
}
.rb-ins-series {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rb-ins-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

@media (prefers-reduced-motion: reduce) {
  .rb-ch-seg {
    transition: none;
  }
}
@media (forced-colors: active) {
  /* modo de alto contraste: a cor da série some; o padrão/marcador e o contorno garantem a leitura */
  .rb-ch-t,
  .rb-ch-value,
  .rb-ch-value-in,
  .rb-ch-center-value {
    fill: CanvasText;
    stroke: none;
  }
  .rb-ch-seg,
  .rb-ch-boxbody {
    stroke: CanvasText;
    stroke-width: 1px;
  }
  .rb-ch-line,
  .rb-ch-whisker,
  .rb-ch-median {
    stroke: CanvasText;
  }
  .rb-ch-grid,
  .rb-ch-baseline,
  .rb-ch-cross,
  .rb-ch-threshold {
    stroke: GrayText;
  }
  .rb-ch-tip {
    border-color: CanvasText;
  }
}
@media print {
  .rb-ch-bar,
  .rb-ch-tip {
    display: none !important;
  }
  .rb-ch-legend,
  .rb-ch-notes {
    max-height: none;
    overflow: visible;
  }
}

/* ==========================================================================
   S7 — compartilhamento, grupos e gestão
   Selos no menu, diálogo «Compartilhar», seletor (combobox) e «Compartilhamento e grupos».
   O diálogo é anexado ao <body> (tokens vêm de .rb-modal-overlay, lá em cima).
   ========================================================================== */

/* ---- selos do item no menu: «compartilhado comigo» e «compartilhei com N» ---------------------------------------------------- */
.rb-item-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--rb-tint);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  color: var(--rb-brand);
}
.rb-item-badge.is-shared[data-level='edit'] {
  background: var(--rb-tint-2);
}
.rb-item-badge.is-mine.has-pending {
  background: var(--rb-warn-bg);
  box-shadow: inset 0 0 0 1px var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-item-main {
  position: relative;
}
.rb-side[data-collapsed='true'] .rb-item-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 0 2px;
}
.rb-side[data-collapsed='true'] .rb-item-badge-text {
  display: none;
}
.rb-side-manage {
  flex: none;
  justify-content: flex-start;
  width: 100%;
}
.rb-side-manage .rb-manage-count {
  margin-left: auto;
  background: var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-side[data-collapsed='true'] .rb-side-manage {
  width: 40px;
  min-width: 40px;
  padding: 0;
  justify-content: center;
}
.rb-side[data-collapsed='true'] .rb-manage-label {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.rb-side[data-collapsed='true'] .rb-manage-count {
  display: none;
}
.rb-share-btn .rb-share-count {
  margin-left: 2px;
}

/* ---- campos novos --------------------------------------------------------------------------------------------------------- */
.rb-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--rb-ink);
}
.rb-btn-danger {
  border-color: #fca5a5;
  color: var(--rb-danger);
}
.rb-btn-danger:hover {
  background: #fef2f2;
}
.rb-state-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rb-warn-bg);
  font-size: 13px;
  color: var(--rb-warn-ink);
}

/* ---- diálogo ------------------------------------------------------------------------------------------------------------------ */
.rb-modal-wide {
  max-width: 760px;
}
.rb-sh-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rb-sh-head .rb-modal-title {
  margin: 0;
  overflow-wrap: anywhere;
}
.rb-sh-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--rb-ink-2);
}
.rb-sh-notice,
.rb-sh-approval {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.rb-sh-notice .rb-ico,
.rb-sh-approval .rb-ico {
  flex: none;
  margin-top: 2px;
}
.rb-sh-pickrow {
  margin-bottom: 12px;
}
.rb-sh-toasts {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  pointer-events: none;
}
.rb-sh-toasts:empty {
  display: none;
}

/* ---- seletor (combobox) ------------------------------------------------------------------------------------------------------ */
.rb-pk {
  position: relative;
}
.rb-pk-list {
  position: absolute;
  top: calc(100% - 22px);
  left: 0;
  right: 0;
  z-index: 8;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--rb-shadow);
}
.rb-pk-status {
  min-height: 18px;
  margin: 4px 2px 0;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-pk-grp-title {
  padding: 6px 8px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rb-ink-3);
}
.rb-pk-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.rb-pk-opt:hover,
.rb-pk-opt.is-hi {
  background: var(--rb-tint);
}
.rb-pk-ico {
  display: inline-grid;
  flex: none;
  place-items: center;
  color: var(--rb-ink-2);
}
.rb-pk-txt {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.rb-pk-name {
  overflow-wrap: anywhere;
  font-size: 14px;
  color: var(--rb-ink);
}
.rb-pk-sub {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-pk-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--rb-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--rb-ink-2);
}

/* ---- compositor ------------------------------------------------------------------------------------------------------------- */
.rb-sh-composer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--rb-tint-2);
  border-radius: 12px;
  background: var(--rb-bg);
}
.rb-sh-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--rb-line);
}
.rb-sh-chip-ico {
  display: inline-grid;
  place-items: center;
  color: var(--rb-brand);
}
.rb-sh-chip-txt {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.rb-sh-chip-txt strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.rb-sh-chip-type {
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-sh-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.rb-sh-date {
  margin-top: 6px;
}
.rb-sh-effect {
  margin: 0;
  min-height: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--rb-brand-dark);
}
.rb-sh-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rb-warn-bg);
  box-shadow: inset 0 0 0 1px var(--rb-warn-line);
  font-size: 13px;
  line-height: 1.45;
  color: var(--rb-warn-ink);
  cursor: pointer;
}
.rb-sh-confirm input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

/* ---- lista de acessos e de pessoas ------------------------------------------------------------------------------------------- */
.rb-sh-list-title {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--rb-brand-dark);
}
.rb-sh-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-sh-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--rb-line);
}
.rb-sh-row:last-child {
  border-bottom: 0;
}
.rb-sh-row-ico {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--rb-soft);
  color: var(--rb-ink-2);
}
.rb-sh-who {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.rb-sh-name {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.rb-sh-sub {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--rb-ink-3);
}
.rb-sh-row[data-status='expired'] .rb-sh-name,
.rb-sh-row[data-status='inactive'] .rb-sh-name {
  color: var(--rb-ink-3);
  text-decoration: line-through;
}
.rb-sh-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rb-soft);
  font-size: 11px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-sh-badge.is-pending {
  background: var(--rb-warn-bg);
  box-shadow: inset 0 0 0 1px var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-sh-empty {
  margin: 0;
  padding: 12px 0;
  font-size: 13px;
  color: var(--rb-ink-3);
}
.rb-sh-remove {
  flex: none;
  min-height: 32px;
  padding: 4px 10px;
}
.rb-sh-transfer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rb-line);
}
.rb-sh-tr-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}

/* ---- gestão ---------------------------------------------------------------------------------------------------------------- */
.rb-adm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rb-line);
}
.rb-adm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--rb-ink-2);
  cursor: pointer;
}
.rb-adm-tab[aria-selected='true'] {
  border-bottom-color: var(--rb-brand-2);
  color: var(--rb-brand-dark);
}
.rb-adm-panel:focus-visible {
  outline-offset: 4px;
}
.rb-adm-groups {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 18px;
}
.rb-adm-gl,
.rb-adm-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.rb-adm-inline {
  display: flex;
  gap: 8px;
}
.rb-adm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--rb-ink-2);
}
.rb-adm-glist {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-adm-gbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--rb-ink);
  cursor: pointer;
}
.rb-adm-gbtn:hover {
  background: var(--rb-soft);
}
.rb-adm-gbtn[aria-current='true'] {
  background: var(--rb-tint);
  box-shadow: inset 3px 0 0 var(--rb-brand-2);
  font-weight: 700;
}
.rb-adm-gname {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rb-adm-grow.is-archived .rb-adm-gname {
  color: var(--rb-ink-3);
}
.rb-adm-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rb-adm-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.rb-adm-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: #fff;
}
.rb-adm-card-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}
.rb-adm-card-title {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.rb-adm-card-effect {
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-brand-dark);
}
.rb-adm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rb-adm-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 767px) {
  .rb-sh-grid,
  .rb-adm-groups {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-modal-wide {
    max-width: 100%;
  }
}
@media (forced-colors: active) {
  .rb-pk-opt.is-hi,
  .rb-adm-gbtn[aria-current='true'] {
    outline: 2px solid Highlight;
  }
  .rb-sh-badge,
  .rb-item-badge {
    border: 1px solid CanvasText;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rb-pk-opt,
  .rb-adm-gbtn {
    transition: none;
  }
}
.rb-banner-shared {
  align-items: center;
}
.rb-banner-shared .rb-ico {
  flex: none;
}
.rb-banner-shared .rb-btn {
  margin-left: auto;
}
.rb-sh,
.rb-adm {
  scrollbar-gutter: stable;
}
.rb-sh-list {
  margin-top: 4px;
}
.rb-sh-list-body {
  min-width: 0;
}
.rb-sh-confirm-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.rb-pk-input {
  text-overflow: ellipsis;
}
.rb-pk-group + .rb-pk-group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--rb-line);
}
.rb-adm-new {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rb-line);
}
.rb-adm-gd {
  min-width: 0;
}

/* =====================================================================================================================================
   S8 — API por token: publicar, tokens (exibição única), exemplos de chamada e painel do administrador
   ===================================================================================================================================== */
.rb-api-sec {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rb-line);
}
.rb-api-pub {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.rb-api-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.rb-api-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--rb-warn-bg);
  box-shadow: inset 0 0 0 1px var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-api-warn .rb-ico {
  flex: none;
  margin-top: 2px;
}
.rb-sh-badge.is-ok {
  background: #dcfce7;
  box-shadow: inset 0 0 0 1px #86efac;
  color: #14532d;
}
.rb-sh-badge.is-none,
.rb-sh-badge.is-inactive {
  background: var(--rb-soft);
  box-shadow: inset 0 0 0 1px var(--rb-line);
  color: var(--rb-ink-2);
}
.rb-sh-badge.is-expired {
  background: var(--rb-warn-bg);
  box-shadow: inset 0 0 0 1px var(--rb-warn-line);
  color: var(--rb-warn-ink);
}
.rb-api-url {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rb-api-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rb-api-url-row .rb-input {
  flex: 1 1 260px;
  min-width: 0;
}
.rb-api-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12.5px;
}
.rb-api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.rb-api-table th,
.rb-api-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--rb-line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.rb-api-table th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--rb-ink-2);
}
.rb-api-table tr.is-err td {
  color: var(--rb-danger);
}
.rb-api-cols {
  min-width: 0;
  overflow-x: auto;
}
.rb-api-acts {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.rb-api-tok-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rb-api-tok-head .rb-sh-list-title {
  margin: 0;
}
.rb-api-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid var(--rb-line);
  border-radius: 12px;
  background: var(--rb-bg);
}
.rb-api-form[hidden] {
  display: none;
}
.rb-api-adv-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}
.rb-api-ips {
  min-height: 64px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.rb-api-reveal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 14px;
  border: 2px solid var(--rb-brand);
  border-radius: 12px;
  background: var(--rb-info-bg);
  min-width: 0;
}
.rb-api-reveal-title {
  margin: 0;
  font-size: 14px;
  color: var(--rb-brand-dark);
}
.rb-api-token {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.rb-api-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.rb-api-code {
  box-sizing: border-box;
  width: 100%;
  max-height: 260px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre;
}
.rb-api-code:focus-visible {
  outline: 2px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-api-row {
  flex-wrap: wrap;
}
.rb-api-ask {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.rb-api-ask-text {
  flex: 1 1 240px;
  font-size: 12.5px;
  color: var(--rb-danger);
}
.rb-api-revoke {
  flex: none;
  min-height: 32px;
  padding: 4px 10px;
}
.rb-api-admin {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rb-api-card {
  flex-direction: column;
  align-items: stretch;
}
.rb-api-usage {
  margin-top: 8px;
  overflow-x: auto;
}
@media (max-width: 767px) {
  .rb-api-url-row .rb-btn,
  .rb-api-copy-token {
    width: 100%;
  }
  .rb-api-code {
    max-height: 200px;
  }
}
@media (forced-colors: active) {
  .rb-api-reveal {
    border-color: Highlight;
  }
  .rb-api-code {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
  }
}
.rb-api-btn {
  white-space: nowrap;
}
.rb-api-reveal-host {
  min-width: 0;
}
.rb-api-reveal-host:empty {
  display: none;
}
.rb-api-copy-snip,
.rb-apa-switch,
.rb-apa-usage,
.rb-api-revoke-go {
  min-height: 32px;
  padding: 4px 10px;
}

/* ==========================================================================
   Sprint S9 · painel «Uso e alertas» (aba do diálogo de administração) — SÓ LEITURA
   Tudo sai de `.rb-obs*`. Sem tema escuro (o Report Builder é só claro). Gravidade = ícone + palavra + cor, nunca só cor.
   Gráficos: uma medida por gráfico (sem eixo duplo), cor da série #2563eb, limite do alerta âmbar tracejado.
   ========================================================================== */
.rb-obs {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.rb-obs[aria-busy='true'] {
  cursor: progress;
}
.rb-obs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.rb-obs-periods {
  display: inline-flex;
  gap: 6px;
}
.rb-obs-period[aria-pressed='true'],
.rb-obs-toggle[aria-pressed='true'] {
  background: var(--rb-tint);
  border-color: var(--rb-brand);
  color: var(--rb-brand-dark);
}
.rb-obs-refresh {
  margin-left: auto;
}
.rb-obs-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--rb-line);
}
.rb-obs-sec > .rb-sh-list-title {
  margin: 0;
}
.rb-obs-sec p {
  margin: 0;
}
.rb-obs-ret > summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.rb-obs-ret > summary:focus-visible,
.rb-obs-details > summary:focus-visible {
  outline: 2px solid var(--rb-focus);
  outline-offset: 2px;
  border-radius: 6px;
}
.rb-obs-details > summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--rb-brand-dark);
}

/* ---- alertas ---------------------------------------------------------------------------------------------------------------- */
.rb-obs-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rb-obs-alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--rb-line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
}
.rb-obs-alert.is-high {
  border-color: #fecaca;
  border-left-color: var(--rb-danger);
  background: #fef2f2;
}
.rb-obs-alert.is-medium {
  border-color: var(--rb-warn-line);
  border-left-color: var(--rb-amber);
  background: var(--rb-warn-bg);
}
.rb-obs-alert.is-low {
  border-color: var(--rb-info-line);
  border-left-color: var(--rb-brand-2);
  background: var(--rb-info-bg);
}
.rb-obs-sev {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rb-obs-alert.is-high .rb-obs-sev {
  color: var(--rb-danger);
}
.rb-obs-alert.is-medium .rb-obs-sev {
  color: var(--rb-warn-ink);
}
.rb-obs-alert.is-low .rb-obs-sev {
  color: var(--rb-brand-dark);
}
.rb-obs-alert-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--rb-ink);
}
.rb-obs-alert-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--rb-ink-2);
}
.rb-obs-alert-token {
  font-size: 12.5px;
  color: var(--rb-ink-2);
  overflow-wrap: anywhere;
}
.rb-obs-tokchip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--rb-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  color: var(--rb-ink);
}
.rb-obs-allclear {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--rb-ok);
}

/* ---- indicadores ------------------------------------------------------------------------------------------------------------- */
.rb-obs-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.rb-obs-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
  background: #fff;
}
.rb-obs-tile.is-warn {
  border-color: var(--rb-warn-line);
  background: var(--rb-warn-bg);
}
.rb-obs-tile-label {
  font-size: 12px;
  color: var(--rb-ink-2);
}
.rb-obs-tile-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--rb-ink);
  font-variant-numeric: tabular-nums;
}
.rb-obs-tile-sub {
  font-size: 12px;
  color: var(--rb-ink-3);
  overflow-wrap: anywhere;
}

/* ---- gráficos ---------------------------------------------------------------------------------------------------------------- */
.rb-obs-chartbar {
  display: flex;
  justify-content: flex-end;
}
.rb-obs-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  min-width: 0;
}
.rb-obs-fig {
  margin: 0;
  min-width: 0;
  overflow-x: auto;
}
.rb-obs-figcap {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--rb-ink);
}
.rb-obs-svg {
  display: block;
  width: 100%;
  min-width: 300px;
  height: auto;
}
.rb-obs-grid {
  stroke: var(--rb-line);
  stroke-width: 1;
}
.rb-obs-tick,
.rb-obs-xlabel {
  font-size: 13px;
  fill: var(--rb-ink-2);
  font-variant-numeric: tabular-nums;
}
.rb-obs-bar-rect {
  fill: #2563eb;
}
.rb-obs-ref {
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}
.rb-obs-ref-label {
  font-size: 13px;
  font-weight: 600;
  /* o rótulo do limite pode cair sobre uma barra: um halo claro mantém a leitura */
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.rb-obs-line {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--rb-ink-2);
}

/* ---- tabelas ----------------------------------------------------------------------------------------------------------------- */
.rb-obs-tablewrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--rb-line);
  border-radius: 10px;
}
.rb-obs-tablewrap:focus-visible {
  outline: 2px solid var(--rb-focus);
  outline-offset: 2px;
}
.rb-obs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.rb-obs-table th,
.rb-obs-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--rb-line);
  text-align: left;
  vertical-align: top;
}
.rb-obs-table thead th {
  background: var(--rb-bg);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--rb-ink-2);
  white-space: nowrap;
}
.rb-obs-table tbody th {
  font-weight: 600;
  color: var(--rb-ink);
}
.rb-obs-table tbody tr:last-child th,
.rb-obs-table tbody tr:last-child td {
  border-bottom: 0;
}
.rb-obs-table .rb-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rb-obs-inactive {
  color: var(--rb-danger);
  font-weight: 600;
}

/* ---- fatos e retenção --------------------------------------------------------------------------------------------------------- */
.rb-obs-facts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--rb-ink-2);
}
.rb-obs-facts code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  color: var(--rb-ink);
}
.rb-obs-ret-label {
  color: var(--rb-ink);
}
.rb-obs-unmeasured {
  max-width: 70ch;
}

@media (max-width: 767px) {
  .rb-obs-refresh {
    margin-left: 0;
  }
  .rb-obs-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rb-obs-charts {
    grid-template-columns: minmax(0, 1fr);
  }
  .rb-obs-tile-value {
    font-size: 19px;
  }
}
@media (forced-colors: active) {
  .rb-obs-alert,
  .rb-obs-tile,
  .rb-obs-tablewrap {
    border-color: CanvasText;
    background: Canvas;
  }
  .rb-obs-alert {
    border-left-color: Highlight;
  }
  .rb-obs-bar-rect {
    fill: Highlight;
  }
  .rb-obs-ref {
    stroke: CanvasText;
  }
  .rb-obs-ref-label,
  .rb-obs-tick,
  .rb-obs-xlabel {
    fill: CanvasText;
  }
  .rb-obs-ref-label {
    stroke: Canvas;
  }
  .rb-obs-grid {
    stroke: GrayText;
  }
  .rb-obs-period[aria-pressed='true'],
  .rb-obs-toggle[aria-pressed='true'] {
    border-color: Highlight;
    outline: 2px solid Highlight;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rb-obs * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------------------------------------------------------------------------
   S9.6 · acessibilidade: alvo mínimo de 24 × 24 px (WCAG 2.2 · 2.5.8, AA) nos rótulos que acionam caixas de seleção pequenas.
   A caixa em si continua do tamanho do navegador; o que passa de 24 px é a ÁREA CLICÁVEL do rótulo (clicar nele marca a caixa).
   --------------------------------------------------------------------------------------------------------------------- */
.rb-adm-toggle {
  min-height: 24px;
}
.rb-qb-opt > label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}