/* Material Design login screen */

.login-page {
  --md-primary: #cc0000;
  --md-primary-dark: #990000;
  --md-primary-light: #fdecea;
  --md-surface: #ffffff;
  --md-on-surface: rgba(0, 0, 0, 0.87);
  --md-on-surface-medium: rgba(0, 0, 0, 0.6);
  --md-on-surface-disabled: rgba(0, 0, 0, 0.38);
  --md-error: #d32f2f;
  --md-divider: rgba(0, 0, 0, 0.12);

  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #4a0000 0%, #2b0000 50%, #120000 100%);
  padding: 24px;
  color: var(--md-on-surface);
}

.login-page main.container {
  max-width: none;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 480px;
  /* Acima do canvas de fundo (.login-bg fica em z-index 0). */
  position: relative;
  z-index: 1;
}

/* Fundo interativo (grade reativa): canvas de tela cheia atrás do card.
   pointer-events ativo p/ captar o clique no fundo; o card, por estar acima,
   recebe os cliques nele normalmente. Ver grade_reativa_controller.js. */
.login-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* Card em vidro fosco: translúcido + desfoque, deixando a marca AGX da grade
   transparecer atrás. Borda clara + brilho interno dão o relevo de "glass". */
.login-card {
  position: relative;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 18px;
  padding: 40px 32px 32px;
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    0 24px 60px -16px rgba(0, 0, 0, 0.6),
    0 8px 24px -10px rgba(80, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  animation: login-card-in 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sem suporte a backdrop-filter: cai num branco mais opaco (continua legível). */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-card { background: rgba(255, 255, 255, 0.94); }
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand-logo {
  height: 64px;
  width: auto;
  display: inline-block;
  margin-bottom: 16px;
}

/* Logo textual: "Controller" em branco sobre o vermelho da marca,
   como o brand da navbar */
.login-brand-mark {
  display: inline-block;
  background: linear-gradient(135deg, #e10000 0%, #990000 100%);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 14px 28px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px -8px rgba(204, 0, 0, 0.65);
}

.login-title {
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  margin: 0 0 4px;
  color: var(--md-on-surface);
}

.login-subtitle {
  font-size: 14px;
  color: var(--md-on-surface-medium);
  margin: 0;
}

/* Material filled text fields */
.md-field {
  position: relative;
  margin-bottom: 20px;
}

.md-field input {
  width: 100%;
  height: 56px;
  padding: 22px 14px 8px;
  font: inherit;
  font-size: 16px;
  color: var(--md-on-surface);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  outline: none;
  transition: background-color 140ms ease, border-color 140ms ease,
              box-shadow 140ms ease;
  box-sizing: border-box;
}

.md-field input:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.22);
}

.md-field input:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--md-primary);
  box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.14);
}

.md-field input:disabled {
  background: rgba(0, 0, 0, 0.04);
  color: var(--md-on-surface-disabled);
}

.md-field label {
  position: absolute;
  left: 14px;
  top: 18px;
  font-size: 16px;
  color: var(--md-on-surface-medium);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1),
              color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.md-field input:focus + label,
.md-field input:not(:placeholder-shown) + label,
.md-field input:-webkit-autofill + label {
  transform: translateY(-12px) scale(0.75);
  color: var(--md-primary);
}

.md-field input:not(:focus):not(:placeholder-shown) + label,
.md-field input:-webkit-autofill:not(:focus) + label {
  color: var(--md-on-surface-medium);
}

/* Autofill do Chrome: sem isto o valor preenchido não dispara
   :placeholder-shown e a label fica sobreposta ao texto (parecendo um
   placeholder "grudado"). Também tira o fundo amarelo padrão do autofill. */
.md-field input:-webkit-autofill,
.md-field input:-webkit-autofill:hover,
.md-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--md-on-surface);
  -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.95) inset;
  caret-color: var(--md-on-surface);
}

/* Campo inválido — só depois da interação do usuário (:user-invalid), pra não
   pintar tudo de vermelho no load. Vale também para o setCustomValidity do
   validador genérico (controllers/campo_controller.js). */
.md-field input:user-invalid {
  background: #fff;
  border-color: var(--md-error);
  box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.14);
}

.md-field input:user-invalid + label {
  color: var(--md-error);
}

/* Mensagem de erro abaixo do campo (criada pelo campo_controller). */
.md-error {
  margin: 6px 4px 0;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--md-error);
}

/* Remember-me checkbox */
.md-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 24px;
  font-size: 14px;
  color: var(--md-on-surface-medium);
  cursor: pointer;
  user-select: none;
}

.md-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--md-on-surface-medium);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: background-color 120ms ease, border-color 120ms ease;
  flex-shrink: 0;
}

.md-check input[type="checkbox"]:checked {
  background: var(--md-primary);
  border-color: var(--md-primary);
}

.md-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Filled button */
.md-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 4px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.0892857143em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #e00000 0%, #a30000 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow:
    0 10px 22px -8px rgba(204, 0, 0, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 120ms ease, box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1),
              filter 150ms ease;
}

.md-button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow:
    0 14px 28px -8px rgba(204, 0, 0, 0.72),
    0 3px 8px rgba(0, 0, 0, 0.25);
}

.md-button:active {
  transform: translateY(0);
  filter: brightness(0.97);
  box-shadow:
    0 6px 14px -8px rgba(204, 0, 0, 0.55),
    0 2px 5px rgba(0, 0, 0, 0.2);
}

.md-button:disabled {
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: none;
  cursor: not-allowed;
}

.md-button:focus-visible {
  outline: 2px solid var(--md-primary-dark);
  outline-offset: 2px;
}

/* Flash alerts inside login */
.login-page .alert {
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  border: none;
}

.login-page .alert-danger {
  background: #fdecea;
  color: var(--md-error);
}

.login-page .alert-success {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Login duplo: tabs "usuário antigo" (UX Vision) × "conta Controller" */
.login-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-on-surface-medium);
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.login-tab:hover { color: var(--md-on-surface); }

.login-tab.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--md-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.login-aviso {
  font-size: 13px;
  color: var(--md-on-surface-medium);
  text-align: center;
  margin: 16px 0 0;
}

.login-origem {
  font-size: 13px;
  color: var(--md-on-surface-medium);
  margin: 0 0 24px;
}

.login-admin-link {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--md-divider);
}

.login-admin-link a {
  font-size: 13px;
  color: var(--md-on-surface-medium);
  text-decoration: none;
}

.login-admin-link a:hover {
  color: var(--md-primary);
  text-decoration: underline;
}

/* Crédito abaixo do card (fora dele) — texto claro sobre o fundo escuro. */
.login-rodape {
  text-align: center;
  margin: 22px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Seletor de idioma do login: fixo no topo, fora do flex que centraliza o card.
   Canto direito no LTR; espelhado para a esquerda no árabe (RTL). */
.login-idioma {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

[dir="rtl"] .login-idioma {
  right: auto;
  left: 1rem;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* Utilitário de cor da marca */
.bg-rails {
  background-color: #cc0000 !important;
}

/* Barra de navegação superior — fica fixa no topo (sticky).
   No topo é vermelho SÓLIDO; ao rolar vira vidro fosco translúcido
   (estilo apple.com) e o conteúdo passa por trás, desfocado. */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: #cc0000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease,
    -webkit-backdrop-filter 0.3s ease, backdrop-filter 0.3s ease;
}

/* Ao rolar a página: vidro fosco translúcido + sombra suave (como a Apple) */
.app-navbar.is-scrolled {
  background-color: rgba(204, 0, 0, 0.65);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Fallback: navegadores sem suporte a backdrop-filter mantêm o vermelho sólido */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .app-navbar.is-scrolled {
    background-color: #cc0000;
  }
}

/* Barra de navegação lateral (esquerda) */
.app-sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: calc(100vh - 72px);
  transition: width 0.18s ease, flex-basis 0.18s ease;
}

/* Cabeçalho de cada seção do menu (Níveis, Recursos, Infraestrutura…) */
.app-sidebar-secao {
  padding: 0.75rem 0.75rem 0.25rem;
}
.app-sidebar-secao:first-child {
  padding-top: 0.25rem;
}
.app-sidebar-secao-titulo {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.app-sidebar .nav-link {
  color: #333;
  border-radius: 0.375rem;
  font-weight: 500;
}

.app-sidebar .nav-link:hover {
  background-color: #f3f3f3;
  color: #cc0000;
}

.app-sidebar .nav-link.active {
  background-color: #cc0000;
  color: #fff;
}

@media (max-width: 767.98px) {
  .app-sidebar {
    width: 64px;
    flex-basis: 64px;
  }
  .app-sidebar .nav-link span,
  .app-sidebar-secao-titulo {
    display: none;
  }
  /* Sem rótulo, a seção vira apenas um respiro/divisória entre os grupos. */
  .app-sidebar-secao {
    padding: 0.25rem 0;
    border-top: 1px solid #eee;
    margin-top: 0.25rem;
  }
  .app-sidebar-secao:first-child {
    border-top: 0;
    margin-top: 0;
  }
  /* No mobile a sidebar já é um rail forçado; o hambúrguer não teria efeito. */
  .app-sidebar-toggle {
    display: none;
  }
}

/* Recolhido manualmente pelo hambúrguer (desktop): vira um rail só com ícones,
   mesmo visual do mobile. Os rótulos somem e as seções viram divisórias. */
body.sidebar-collapsed .app-sidebar {
  width: 64px;
  flex: 0 0 64px;
}
body.sidebar-collapsed .app-sidebar .nav-link {
  justify-content: center;
}
body.sidebar-collapsed .app-sidebar .nav-link span,
body.sidebar-collapsed .app-sidebar-secao-titulo {
  display: none;
}
body.sidebar-collapsed .app-sidebar-secao {
  padding: 0.25rem 0;
  border-top: 1px solid #eee;
  margin-top: 0.25rem;
}
body.sidebar-collapsed .app-sidebar-secao:first-child {
  border-top: 0;
  margin-top: 0;
}

/* Botão hambúrguer que recolhe a sidebar — branco sobre a navbar escura. */
.app-sidebar-toggle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.4rem;
  line-height: 1;
  border: 0;
  text-decoration: none;
}
.app-sidebar-toggle:hover,
.app-sidebar-toggle:focus {
  color: #fff;
}

/* Links de navegação do topo (branco sobre vermelho) */
.navbar .nav-topo {
  display: inline-block;
  color: #fff;
  font-weight: 700;
  padding: 0.25rem 0.25rem 4px;
  border-bottom: 4px solid transparent;
}

.navbar .nav-topo:hover {
  color: #fff;
}

.navbar .nav-topo.ativo {
  border-bottom-color: #fff;
}

/* ── Busca grande no topo (filtra os itens do menu) ───────────────────────── */
/* Fica à direita do logo, ocupa o espaço disponível (com teto). Ao focar, o
   campo escurece para deixar claro que é um input ativo. */
.navbar-busca {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
  margin: 0 0.75rem;
}

@media (min-width: 992px) {
  .navbar-busca {
    margin: 0 1.5rem;
  }
}

.navbar-busca-icone {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.55); /* discreto em repouso */
  font-size: 1rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

/* Ao focar, o ícone fica nítido. */
.navbar-busca:focus-within .navbar-busca-icone {
  color: rgba(255, 255, 255, 0.95);
}

/* Em repouso: sem borda, fundo escuro discreto, mais baixo e com cursor de
   "clicável" (não de texto) — não parece um campo até ser clicado. */
.navbar-busca-input {
  width: 100%;
  height: 2.3rem;
  padding: 0 0.9rem 0 2.35rem;
  font-size: 1.05rem; /* "um pouco maior" que o normal */
  color: #fff;
  caret-color: #fff;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.16);
  border: 0;
  border-radius: 0.55rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.navbar-busca-input::placeholder {
  color: rgba(255, 255, 255, 0.72);
  opacity: 1;
}

/* Ao clicar/focar (ou com o painel aberto): fica MAIS escuro e "afundado"
   (inset) — aí sim deixa claro que é um input. Sem borda. */
.navbar-busca-input:focus,
.navbar-busca.is-aberto .navbar-busca-input {
  outline: none;
  cursor: text;
  background-color: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* Remove o "x" nativo do input[type=search] (usamos Esc para limpar). */
.navbar-busca-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Dica do atalho (Ctrl K / ⌘K) ancorada à direita do campo; some ao engajar. */
.navbar-busca-atalho {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.08rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  background-color: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.35rem;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.navbar-busca:focus-within .navbar-busca-atalho,
.navbar-busca.is-aberto .navbar-busca-atalho {
  opacity: 0;
}
@media (max-width: 575.98px) {
  .navbar-busca-atalho {
    display: none;
  }
}

/* Painel branco de resultados, ancorado abaixo do campo. */
.navbar-busca-painel {
  position: absolute;
  z-index: 1056;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.navbar-busca-lista {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
}

.navbar-busca-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  color: #212529;
  text-decoration: none;
}

.navbar-busca-item:hover,
.navbar-busca-item.is-destacado {
  background-color: #fde8e8;
  color: #cc0000;
}

.navbar-busca-item-icone {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  font-size: 1.15rem;
  color: #cc0000;
}

.navbar-busca-item-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.navbar-busca-item-titulo {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  color: inherit;
}

/* Descrição em PT-BR, logo abaixo do nome da opção do menu. */
.navbar-busca-item-desc {
  font-size: 0.82rem;
  line-height: 1.3;
  color: #6c757d;
}

.navbar-busca-item:hover .navbar-busca-item-desc,
.navbar-busca-item.is-destacado .navbar-busca-item-desc {
  color: #c0656b;
}

.navbar-busca-vazio {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  text-align: center;
  color: #6c757d;
}

/* Espaçamento entre os itens do menu (vertical no mobile, horizontal no desktop) */
.navbar-nav {
  gap: 0.25rem;
}

@media (min-width: 992px) {
  .navbar-nav {
    gap: 1rem;
  }
}

/* Permite que filhos de um flex container encolham e o text-truncate funcione */
.min-w-0 {
  min-width: 0;
}

.btn-primary {
  --bs-btn-bg: #cc0000;
  --bs-btn-border-color: #cc0000;
  --bs-btn-hover-bg: #a30000;
  --bs-btn-hover-border-color: #990000;
  --bs-btn-active-bg: #990000;
  --bs-btn-active-border-color: #8f0000;
  --bs-btn-disabled-bg: #cc0000;
  --bs-btn-disabled-border-color: #cc0000;
}

/* Botão "edgy" — ação de destaque (ex.: criar sistema). Cantos chanfrados,
   vermelho da marca, caixa-alta. */
.btn-edgy {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .85rem;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #e00000 0%, #a30000 100%);
  border: 0;
  border-radius: 0;
  text-decoration: none;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: 0 2px 8px rgba(204, 0, 0, .25);
  transition: filter .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn-edgy:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 4px 14px rgba(204, 0, 0, .35); }
.btn-edgy:active { transform: translateY(1px); }
.btn-edgy:focus-visible { outline: 2px solid #cc0000; outline-offset: 2px; }

/* ── Lista de Masters ─────────────────────────────────────────────────── */

/* Linha inteira clicável (abre o drawer) */
.mestres-tabela tbody tr.mestre-row {
  cursor: pointer;
}

.mestres-tabela tbody tr.mestre-row:focus,
.mestres-tabela tbody tr.mestre-row:focus-visible {
  outline: 2px solid rgba(204, 0, 0, 0.45);
  outline-offset: -2px;
}

/* Cabeçalhos ordenáveis */
.mestres-tabela thead .mestre-ordenar {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.mestres-tabela thead .mestre-ordenar:hover,
.mestres-tabela thead .mestre-ordenar.is-active {
  color: #cc0000;
}

/* Célula do logo: colada ao topo e à base da linha para o logo ficar maior. */
.mestres-tabela td[data-col="logo"] {
  padding-top: 1px;
  padding-bottom: 1px;
  text-align: center;
}

/* Logo na célula da tabela. Fundo vermelho (cor do layout) para que PNGs
   brancos fiquem visíveis sobre o fundo claro da tabela. */
.mestre-logo {
  display: block;
  margin: 0 auto;
  height: 48px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border-radius: 4px;
  background-color: #cc0000;
}

/* JSON cru no drawer — agora exibição SECUNDÁRIA, dentro de <details> "Ver JSON". */
.mestre-json {
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 0.5rem;
  max-height: 220px;
  overflow: auto;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ══ Detalhe do master — layout de perfil (hero + métricas + cards) ════════ */

.mestre-perfil {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Na PÁGINA /masters/:id o hero é fixo no topo e as abas ficam logo abaixo. */
.mestre-perfil-pagina {
  gap: 1rem;
}

.mestre-abas {
  border-bottom: 1px solid var(--bs-border-color);
  flex-wrap: wrap;
}

.mestre-abas .nav-link {
  color: var(--bs-secondary-color);
  font-weight: 600;
  border: 0;
  border-bottom: 2px solid transparent;
}

.mestre-abas .nav-link:hover:not(.disabled) {
  color: #cc0000;
  border-bottom-color: rgba(204, 0, 0, 0.35);
}

.mestre-abas .nav-link.active {
  color: #cc0000;
  background: transparent;
  border-bottom-color: #cc0000;
}

.mestre-abas .nav-link.disabled {
  color: var(--bs-secondary-color);
  opacity: 0.55;
}

.mestre-abas-conteudo {
  padding-top: 0.25rem;
}

/* ── Hero: avatar + identidade + ações ──────────────────────────────────── */
.mestre-perfil-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--bs-border-color-translucent);
  background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}

.mestre-perfil-avatar {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  overflow: hidden;
  background-color: #cc0000;
  box-shadow: 0 6px 18px rgba(204, 0, 0, 0.25);
}

.mestre-perfil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.mestre-perfil-avatar.is-vazio {
  background: #f1f3f5;
  color: #adb5bd;
  border: 1px solid var(--bs-border-color);
  box-shadow: none;
}

.mestre-perfil-avatar.is-vazio i {
  font-size: 2rem;
}

.mestre-perfil-identidade {
  flex: 1 1 320px;
  min-width: 0;
}

.mestre-perfil-nome {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.mestre-perfil-fantasia {
  margin-top: 0.1rem;
  color: var(--bs-secondary-color);
}

.mestre-perfil-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.mestre-perfil-contato {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  color: var(--bs-secondary-color);
}

.mestre-perfil-contato i {
  margin-right: 0.35rem;
  opacity: 0.7;
}

.mestre-perfil-contato code {
  color: inherit;
}

.mestre-perfil-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

/* Chip de código (#123) */
.mestre-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.mestre-chip-codigo {
  background: #fff;
  border: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
  font-family: var(--bs-font-monospace);
}

/* Pills de status */
.mestre-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.mestre-pill i {
  font-size: 0.85em;
}

.mestre-pill.is-ok     { background: #e6f4ea; color: #1a7f37; }
.mestre-pill.is-muted  { background: #f1f3f5; color: #6c757d; }
.mestre-pill.is-danger { background: #fde8e8; color: #c0341d; }
.mestre-pill.is-warn   { background: #fff3cd; color: #997404; }
.mestre-pill.is-dark   { background: #e2e3e5; color: #343a40; }
.mestre-pill.is-brand  { background: #ffe3e3; color: #cc0000; }

/* ── Métricas (tiles) ───────────────────────────────────────────────────── */
.mestre-perfil-stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.mestre-stat {
  position: relative;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color-translucent);
}

.mestre-stat > i {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  font-size: 1.05rem;
  color: #cc0000;
  opacity: 0.55;
}

.mestre-stat-valor {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.mestre-stat-rotulo {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bs-secondary-color);
}

/* ── Grid de cards por seção ────────────────────────────────────────────── */
.mestre-perfil-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  align-items: start;
}

/* Título de bloco dentro de uma aba (ex.: Produtos e comissões / Verificados) */
.mestre-bloco-titulo {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--bs-secondary-color);
  margin-bottom: 0.6rem;
}

/* ── Botão GRANDE "Configuração" (atalho para a aba) ─────────────────────── */
.mestre-config-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.25rem;
  border: 0;
  border-radius: 1rem;
  text-align: left;
  color: #fff;
  background: linear-gradient(135deg, #cc0000 0%, #a30000 100%);
  box-shadow: 0 8px 22px rgba(204, 0, 0, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mestre-config-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(204, 0, 0, 0.34);
}

.mestre-config-cta-icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.18);
}

.mestre-config-cta-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mestre-config-cta-titulo {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.mestre-config-cta-sub {
  font-size: 0.85rem;
  opacity: 0.85;
}

.mestre-config-cta-seta {
  font-size: 1.5rem;
  margin-left: auto;
  opacity: 0.85;
}

/* ── Aba Configuração: marca (imagens) + cores ───────────────────────────── */
.config-imagens {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.config-img {
  margin: 0;
  text-align: center;
}

.config-img-quadro {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  padding: 0.6rem;
  border-radius: 0.75rem;
  background: #cc0000; /* PNGs brancos ficam visíveis */
  border: 1px solid var(--bs-border-color-translucent);
}

.config-img-quadro img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.config-img figcaption {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  word-break: break-word;
}

.config-cores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.config-cor {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid var(--bs-border-color-translucent);
}

.config-swatch {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.config-cor-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.config-cor-nome {
  font-size: 0.82rem;
  font-weight: 600;
}

.config-cor-info code {
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
}

.mestre-card {
  padding: 1rem 1.1rem 1.1rem;
  border-radius: 0.85rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mestre-card--larga {
  grid-column: 1 / -1;
}

.mestre-card-cabecalho {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.mestre-card-icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.55rem;
  font-size: 0.95rem;
  background: hsl(var(--hue) 70% 95%);
  color: hsl(var(--hue) 60% 36%);
}

.mestre-card-titulo {
  font-size: 0.95rem;
  font-weight: 600;
}

.mestre-card-tag {
  margin-left: auto;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--bs-font-monospace);
  background: hsl(var(--hue) 70% 95%);
  color: hsl(var(--hue) 50% 40%);
}

/* Tabela chave/valor de cada seção */
.mestre-kv {
  width: 100%;
  font-size: 0.8125rem;
  margin-bottom: 0;
  table-layout: fixed;
}

.mestre-kv > tbody > tr + tr > * {
  border-top: 1px solid var(--bs-border-color-translucent);
}

.mestre-kv .mestre-kv-chave {
  width: 38%;
  font-weight: 400;
  color: var(--bs-secondary-color);
  vertical-align: top;
  padding: 0.3rem 0.75rem 0.3rem 0;
  word-break: break-word;
}

.mestre-kv .mestre-kv-valor {
  vertical-align: top;
  padding: 0.3rem 0;
  word-break: break-word;
}

/* Sub-tabela aninhada (Hash dentro de um valor): mais densa e recuada */
.mestre-kv-aninhada {
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.015);
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 6px;
}

.mestre-kv-aninhada .mestre-kv-chave {
  padding-left: 0.5rem;
  width: 42%;
}

.mestre-kv-aninhada .mestre-kv-valor {
  padding-right: 0.5rem;
}

/* Array de objetos → tabela com cabeçalho */
.mestre-tabela-array {
  width: 100%;
  font-size: 0.75rem;
  margin-bottom: 0;
}

.mestre-tabela-array th,
.mestre-tabela-array td {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--bs-border-color-translucent);
  vertical-align: top;
}

.mestre-tabela-array thead th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
  white-space: nowrap;
}

/* Listas (array de referências / escalares) */
.mestre-ref-lista,
.mestre-lista {
  margin: 0;
  padding-left: 1.1rem;
}

.mestre-ref-lista li,
.mestre-lista li {
  margin-bottom: 0.15rem;
}

/* Id discreto ao lado do nome resolvido de uma referência */
.mestre-ref-id {
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  opacity: 0.7;
}

/* Toggle "Ver JSON" (exibição secundária) */
.mestre-json-toggle {
  margin-top: 0.35rem;
}

.mestre-json-toggle > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: #cc0000;
  list-style: none;
  user-select: none;
}

.mestre-json-toggle > summary::-webkit-details-marker {
  display: none;
}

.mestre-json-toggle > summary::before {
  content: "{ }";
  font-family: var(--bs-font-monospace);
  opacity: 0.7;
}

.mestre-json-doc {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--bs-border-color);
}

/* ── Paginação da lista de Masters ───────────────────────────────────────
   Quadrados separados, um por página, mais botões "Anterior"/"Próxima"
   maiores. Cor da marca (vermelho) no item ativo e no hover. */
.mestre-paginacao {
  flex-wrap: wrap;
  gap: 0.375rem;
}

.mestre-paginacao .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid #e6e6e6;
  border-radius: 0.5rem;
  color: #cc0000;
  font-weight: 600;
}

/* Sem o -1px do Bootstrap: os quadrados ficam separados pelo gap acima. */
.mestre-paginacao .page-item:not(:first-child) .page-link {
  margin-left: 0;
}

.mestre-paginacao .page-link:hover {
  background-color: #fff0f0;
  border-color: #cc0000;
  color: #cc0000;
}

.mestre-paginacao .page-link:focus {
  box-shadow: 0 0 0 0.2rem rgba(204, 0, 0, 0.25);
}

.mestre-paginacao .page-item.active .page-link {
  background-color: #cc0000;
  border-color: #cc0000;
  color: #fff;
}

.mestre-paginacao .page-item.disabled .page-link {
  color: #adb5bd;
  background-color: transparent;
  border-color: #ececec;
}

/* ── Submenu (dropdown) da barra lateral: Proposals ───────────────────────── */
.app-sidebar .app-submenu {
  margin: 0.125rem 0 0.25rem 0.85rem;
  padding-left: 0.35rem;
  border-left: 2px solid #ededed;
}

.app-sidebar .app-submenu .nav-link {
  font-size: 0.9rem;
  color: #555;
}

.app-sidebar .app-submenu .nav-link.active {
  background-color: #cc0000;
  color: #fff;
}

.app-sidebar .app-caret {
  transition: transform 0.15s ease;
}

.app-sidebar [aria-expanded="true"] .app-caret {
  transform: rotate(180deg);
}

/* ── Abas de situação na lista de propostas ───────────────────────────────── */
.proposta-abas .nav-link {
  color: #555;
  border: 1px solid #e3e3e3;
}

.proposta-abas .nav-link:hover {
  color: #cc0000;
}

/* Só a aba SELECIONADA (ativa) ganha cor, e cada situação tem a sua:
   lead = amarelo, pending = azul, approved = verde, reproved = vermelho.
   As não selecionadas seguem o estilo neutro acima. */
.proposta-abas .proposta-aba-lead.active {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
}

.proposta-abas .proposta-aba-pending.active {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.proposta-abas .proposta-aba-approved.active {
  background-color: #198754;
  border-color: #198754;
  color: #fff;
}

.proposta-abas .proposta-aba-reproved.active {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

/* ── Filtro da lista de propostas (autocomplete produto/master + período) ──── */
.proposta-combo {
  position: relative;
}

/* Menu de opções do autocomplete, ancorado ao input. */
.proposta-combo-menu {
  position: absolute;
  z-index: 1056; /* acima de cards/abas */
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 16rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.proposta-combo-opcao {
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f1f1;
}

.proposta-combo-opcao:last-child {
  border-bottom: 0;
}

.proposta-combo-opcao:hover {
  background-color: #fde8e8;
}

/* Código numérico em destaque (prefixo "código - nome"). */
.proposta-combo-cod {
  display: inline-block;
  min-width: 3.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #cc0000;
}

.proposta-combo-extra {
  color: #6c757d;
  font-size: 0.8rem;
}

/* Botão "Ver propostas" — compacto e alinhado à esquerda. */
.propostas-buscar {
  font-weight: 600;
}

/* ── Lista de Bancos (coleção "banks") ────────────────────────────────────── */

/* Cabeçalhos ordenáveis (ordenação client-side em JS, igual à Database). */
.banco-tabela thead .banco-sortable {
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.banco-tabela thead .banco-sortable:hover,
.banco-tabela thead .banco-sortable.is-asc,
.banco-tabela thead .banco-sortable.is-desc {
  color: #cc0000;
}

.banco-tabela thead .banco-caret {
  opacity: 0.3;
}

.banco-tabela thead .is-asc .banco-caret,
.banco-tabela thead .is-desc .banco-caret {
  opacity: 1;
}

/* Célula do logo: enxuta, colada ao topo/base p/ o logo ocupar a altura da linha. */
.banco-tabela td.banco-logo-cell {
  width: 1%;
  padding-top: 1px;
  padding-bottom: 1px;
  text-align: center;
}

/* Slug e ID em monospace discreto. */
.banco-slug,
.banco-id {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

/* ── Visão de cartões (instituições) ──────────────────────────────────────── */

.banco-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: start;
}

/* Borda bem fina + cantos arredondados; ergue suavemente no hover. */
.banco-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.banco-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

/* Banner: gradiente da marca com o LOGO "vazando" para o fundo (cópia ampliada
   e desfocada da própria imagem via --logo), e o logo nítido por cima. */
.banco-card-banner {
  position: relative;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #cc0000 0%, #7a0000 100%);
}

.banco-card-banner::before {
  content: "";
  position: absolute;
  inset: -25%;
  background-image: var(--logo);
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(1.35);
  opacity: 0.5;
  transform: scale(1.2);
}

.banco-card-logo {
  position: relative;
  z-index: 1;
  max-height: 64px;
  max-width: 78%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.banco-card-logo-vazio {
  position: relative;
  z-index: 1;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Chip de código no canto do banner. */
.banco-card-codigo {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-family: var(--bs-font-monospace);
  font-size: 0.72rem;
  font-weight: 600;
  color: #cc0000;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.banco-card-corpo {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 1rem 1rem;
  min-width: 0;
}

.banco-card-nome {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.banco-card-slug {
  align-self: flex-start;
}

.banco-card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
}

.banco-card-meta i {
  flex: 0 0 auto;
  opacity: 0.7;
}

/* ObjectId copiável: chip discreto, largura total, clicável (clipboard). */
.banco-card-id {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.02);
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.banco-card-id:hover {
  border-color: #cc0000;
  color: #cc0000;
  background: #fff5f5;
}

.banco-card-id i {
  flex: 0 0 auto;
}

.banco-card-id code {
  color: inherit;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Estado "copiado" (feedback temporário). */
.banco-card-id.is-ok {
  border-color: #1a7f37;
  color: #1a7f37;
  background: #e6f4ea;
  justify-content: center;
}

/* ── Lista de Meta-produtos (coleção "metaproducts") ──────────────────────── */

/* Cabeçalhos ordenáveis (ordenação client-side em JS). */
.meta-tabela thead .meta-sortable {
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.meta-tabela thead .meta-sortable:hover,
.meta-tabela thead .meta-sortable.is-asc,
.meta-tabela thead .meta-sortable.is-desc {
  color: #cc0000;
}

.meta-tabela thead .meta-caret { opacity: 0.3; }

.meta-tabela thead .is-asc .meta-caret,
.meta-tabela thead .is-desc .meta-caret { opacity: 1; }

/* Slug e ID em monospace discreto. */
.meta-slug,
.meta-id {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

/* ── Cartões de meta-produto (sem logo: faixa da marca com ícone + código) ─── */

.meta-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: start;
}

.meta-card {
  display: flex;
  flex-direction: column;
  height: 220px; /* altura fixa: todos os cartões iguais, independente do conteúdo */
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.meta-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.meta-card-topo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, #cc0000 0%, #7a0000 100%);
}

.meta-card-icone {
  font-size: 1.35rem;
  opacity: 0.95;
}

/* Nome humano no cabeçalho do cartão: título em 1 linha (corta com reticências). */
.meta-card-titulo {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-card-codigo {
  margin-left: auto;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-family: var(--bs-font-monospace);
  font-size: 0.72rem;
  font-weight: 600;
  color: #cc0000;
  background: rgba(255, 255, 255, 0.92);
}

.meta-card-corpo {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 1rem 1rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Descrição limitada a 2 linhas no card (texto completo na tabela). */
.meta-card-desc {
  font-size: 0.82rem;
  color: var(--bs-secondary-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
}

.meta-card-meta i {
  flex: 0 0 auto;
  opacity: 0.7;
}

/* Rodapé do cartão: data + ID, fixados no fundo (cartões de altura igual). */
.meta-card-rodape {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.35rem;
}

/* ID copiável: botão discreto, largura total; o ObjectId corta com reticências. */
.meta-card-id {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-secondary-color);
  font-family: var(--bs-font-monospace);
  font-size: 0.72rem;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.meta-card-id:hover {
  color: #cc0000;
  border-color: rgba(204, 0, 0, 0.4);
}

.meta-card-id i {
  flex: 0 0 auto;
  opacity: 0.75;
}

.meta-card-id-val {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* ── Database (lista de coleções do MongoDB) ──────────────────────────────── */

/* Card de resumo em destaque (tamanho total em disco) com a cor da marca. */
.db-stat-destaque {
  border-color: #cc0000;
}

.db-stat-destaque .fs-5 {
  color: #cc0000;
}

/* Cabeçalhos ordenáveis (ordenação client-side em JS) */
.db-tabela thead .db-sortable {
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.db-tabela thead .db-sortable:hover,
.db-tabela thead .db-sortable.is-asc,
.db-tabela thead .db-sortable.is-desc {
  color: #cc0000;
}

.db-tabela thead .db-caret {
  opacity: 0.3;
}

.db-tabela thead .is-asc .db-caret,
.db-tabela thead .is-desc .db-caret {
  opacity: 1;
}

/* Coluna "tamanho dos dados": barrinha de fundo proporcional (heatmap) */
.db-tabela td.db-size-cell {
  position: relative;
}

.db-size-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(204, 0, 0, 0.1);
  border-right: 1px solid rgba(204, 0, 0, 0.3);
  z-index: 0;
}

.db-size-val {
  position: relative;
  z-index: 1;
}

/* ── Database: tela de carregamento (barra de "energia") ──────────────────── */
/* A barra ENCHE por TEMPO (animação CSS, não progresso real) e um brilho corre
   da esquerda p/ a direita, infinito, pra parecer viva. Quando os dados chegam,
   o JS adiciona .is-completo (vai a 100%) e .is-saindo (fade). */
.db-carregando {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 60vh;
  text-align: center;
}

.db-carregando.is-saindo {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.db-energia-track {
  position: relative;
  width: min(620px, 82vw);
  height: 18px;
  border-radius: 999px;
  background: #f1e2e2;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.db-energia-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #990000, #cc0000 55%, #ff3b3b);
  box-shadow: 0 0 16px rgba(204, 0, 0, 0.55);
  animation: db-encher 16s cubic-bezier(0.15, 0.7, 0.2, 1) forwards;
}

/* Dados chegaram: rush até 100% (sobrepõe a animação por tempo). */
.db-energia-track.is-completo .db-energia-fill {
  animation: none;
  width: 100%;
  transition: width 0.35s ease;
}

/* O brilho que corre da esquerda p/ a direita dentro da parte preenchida. */
.db-energia-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: db-sweep 1.15s linear infinite;
}

.db-carregando-label {
  font-size: 1.05rem;
  color: #555;
  min-height: 1.6em; /* reserva a linha p/ não pular ao trocar de mensagem */
}

/* Cursor "máquina de escrever" piscando ao lado do texto digitado. */
.db-carregando-label .db-cursor,
.export-overlay-label .db-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: #cc0000;
  animation: db-cursor 1s step-end infinite;
}

@keyframes db-encher {
  0% { width: 0; }
  70% { width: 82%; }
  100% { width: 92%; }
}

@keyframes db-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@keyframes db-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .db-energia-fill,
  .db-energia-sweep,
  .db-carregando-label .db-cursor,
  .export-overlay-label .db-cursor {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
  .db-energia-fill { width: 92%; }
}

/* ── Monitoramento de Filas (gráficos de barras por fila) ─────────────────── */
/* Barra horizontal por fila: nome à esquerda, trilho com segmentos empilhados
   (aguardando+processando, ou sucesso+falha) e o valor à direita. Largura dos
   segmentos = valor / maior total entre as filas (heatmap linear). */
.fila-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.fila-bar-nome {
  flex: 0 0 auto;
  width: clamp(8rem, 32%, 16rem);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: #444;
}

.fila-bar-track {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  height: 16px;
  border-radius: 999px;
  background: #f0eef0;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.fila-bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.fila-bar-seg-aguardando { background: linear-gradient(90deg, #cc0000, #ff3b3b); }
.fila-bar-seg-processando { background: linear-gradient(90deg, #f0ad4e, #ffce6b); }
.fila-bar-seg-sucesso { background: linear-gradient(90deg, #198754, #2bbd7e); }
.fila-bar-seg-falha { background: linear-gradient(90deg, #dc3545, #f06a76); }

.fila-bar-val {
  flex: 0 0 auto;
  width: 4.5rem;
  text-align: end;
  font-size: 0.8rem;
  color: #333;
}

/* Pontinho de legenda dos gráficos. */
.fila-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-inline-end: 0.35rem;
  vertical-align: baseline;
}

.fila-dot-aguardando { background: #cc0000; }
.fila-dot-processando { background: #f0ad4e; }
.fila-dot-sucesso { background: #198754; }
.fila-dot-falha { background: #dc3545; }

/* Badge da categoria da fila (cor sutil por prefixo do nome). */
.fila-cat {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #f1f1f4;
  color: #5a5a5a;
}

.fila-cat-stuck { background: #f8d7da; color: #842029; }
.fila-cat-reattempt { background: #fff3cd; color: #664d03; }
.fila-cat-polling { background: #cff4fc; color: #055160; }
.fila-cat-postback { background: #e2d9f3; color: #432874; }
.fila-cat-report { background: #d1e7dd; color: #0f5132; }
.fila-cat-import { background: #dbe4ff; color: #2f3b8c; }
.fila-cat-datafetch { background: #d8f3ec; color: #0c5d4e; }
.fila-cat-routine { background: #e7eaf0; color: #3d4858; }

/* ── Overlay de exportação (qualquer botão "Exportar") ────────────────────── */
/* Escurece a tela e mostra um anel girando com a PORCENTAGEM no centro, a barra
   e as etapas digitadas (typewriter). Ao concluir, o JS troca para a vista de
   sucesso (.is-sucesso): check verde desenhado + onda/raios/brilho que
   TRANSBORDAM o card. O fade de saída é .is-saindo. */
.export-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080; /* acima do offcanvas/backdrop do Bootstrap (1045) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(20, 6, 6, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.export-overlay[hidden] { display: none; }
.export-overlay.is-saindo { opacity: 0; }

.export-overlay-card {
  position: relative;
  overflow: visible; /* deixa os efeitos de sucesso transbordarem o card */
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(420px, 90vw);
  padding: 2.25rem 2rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.export-overlay.is-sucesso .export-overlay-card {
  animation: export-card-pop 0.5s ease;
}

/* Troca de vistas: carregamento × sucesso. */
.export-loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}
.export-success { display: none; }
.export-overlay.is-sucesso .export-loading-view { display: none; }
.export-overlay.is-sucesso .export-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

/* Spinner: anel girando com a porcentagem (que NÃO gira) no centro. */
.export-spinner {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid #f1e2e2;
  border-top-color: #cc0000;
  border-right-color: #ff3b3b;
  animation: export-spin 0.9s linear infinite;
}

.export-percent {
  font-size: 1.4rem;
  font-weight: 700;
  color: #cc0000;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* A barra de energia, dentro do card, ocupa a largura toda. */
.export-overlay-card .export-bar { width: 100%; }

.export-overlay-label {
  font-size: 1rem;
  font-weight: 500;
  color: #444;
}

/* ── Sucesso: check verde + efeitos que transbordam o card ─────────────────── */
.export-check-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-check {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 8px 18px rgba(25, 167, 79, 0.45));
}
.export-overlay.is-sucesso .export-check {
  animation: export-check-pop 0.5s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}

.export-check-circle {
  fill: #19a74f;
  stroke: none;
}

.export-check-mark {
  fill: none;
  stroke: #fff;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}
.export-overlay.is-sucesso .export-check-mark {
  animation: export-check-draw 0.4s 0.24s ease-out forwards;
}

/* Brilho radial que expande p/ além do card. */
.export-success-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 167, 79, 0.55) 0%, rgba(25, 167, 79, 0.25) 40%, rgba(25, 167, 79, 0) 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}
.export-overlay.is-sucesso .export-success-burst {
  animation: export-burst 0.9s 0.05s ease-out forwards;
}

/* Anéis concêntricos que crescem e saem do card. */
.export-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  border: 3px solid rgba(25, 167, 79, 0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.export-overlay.is-sucesso .export-ripple { animation: export-ripple 1.1s ease-out forwards; }
.export-overlay.is-sucesso .export-ripple--2 { animation-delay: 0.18s; }
.export-overlay.is-sucesso .export-ripple--3 { animation-delay: 0.36s; }

/* Raios (sunburst) que disparam para fora do card. */
.export-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 170px;
  height: 170px;
  margin: -85px 0 0 -85px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(25, 167, 79, 0.5) 0deg 5deg, transparent 5deg 22deg);
  -webkit-mask-image: radial-gradient(circle, transparent 32%, #000 40%, #000 58%, transparent 72%);
  mask-image: radial-gradient(circle, transparent 32%, #000 40%, #000 58%, transparent 72%);
}
.export-overlay.is-sucesso .export-rays {
  animation: export-rays 0.95s 0.05s ease-out forwards;
}

.export-success-texto {
  position: relative;
  z-index: 2;
  font-size: 1.2rem;
  font-weight: 700;
  color: #19a74f;
}
.export-overlay.is-sucesso .export-success-texto {
  animation: export-texto-in 0.45s 0.26s both;
}

@keyframes export-spin {
  to { transform: rotate(360deg); }
}

@keyframes export-card-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes export-check-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes export-check-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes export-burst {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(6); opacity: 0; }
}

@keyframes export-ripple {
  0% { transform: scale(0.4); opacity: 0.7; }
  100% { transform: scale(5.5); opacity: 0; }
}

@keyframes export-rays {
  0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
  30% { opacity: 0.85; }
  100% { transform: scale(3.4) rotate(40deg); opacity: 0; }
}

@keyframes export-texto-in {
  0% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .export-spinner::before {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
  .export-overlay.is-sucesso .export-check,
  .export-overlay.is-sucesso .export-overlay-card,
  .export-overlay.is-sucesso .export-success-texto { animation: none; }
  .export-check-mark { stroke-dashoffset: 0; }
  .export-success-burst,
  .export-ripple,
  .export-rays { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Drawer "humano" das listas (Corporation/Store/Seller) — estruturas no lugar de
   nested tables. Sem bordas de planilha: usa fundos suaves, chips e abas.
   ════════════════════════════════════════════════════════════════════════════ */

/* Corpo do card de seção: lista de campos rotulados (sem tabela) */
.det-fields {
  display: flex;
  flex-direction: column;
}

/* Objeto aninhado → linhas rotuladas (label à esquerda, valor à direita) */
.det-obj {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fafafa;
  border-radius: 10px;
  padding: 6px 10px;
}
.det-obj .det-obj { background: #f3f4f6; } /* um nível mais fundo = tom levemente diferente */
.det-row {
  display: grid;
  grid-template-columns: minmax(120px, 34%) 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
}
.det-row + .det-row { border-top: 1px solid rgba(0, 0, 0, 0.05); }
.det-k {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: none;
  letter-spacing: 0.01em;
}
.det-v { min-width: 0; word-break: break-word; }

/* Listas de escalares/refs → chips */
.det-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.det-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.det-chip code { background: transparent; color: inherit; font-size: 0.78em; }

/* Array de objetos → abas (uma por item) */
.det-tabs {
  border: 1px solid #eceef1;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.det-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: #f7f8fa;
  border-bottom: 1px solid #eceef1;
}
.det-tab {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.det-tab:hover { background: #eceef1; color: #374151; }
.det-tab.is-active { background: #cc0000; color: #fff; }
.det-panels { padding: 10px; }
.det-panel { display: none; }
.det-panel.is-active { display: block; }

/* JSON cru (fallback de profundidade) com cara de bloco de código, não planilha */
.det-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.78rem;
  overflow: auto;
  max-height: 320px;
}

/* ══ RTL (árabe) ═══════════════════════════════════════════════════════════
   O build RTL do Bootstrap já espelha grid, flex e os utilitários lógicos
   (ms-/me-, border-end…). Aqui só corrigimos os elementos custom que usam
   left/right/padding físicos — todos sob [dir="rtl"], que tem prioridade sobre
   as regras-base independentemente da ordem no arquivo. */

/* Busca do topo: ícone do outro lado e espaço interno espelhado. */
[dir="rtl"] .navbar-busca-icone {
  left: auto;
  right: 0.85rem;
}
[dir="rtl"] .navbar-busca-input {
  padding: 0 2.35rem 0 0.9rem;
}
[dir="rtl"] .navbar-busca-atalho {
  right: auto;
  left: 0.6rem;
}

/* Ícone do card de estatística (canto). */
[dir="rtl"] .mestre-stat > i {
  right: auto;
  left: 0.9rem;
}

/* Contato: respiro do ícone à esquerda em vez de à direita. */
[dir="rtl"] .mestre-perfil-contato i {
  margin-right: 0;
  margin-left: 0.35rem;
}

/* Pares chave/valor aninhados. */
[dir="rtl"] .mestre-kv-aninhada .mestre-kv-chave {
  padding-left: 0;
  padding-right: 0.5rem;
}
[dir="rtl"] .mestre-kv-aninhada .mestre-kv-valor {
  padding-right: 0;
  padding-left: 0.5rem;
}

/* Listas (recuo do marcador no lado certo). */
[dir="rtl"] .mestre-ref-lista,
[dir="rtl"] .mestre-lista {
  padding-left: 0;
  padding-right: 1.1rem;
}

/* Submenu da barra lateral: borda e recuo do lado de início (direita). */
[dir="rtl"] .app-sidebar .app-submenu {
  margin: 0.125rem 0.85rem 0.25rem 0;
  padding-left: 0;
  padding-right: 0.35rem;
  border-left: 0;
  border-right: 2px solid #ededed;
}

/* Barra de "heatmap" da coluna de tamanho (Database) parte do início. */
[dir="rtl"] .db-size-bar {
  left: auto;
  right: 0;
  border-right: 0;
  border-left: 1px solid rgba(204, 0, 0, 0.3);
}

/* Cursor "máquina de escrever": respiro do lado oposto. */
[dir="rtl"] .db-carregando-label .db-cursor,
[dir="rtl"] .export-overlay-label .db-cursor {
  margin-left: 0;
  margin-right: 2px;
}

/* ══ Seletor de idioma ═════════════════════════════════════════════════════ */
/* Bandeira (flag-icons) com canto levemente arredondado e um traço fino em volta
   para destacar bandeiras com branco (EUA) do fundo claro do dropdown. */
.seletor-idioma-bandeira {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* ── Página de detalhe da proposta (abas core) ──────────────────────────────── */
.proposta-detalhe-icone {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fbe9e9;
  color: #cc0000;
  font-size: 1.4rem;
  flex: 0 0 auto;
}

.proposta-detalhe-abas {
  flex-wrap: wrap;
  border-bottom: 1px solid #e3e3e3;
}

.proposta-detalhe-abas .nav-link {
  color: #555;
  border: 1px solid transparent;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.proposta-detalhe-abas .nav-link:hover {
  color: #cc0000;
  border-color: #f0d6d6 #f0d6d6 #e3e3e3;
}

.proposta-detalhe-abas .nav-link.active {
  color: #cc0000;
  font-weight: 600;
  border-color: #e3e3e3 #e3e3e3 #fff;
}

.proposta-detalhe-card {
  border: 1px solid #ececec;
  border-radius: 12px;
}

.proposta-detalhe-card > .card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #efefef;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.proposta-detalhe-card dt { font-weight: 400; }

/* Mapa embutido (iframe OpenStreetMap) na aba Localização */
.proposta-mapa {
  display: block;
  width: 100%;
  height: 320px;
  border: 0;
}

/* Linha do tempo do histórico (situationLog) */
.proposta-timeline {
  position: relative;
  margin-left: 8px;
  padding-left: 20px;
  border-left: 2px solid #ececec;
}

.proposta-timeline-item {
  position: relative;
  padding: 0 0 18px 6px;
}

.proposta-timeline-item:last-child { padding-bottom: 0; }

.proposta-timeline-ponto {
  position: absolute;
  left: -29px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #adb5bd;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ececec;
}

.proposta-timeline-ponto.proposta-aba-lead { background: #ffc107; }
.proposta-timeline-ponto.proposta-aba-pending { background: #0d6efd; }
.proposta-timeline-ponto.proposta-aba-approved { background: #198754; }
.proposta-timeline-ponto.proposta-aba-reproved { background: #dc3545; }

/* Hierarquia (estrutura): cartões encadeados com conector vertical */
.proposta-hierarquia {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proposta-hierarquia .proposta-no {
  position: relative;
}

.proposta-hierarquia .proposta-no + .proposta-no::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -12px;
  width: 2px;
  height: 12px;
  background: #e3e3e3;
}

/* ============================================================================
   Dashboard (visão geral — nível AGX). Cards de KPI, medidor de conversão,
   funil de status e gráfico de área de cadastros. Reaproveita o combo de
   filtros das propostas (.proposta-combo*). Marca: vermelho #cc0000.
   ============================================================================ */
.dash-card {
  --dash-accent: #cc0000;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: .9rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  border-top: 3px solid var(--dash-accent);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.dash-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.dash-card-titulo {
  font-size: .82rem;
  font-weight: 600;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.dash-card-icone {
  color: var(--dash-accent);
  font-size: 1.05rem;
  line-height: 1;
}
.dash-card-valor {
  font-size: 1.9rem;
  font-weight: 700;
  color: #1d1d1f;
  line-height: 1.1;
}
.dash-card-valor--sm { font-size: 1.35rem; }
.dash-card-dinheiro {
  font-size: .95rem;
  font-weight: 600;
  color: var(--dash-accent);
}
.dash-card-rodape { margin-top: auto; }

/* Medidor de conversão (donut SVG) */
.dash-card--gauge { align-items: center; text-align: center; justify-content: center; gap: .2rem; }
.dash-gauge-wrap { position: relative; width: 96px; height: 96px; margin: 0 auto; }
.dash-gauge { width: 96px; height: 96px; display: block; }
.dash-gauge-trilho { stroke: #eef0f2; }
.dash-gauge-arco { stroke: var(--dash-accent); transition: stroke-dasharray .4s ease; }
.dash-gauge-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 700; color: #1d1d1f;
}

/* Painéis (funil + cadastros) */
.dash-painel {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: .9rem;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

/* Funil de status (barras horizontais) */
.dash-funil-linha { margin-bottom: .7rem; }
.dash-funil-cab {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: .85rem; margin-bottom: .2rem;
}
.dash-funil-nome { font-weight: 600; color: #333; }
.dash-funil-qtd { font-variant-numeric: tabular-nums; color: #1d1d1f; }
.dash-funil-barra {
  height: 12px; background: #f0f1f3; border-radius: 6px; overflow: hidden;
}
.dash-funil-barra > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #cc0000, #ff5a5a);
  border-radius: 6px;
}

/* Gráfico de área de cadastros (SVG) */
.dash-area { width: 100%; height: 160px; display: block; }
.dash-area-fill { fill: rgba(204, 0, 0, .12); }
.dash-area-linha { stroke: #cc0000; stroke-width: 2; vector-effect: non-scaling-stroke; }
.dash-area-ponto { fill: #cc0000; }

/* ───────────────────────────── Produtos ─────────────────────────────────── */
/* Tom extra das pills do hero (reusa .mestre-pill). */
.mestre-pill.is-info { background: #e7f1ff; color: #0a58ca; }

/* Autocomplete do filtro de master (dropdown sob o input). left/right=0 cobre
   a largura toda → sem ajuste para RTL. */
.produto-combo-lista {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1050;
  max-height: 18rem;
  overflow-y: auto;
  margin-top: .25rem;
}
.produto-combo-lista .list-group-item { cursor: pointer; }

/* Chips de contexto no hero do detalhe. */
.produto-hero-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.produto-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #f1f3f5;
  color: #495057;
  font-size: .825rem;
}
.produto-chip i { opacity: .75; }

/* Imagem/placeholder do produto no hero. */
.produto-hero-img {
  width: 72px;
  height: 72px;
  border-radius: .75rem;
  object-fit: cover;
  border: 1px solid #e9ecef;
  background: #fff;
}
.produto-hero-img-vazio {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #adb5bd;
}

/* Listas chave/valor mais compactas nos cards do detalhe. */
.produto-dl dt { font-weight: 500; }
.produto-dl dd { margin-bottom: .35rem; }

/* Grade de flags/recursos. */
.produto-flags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: .5rem .75rem;
}
.produto-flag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .4rem .6rem;
  border: 1px solid #f1f3f5;
  border-radius: .5rem;
}

/* Dashboard — legenda do gauge + faixas de estatística (cadastros/cliques) */
.dash-gauge-legenda {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem 1rem;
  margin: .35rem 0 .25rem;
  color: #555;
}
.dash-gauge-legenda .dash-dot,
.dash-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: .35rem;
  vertical-align: middle;
}
.dash-stats {
  display: flex;
  gap: 1.5rem;
  border-top: 1px solid #f0f1f3;
  border-bottom: 1px solid #f0f1f3;
  padding: .55rem 0;
  margin-bottom: .25rem;
}
.dash-stat { display: flex; flex-direction: column; }
.dash-stat-num { font-size: 1.25rem; font-weight: 700; color: #1d1d1f; line-height: 1.1; }
.dash-stat-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; color: #8a8a8a; }

/* Dashboard — chips de filtro ativo (acima dos cards) */
.dash-chip {
  display: inline-flex;
  align-items: center;
  background: #f1f3f5;
  border: 1px solid #e3e6ea;
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .82rem;
  color: #333;
}
.dash-chip-x { color: #9aa0a6; text-decoration: none; line-height: 1; }
.dash-chip-x:hover { color: #cc0000; }

/* ============================================================================
   Dashboard — grid arrastável/redimensionável (GridStack). O CSS base vem do
   CDN; aqui só ajustamos o conteúdo do item e o "puxador" (handle) de arrastar.
   ============================================================================ */
.grid-stack { margin: 0 -8px; }
.grid-stack-item-content {
  inset: 0;
  overflow: hidden; /* nenhum card rola: o conteúdo cabe no card (redimensione p/ ver mais) */
  display: flex;
}
/* O card preenche a célula do grid; conteúdo interno também não rola. */
.grid-stack-item-content > .dash-card,
.grid-stack-item-content > .dash-painel { flex: 1 1 auto; min-width: 0; overflow: hidden; }

/* Puxador de arrastar — discreto, aparece ao passar o mouse no card. */
.dash-drag {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  cursor: move;
  color: #c2c2c2;
  opacity: 0;
  transition: opacity .15s ease;
  font-size: .9rem;
  line-height: 1;
  padding: 0 10px;
  border-radius: 0 0 6px 6px;
  background: rgba(255, 255, 255, .9);
}
.grid-stack-item-content:hover .dash-drag { opacity: 1; }
.dash-drag:hover { color: #cc0000; }

/* Realce sutil enquanto arrasta/redimensiona. */
.grid-stack-item.ui-draggable-dragging .grid-stack-item-content,
.grid-stack-item.ui-resizable-resizing .grid-stack-item-content {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

/* ── Cards com visualização comutável (Chart.js) ───────────────────────────── */
.dash-switch { display: flex; flex-direction: column; }
.dash-switch-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dash-chart-wrap { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; }
.dash-chart-wrap canvas { position: absolute; inset: 0; }

/* Botão de trocar a visualização (no cabeçalho do card; realça no hover). */
.dash-view-toggle {
  border: 0; background: transparent; color: #b9bdc2; cursor: pointer;
  line-height: 1; padding: 2px 6px; border-radius: 6px; flex: none;
  transition: color .15s ease, background .15s ease;
}
.grid-stack-item-content:hover .dash-view-toggle { color: #6b7075; }
.dash-view-toggle:hover { color: #cc0000; background: #f1f3f5; }

/* % no centro da rosca de conversão. */
.dash-donut-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; color: #1d1d1f; pointer-events: none;
}
/* View "número" (valor grande centralizado). */
.dash-bignum { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .25rem; }
.dash-bignum-v { font-size: 2rem; font-weight: 700; color: #1d1d1f; line-height: 1.1; }
/* View "tabela". */
.dash-vtable { font-size: .85rem; }
.dash-vtable th { color: #8a8a8a; font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .02em; }
