/* Console SQL. Copia do software/src/componentes/ConsoleSQL.css do LevOps.
   O bloco "ajustes para o Pulse" no fim neutraliza os estilos globais de
   table, thead th, tbody tr, td e input do css/style.css. */

.sqlc-bolha {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(21, 42, 81, 0.24);
  z-index: 900;
  transition: transform 0.15s;
}

.sqlc-bolha:hover { transform: scale(1.06); }

.sqlc-painel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 560px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--sombra);
  font-family: Montserrat, system-ui, sans-serif;
  z-index: 900;
  overflow: hidden;
}

.sqlc-topo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
}

.sqlc-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sqlc-tenant {
  font-size: 11px;
  color: var(--muted2);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: auto;
}

.sqlc-limpar,
.sqlc-fechar {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.sqlc-limpar:hover,
.sqlc-fechar:hover { background: var(--surface2); color: var(--text); }

.sqlc-limpar-ativo {
  background: var(--acao-dim);
  color: var(--text);
}

.sqlc-fechar { font-size: 16px; line-height: 1; }

.sqlc-entrada {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.sqlc-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.sqlc-input:focus-within { border-color: var(--accent); }

.sqlc-input .cm-editor,
.sqlc-input .cm-scroller,
.sqlc-input .cm-gutters { background: transparent; }

.sqlc-input .cm-placeholder { color: var(--muted2); }

.sqlc-input .cm-content ::selection,
.sqlc-input .cm-line::selection,
.sqlc-input .cm-line > span::selection {
  background: rgba(200,217,74,0.55) !important;
}

.sqlc-input .cm-selectionBackground,
.sqlc-input .cm-focused .cm-selectionBackground {
  background: rgba(200,217,74,0.55) !important;
}

.sqlc-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.sqlc-dica {
  font-size: 11px;
  color: var(--muted2);
  margin-right: auto;
}

.sqlc-rodar {
  background: var(--acao);
  color: var(--sobre-acao);
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.sqlc-rodar:disabled { opacity: 0.45; cursor: default; }

.sqlc-saida {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
}

.sqlc-erro {
  background: var(--badge-erro-bg, rgba(194,51,80,0.12));
  color: var(--erro);
  border-radius: 8px;
  padding: 10px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.sqlc-ok {
  color: var(--verde);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
}

.sqlc-barra {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sqlc-conta {
  font-size: 11px;
  color: var(--muted2);
  margin-right: auto;
}

.sqlc-copiar {
  background: var(--surface2);
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
}

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

.sqlc-tabela-caixa {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sqlc-tabela {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.sqlc-tabela th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 7px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.sqlc-tabela td {
  padding: 6px 10px;
  color: var(--text);
  border-bottom: 1px solid var(--linha-1);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sqlc-tabela tbody tr:hover td { background: var(--linha-0); }


.sqlc-hist {
  max-height: 180px;
  overflow: auto;
  border-bottom: 1px solid var(--border);
  padding: 6px;
}

.sqlc-hist-vazio {
  font-size: 12px;
  color: var(--muted2);
  padding: 8px;
}

.sqlc-hist-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
}

.sqlc-hist-check {
  accent-color: var(--acao);
  cursor: pointer;
  flex: none;
}

.sqlc-hist-item {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sqlc-hist-item:hover { background: var(--surface2); color: var(--text); }

.sqlc-hist-rodape {
  position: sticky;
  bottom: -6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  background: var(--surface);
}

.sqlc-hist-erro {
  color: var(--erro);
  font-size: 10px;
  margin-right: 6px;
}

.sqlc-hist-rodape .sqlc-copiar:disabled { opacity: 0.4; cursor: default; }

.sqlc-hist-apagar {
  background: transparent;
  border: none;
  color: var(--erro);
  font-family: inherit;
  font-size: 11px;
  padding: 6px 8px;
  cursor: pointer;
  margin-left: auto;
}

@media (max-width: 768px) {
  .sqlc-bolha {
    right: 16px;
    bottom: 16px;
    left: auto !important;
    top: auto !important;
  }

  .sqlc-painel {
    left: 0 !important;
    top: 0 !important;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .sqlc-topo {
    cursor: default;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }

  .sqlc-fechar {
    font-size: 22px;
    padding: 10px 14px;
    margin-right: -4px;
  }

  .sqlc-input .cm-editor { height: 96px; }
  .sqlc-input .cm-content { font-size: 16px; }

  .sqlc-tabela td { max-width: 160px; }
}

/* ajustes para o Pulse */

.sqlc-tabela {
  background: transparent;
  border: none;
  border-radius: 0;
}

.sqlc-tabela thead th {
  font-family: inherit;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
  padding: 7px 10px;
}

.sqlc-tabela tbody tr,
.sqlc-tabela tbody tr:last-child {
  border-bottom: none;
  transition: none;
}

.sqlc-tabela tbody tr:hover { background: transparent; }

.sqlc-tabela td {
  font-size: 12px;
  vertical-align: baseline;
}

.sqlc-hist-check {
  background: initial;
  border: initial;
}