/* =====================================================================
    integracao-monitor.css  -  v2.0
    Estilos do painel de integracoes Sankhya -> Supabase + placeholders.

    HISTORICO DE VERSOES
    v2.0  2026-05-13  Novos blocos no rodape do arquivo:
                        .mg-int-run-progress      (box azul + spinner)
                        .mg-int-run-progress-*    (head, meta, elapsed)
                        .mg-int-run-spinner       (animacao CSS)
                        .mg-int-run-resumo        (host do card final)
                        .mg-int-resumo / --ok / --err  (azul/vermelho)
                        .mg-int-resumo-icon / -body / -title / -line
                        .mg-int-resumo-dica       (mensagem de erro)
                      Suporte visual ao fluxo job + polling do
                      integracao-monitor-view.js v2.0.
    v1.0  -           Estilos base do painel (tabela, KPIs, log, bulk).
   ===================================================================== */

/* Modulos: monitor de integracao + placeholders futuros */

.mg-int,
.mg-mod {
  --mg-int-accent: var(--mg-sidebar-bg, #2563eb);
  --mg-int-radius: 10px;
}

.mg-view-port:has(.mg-int--monitor) {
  max-width: 100%;
}

/* --- Botões reutilizáveis dentro dos módulos --- */
.mg-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.mg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mg-btn--ghost {
  background: var(--mg-card-bg, #fff);
  border-color: var(--mg-border, #e8eaed);
  color: var(--mg-int-accent);
}

.mg-btn--pri {
  background: var(--mg-int-accent);
  color: #fff;
}

/* --- Painel integração --- */
.mg-int-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.mg-int-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--mg-text, #1a1d21);
}

.mg-int-desc {
  margin: 0;
  max-width: 52rem;
  font-size: 0.9375rem;
  color: var(--mg-text-muted, #5f6368);
  line-height: 1.55;
}

.mg-int-desc code {
  font-size: 0.8125rem;
  background: var(--mg-page-bg, #f8f9fa);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--mg-border, #e8eaed);
}

.mg-int-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border, #e8eaed);
  border-radius: var(--mg-int-radius);
  margin-bottom: 1.35rem;
}

.mg-int-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
}

.mg-int-status strong {
  color: var(--mg-text);
  font-weight: 600;
}

.mg-int-status--solo {
  margin-left: auto;
  flex-direction: column;
  align-items: flex-end;
}

.mg-int-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.mg-int-dot--neutral {
  background: #bdc1c6;
}

.mg-int-dot--ok {
  background: #2563eb;
}

.mg-int-dot--err {
  background: #ef4444;
}

.mg-int-banner {
  border-radius: var(--mg-int-radius);
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.mg-int-banner--warn {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.mg-int-banner--muted {
  background: #f1f5f9;
  border: 1px solid var(--mg-border);
  color: var(--mg-text-muted);
}

.mg-int-api-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--mg-page-bg, #f8f9fa);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--mg-border);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-int-sessao {
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-int-radius);
  padding: 0 1rem;
  margin-bottom: 1rem;
  /* Por cima da grelha de processos: evita a coluna de detalhe “roubar” o clique no ? */
  position: relative;
  z-index: 6;
  isolation: isolate;
}

.mg-int-sessao summary {
  cursor: pointer;
  padding: 0.85rem 0;
  font-weight: 600;
  font-size: 0.875rem;
}

.mg-int-sessao-body {
  padding-bottom: 1rem;
}

.mg-int-sessao-lead {
  margin: 0 0 0.65rem;
  font-size: 0.78125rem;
  line-height: 1.45;
}

.mg-int-sessao-erro {
  margin-top: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
}

.mg-int-sessao-erro-sum {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
  color: #991b1b;
}

.mg-int-sessao-erro-pre {
  margin: 0.5rem 0;
  padding: 0.5rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--mg-border);
  background: var(--mg-card-bg, #fff);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 14rem;
  overflow: auto;
}

.mg-int-textarea {
  width: 100%;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--mg-border);
  resize: vertical;
}

.mg-btn-small {
  font-size: 0.75rem;
  padding: 0.45rem 0.75rem;
}

.mg-int-muted {
  color: var(--mg-text-muted, #5f6368);
  font-size: 0.8125rem;
}

.mg-int-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* Disparar todas as importações — faixa acima da lista + painel de detalhe */
.mg-int-bulk-bar {
  grid-column: 1 / -1;
  padding: 0.85rem 1rem;
  border: 1px solid var(--mg-border, #e8eaed);
  border-radius: var(--mg-int-radius);
  background: var(--mg-card-bg, #fff);
}

.mg-int-bulk-disparar-btn {
  width: 100%;
  justify-content: center;
  font-size: 0.875rem;
  padding: 0.65rem 1rem;
}

.mg-int-bulk-bar-hint {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.mg-int-bulk-overlay {
  z-index: 120050;
}

.mg-int-bulk-overlay--running .mg-int-help-backdrop {
  pointer-events: none;
}

.mg-int-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.mg-int-bulk-progress-wrap {
  margin-bottom: 0.25rem;
}

.mg-int-bulk-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--mg-page-bg, #f1f5f9);
  border: 1px solid var(--mg-border);
  overflow: hidden;
}

.mg-int-bulk-progress-fill {
  height: 100%;
  background: var(--mg-int-accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.22s ease;
}

.mg-int-bulk-progress-meta {
  margin: 0.45rem 0 0;
  font-size: 0.8125rem;
  color: var(--mg-text);
}

.mg-int-bulk-progress-meta strong {
  color: var(--mg-int-accent);
}

.mg-int-bulk-subh {
  margin: 1rem 0 0.45rem;
  font-size: 0.8125rem;
}

.mg-int-bulk-log {
  max-height: min(220px, 28vh);
  overflow: auto;
  border: 1px solid var(--mg-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: var(--mg-page-bg, #f8f9fa);
  font-size: 0.75rem;
  line-height: 1.45;
}

.mg-int-bulk-log-line {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--mg-border);
}

.mg-int-bulk-log-line:last-child {
  border-bottom: none;
}

.mg-int-bulk-log-line--ok {
  color: #1d4ed8;
}

.mg-int-bulk-log-line--err {
  color: #b91c1c;
}

.mg-int-bulk-summary {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--mg-text);
}

.mg-int-bulk-erros-details {
  margin-top: 0.65rem;
  border: 1px solid var(--mg-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: var(--mg-card-bg);
}

.mg-int-bulk-erros-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
}

.mg-int-bulk-erro-bloco {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--mg-border);
}

.mg-int-bulk-erro-bloco:first-child {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: none;
}

.mg-int-bulk-erro-bloco h4 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mg-text-muted);
}

.mg-int-bulk-erro-pre {
  margin: 0;
  padding: 0.5rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--mg-border);
  background: var(--mg-page-bg);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65625rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 10rem;
  overflow: auto;
}

.mg-int-sessao .mg-int-help-pill {
  position: relative;
  z-index: 7;
}

@media (max-width: 960px) {
  .mg-int-shell {
    grid-template-columns: 1fr;
  }

  .mg-int-status--solo {
    align-items: flex-start;
    margin-left: 0;
  }
}

.mg-int-lista {
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border, #e8eaed);
  border-radius: var(--mg-int-radius);
  overflow: hidden;
  min-width: 0;
}

.mg-int-lista-head {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--mg-border, #e8eaed);
}

.mg-int-subtitle {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.mg-int-lista-hint {
  margin: -0.35rem 0 0;
  color: var(--mg-text-muted, #5f6368);
  font-size: 0.71875rem;
  line-height: 1.35;
}

.mg-int-search {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--mg-border);
  width: 100%;
}

.mg-int-search:disabled {
  background: var(--mg-page-bg, #f8f9fa);
  color: var(--mg-text-muted);
}

.mg-int-tabelas-menu {
  border: 1px solid var(--mg-border);
  border-radius: 8px;
  background: var(--mg-page-bg, #f8f9fa);
  overflow: hidden;
}

.mg-int-tabelas-menu summary {
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mg-text);
}

.mg-int-tabelas-menu-list {
  margin: 0;
  padding: 0.55rem 0.65rem;
  max-height: 11rem;
  overflow: auto;
  border-top: 1px solid var(--mg-border);
  color: var(--mg-text);
  background: var(--mg-card-bg, #fff);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.mg-int-table-wrap {
  max-height: min(520px, 55vh);
  overflow: auto;
}

.mg-int-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78125rem;
  table-layout: fixed;
}

.mg-int-table th:nth-child(1),
.mg-int-table td:nth-child(1) {
  width: 44%;
}

.mg-int-table th:nth-child(2),
.mg-int-table td:nth-child(2) {
  width: 34%;
}

.mg-int-table th:nth-child(3),
.mg-int-table td:nth-child(3) {
  width: 22%;
}

.mg-int-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--mg-page-bg, #f8f9fa);
  border-bottom: 1px solid var(--mg-border);
  font-weight: 600;
  color: var(--mg-text-muted);
}

.mg-int-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--mg-border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.mg-int-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.mg-int-row:hover {
  background: rgba(37, 99, 235, 0.045);
}

.mg-int-row--active {
  background: rgba(37, 99, 235, 0.1);
  outline: 1px solid rgba(37, 99, 235, 0.25);
  outline-offset: -1px;
}

.mg-int-strong {
  font-weight: 600;
}

.mg-int-micro {
  font-size: 0.6875rem;
  color: var(--mg-text-muted);
}

.mg-int-mono {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71875rem;
  color: var(--mg-text);
}

/* Detalhe */
.mg-int-detail {
  background: transparent;
  min-width: 0;
}

.mg-int-detail-empty {
  background: var(--mg-card-bg, #fff);
  border: 1px dashed var(--mg-border, #dadce0);
  border-radius: var(--mg-int-radius);
  padding: 2rem 1.25rem;
  text-align: center;
}

.mg-int-detail-empty-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.mg-int-detail-body > * + * {
  margin-top: 1rem;
}

.mg-int-detail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.05rem;
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-int-radius);
  min-width: 0;
}

.mg-int-detail-run-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.mg-int-detail-title {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 700;
}

.mg-int-card {
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-int-radius);
  padding: 1rem 1.05rem;
  min-width: 0;
}

.mg-int-kpis {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.mg-int-kpi-label {
  margin: 0 0 0.25rem;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mg-text-muted);
}

.mg-int-kpi-val {
  margin: 0;
  font-size: clamp(1rem, 1.45vw, 1.25rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mg-int-kpi-note {
  margin: 0.35rem 0 0;
  font-size: 0.6875rem;
  color: var(--mg-text-muted);
  line-height: 1.4;
}

.mg-int-h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.mg-int-timeline {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.6;
}

.mg-int-timeline li + li {
  margin-top: 0.4rem;
}

.mg-int-log-panel {
  padding-bottom: 0.85rem;
}

.mg-int-log-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  align-items: baseline;
}

.mg-int-log {
  margin: 0;
  min-height: 120px;
  max-height: min(320px, 42vh);
  overflow: auto;
  padding: 0.85rem;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.6875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Chips */
.mg-int-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.mg-int-chip--stub {
  background: #fde68a;
  color: #713f12;
}

.mg-int-chip--ok {
  background: #dbeafe;
  color: #1e40af;
}

.mg-int-chip--idle {
  background: #f1f5f9;
  color: var(--mg-text-muted);
}

.mg-int-chip--alert {
  background: #fecaca;
  color: #7f1d1d;
}

.mg-int-chip--run {
  background: #bfdbfe;
  color: #1e40af;
}

.mg-int-chip--ok-live {
  background: #dbeafe;
  color: #1d4ed8;
}

.mg-int-chip--alert-live {
  background: #fee2e2;
  color: #991b1b;
}

/* Avisos inline (substitui alert nativo) */
.mg-int-flash-host {
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
}

.mg-int-flash {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

/* --- Placeholder de módulos --- */
.mg-mod-head .mg-mod-title {
  margin: 0 0 0.4rem;
  font-size: 1.375rem;
  font-weight: 700;
}

.mg-mod-desc {
  margin: 0;
  max-width: 40rem;
  color: var(--mg-text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.mg-mod-cards {
  margin-top: 1.75rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.mg-mod-card-skel {
  min-height: 120px;
  background: var(--mg-card-bg, #fff);
  border: 1px dashed var(--mg-border);
  border-radius: var(--mg-int-radius);
  padding: 1rem;
}

.mg-mod-line {
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #eff1f5 0%,
    #f6f8fa 48%,
    #eff1f5 96%
  );
  background-size: 200% 100%;
  animation: mg-module-shimmer 1.35s ease-in-out infinite;
}

@keyframes mg-module-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.mg-mod-line + .mg-mod-line {
  margin-top: 0.65rem;
}

.mg-mod-line-w40 {
  width: 40%;
}

.mg-mod-line-w55 {
  width: 55%;
}

.mg-mod-line-w50 {
  width: 50%;
}

.mg-mod-line-w70 {
  width: 70%;
}

.mg-mod-line-w90 {
  width: 90%;
}

/* --- Botão de estado do servidor --- */
.mg-int-srv-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  cursor: default;
  transition: background 0.2s, color 0.2s;
  user-select: none;
}

.mg-int-srv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.85;
}

.mg-int-srv-btn--neutral {
  background: #f1f5f9;
  color: #64748b;
}

.mg-int-srv-btn--ok {
  background: #dbeafe;
  color: #1d4ed8;
}

.mg-int-srv-btn--err {
  background: #fee2e2;
  color: #b91c1c;
}

.mg-int-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* --- Ajuda / modal overlay --- */
.mg-int-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 120000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.mg-int-help-overlay[hidden] {
  display: none;
}

.mg-int-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.mg-int-help-dialog {
  position: relative;
  z-index: 1;
  width: min(700px, 100%);
  max-height: min(88vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border, #e8eaed);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

.mg-int-help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--mg-border, #e8eaed);
}

.mg-int-help-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mg-text);
}

.mg-int-help-lead {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--mg-text-muted);
  line-height: 1.45;
}

.mg-int-help-body {
  overflow: auto;
  padding: 0.85rem 1rem 1.1rem;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.mg-int-help-section-title {
  margin: 1rem 0 0.4rem;
  font-size: 0.78125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mg-text-muted);
}

.mg-int-help-section:first-of-type .mg-int-help-section-title {
  margin-top: 0.15rem;
}

.mg-int-help-block {
  margin-top: 0.65rem;
}

.mg-int-help-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.mg-int-help-label {
  font-weight: 600;
  font-size: 0.78125rem;
  color: var(--mg-text);
}

.mg-int-help-pre {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--mg-border);
  background: var(--mg-page-bg, #f8f9fa);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 11rem;
  overflow: auto;
}

/* --- Formulários ligação / .env (aba integração) --- */
.mg-int-config {
  background: var(--mg-card-bg, #fff);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-int-radius);
  padding: 0 1rem;
  margin-bottom: 1rem;
}

.mg-int-config-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  cursor: pointer;
  padding: 0.82rem 0;
  font-weight: 600;
  font-size: 0.875rem;
  list-style: none;
}

.mg-int-config-sum::-webkit-details-marker {
  display: none;
}

.mg-int-config-sum span:first-of-type {
  flex: 1;
  min-width: 160px;
}

.mg-int-help-pill {
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border-radius: 50%;
  font-size: 0.78125rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--mg-int-accent);
  background: transparent;
  color: var(--mg-int-accent);
  cursor: pointer;
}

.mg-int-help-pill:hover {
  background: rgba(37, 99, 235, 0.08);
}

.mg-int-config-body {
  padding-bottom: 1rem;
}

.mg-int-config-hint {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.mg-int-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.72rem;
}

.mg-int-field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}

.mg-int-field-lab {
  font-size: 0.71875rem;
  font-weight: 600;
  color: var(--mg-text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mg-int-input {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.52rem 0.62rem;
  border-radius: 8px;
  border: 1px solid var(--mg-border);
  width: 100%;
  box-sizing: border-box;
}

.mg-int-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
}

.mg-int-input--err {
  border-color: #ef4444;
}

.mg-int-field-msg {
  font-size: 0.78125rem;
  color: var(--mg-text-muted);
  margin: -0.2rem 0 0.65rem;
  min-height: 1rem;
}

.mg-int-config-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.mg-int-sessao-actions {
  margin-top: 0.52rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.mg-int-help-mini {
  padding-bottom: 0.35rem;
}

.mg-int-help-bullet {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  color: var(--mg-text-muted);
  line-height: 1.6;
}

.mg-int-help-bullet li + li {
  margin-top: 0.35rem;
}

.mg-int-mini-foot {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--mg-text-muted);
}

.mg-int-help-kbd {
  border: 1px solid var(--mg-border);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.6875rem;
  background: var(--mg-page-bg, #fafafa);
}

.mg-int-help-passo-tit {
  font-weight: 700;
  font-size: 0.8125rem;
  margin-bottom: 0.38rem;
  color: var(--mg-text);
}

.mg-int-help-passo-corpo {
  font-size: 0.7925rem;
  color: var(--mg-text-muted);
  line-height: 1.55;
}

.mg-int-help-passo + .mg-int-help-passo {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mg-border);
}

.mg-int-codigo-copiavel {
  display: block;
  margin-top: 0.55rem;
  padding: 0.72rem;
  border-radius: 8px;
  border: 1px solid var(--mg-border);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  white-space: pre-wrap;
  word-break: break-all;
  background: #1e293b;
  color: #e2e8f0;
}

.mg-int-pass2-btn {
  margin-top: 0.5rem !important;
}

.mg-int-margin-top-help {
  margin-top: 1.15rem !important;
}

/* --- Ajuda guiada (fluxo acionável) --- */
.mg-int-help-guided {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mg-int-help-sumup {
  margin: 0;
  padding: 0.65rem 0.72rem;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.mg-int-help-callout {
  border: 1px solid var(--mg-border);
  border-radius: 10px;
  padding: 0.82rem 0.92rem;
  background: var(--mg-page-bg, #f9fafb);
}

.mg-int-help-act-title {
  margin: 0 0 0.52rem;
  font-size: 0.84375rem;
  font-weight: 700;
  color: var(--mg-text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mg-int-help-act-title-mini {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--mg-text);
}

.mg-int-help-stepchip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 6px;
  background: var(--mg-int-accent);
  color: #fff;
  font-size: 0.6875rem;
}

.mg-int-help-ol-tight {
  margin: 0 0 0.65rem;
  padding-left: 1.35rem;
  font-size: 0.795rem;
  line-height: 1.55;
  color: var(--mg-text-muted);
}

.mg-int-help-ol-tight li + li {
  margin-top: 0.4rem;
}

.mg-int-help-callout > .mg-btn {
  margin-top: 0.15rem;
}

.mg-int-help-gap-s {
  display: block;
  margin-bottom: 0.5rem;
}

.mg-int-help-gap-m {
  margin-top: 1rem !important;
}

.mg-int-help-bullet-tight {
  font-size: 0.7825rem;
  line-height: 1.5;
}

.mg-int-help-devfold {
  border: 1px dashed var(--mg-border);
  border-radius: 8px;
  padding: 0.45rem 0.72rem;
  background: rgba(248, 250, 252, 0.9);
}

.mg-int-help-devfold summary {
  cursor: pointer;
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--mg-int-accent);
  padding: 0.38rem 0;
}

.mg-int-help-pre-short {
  max-height: 6.5rem;
}

.mg-int-help-stepcard {
  border-radius: 10px;
  border: 1px solid var(--mg-border);
  overflow: hidden;
}

.mg-int-help-stepcard--accent {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.mg-int-help-stepcard--muted {
  background: var(--mg-page-bg, #fafbfc);
  border-style: dashed;
}

.mg-int-help-stepcard-inner {
  display: flex;
  gap: 0.85rem;
  padding: 0.92rem;
  align-items: flex-start;
}

.mg-int-help-stepnum {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--mg-int-accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
}

.mg-int-help-stepnum--soft {
  background: #cbd5e1;
  color: #334155;
}

.mg-int-help-kbd-inline {
  border: 1px solid var(--mg-border);
  border-radius: 4px;
  padding: 0.06rem 0.32rem;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71875rem;
  background: #fff;
}

textarea[data-sess-field]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 1px;
}

/* ============================================================
   Job assíncrono — box de progresso ao vivo + card de resumo
   ============================================================ */

.mg-int-run-progress {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mg-int-run-progress-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.875rem;
  color: #075985;
}

.mg-int-run-progress-elapsed {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: #0c4a6e;
  font-weight: 600;
}

.mg-int-run-progress-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: #0c4a6e;
  line-height: 1.45;
}

.mg-int-run-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid #bae6fd;
  border-top-color: #0284c7;
  animation: mg-int-spin 0.9s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

/* Card de resumo final --------------------------------------- */

.mg-int-run-resumo {
  margin: 0.75rem 0 0;
}

.mg-int-resumo {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  border-left: 5px solid;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.mg-int-resumo--ok {
  border-left-color: #2563eb;
  background: #eff6ff;
}

.mg-int-resumo--err {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.mg-int-resumo-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.mg-int-resumo-body {
  flex: 1;
  min-width: 0;
}

.mg-int-resumo-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
}

.mg-int-resumo--ok .mg-int-resumo-title {
  color: #1d4ed8;
}

.mg-int-resumo--err .mg-int-resumo-title {
  color: #7f1d1d;
}

.mg-int-resumo-line {
  margin: 0 0 0.2rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.mg-int-resumo-line code {
  background: rgba(15, 23, 42, 0.06);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-size: 0.78125rem;
}

.mg-int-resumo-dica {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.7rem;
  background: rgba(220, 38, 38, 0.08);
  border-radius: 5px;
  font-size: 0.8125rem;
  color: #7f1d1d;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
