/* AT — Consulta rápida (sheet estilo ficha de compras) */

.at-consulta-rapida-modal {
  justify-content: center;
  align-items: center;
  z-index: 12050;
}

.at-consulta-rapida-shell {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff !important;
  color: #0f172a !important;
}

.at-consulta-rapida-shell .cp-detail-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 !important;
  background: #fff !important;
  color: #0f172a !important;
}

.at-cr-layout {
  height: min(78vh, 820px);
  min-height: 420px;
  background: #fff;
  color: #0f172a;
}

.at-cr-layout .cp-sheet-main {
  overflow: auto;
  gap: 14px;
  background: #fff;
  color: #0f172a;
}

.at-cr-search-fields {
  grid-template-columns: 1fr !important;
}

.at-cr-search-field strong {
  white-space: normal !important;
}

.at-cr-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.at-cr-search-row .ui-input {
  flex: 1;
  min-width: 220px;
  color: #0f172a !important;
  background: #fff !important;
  border-color: #cbd5e1 !important;
}

.at-cr-hint {
  background: #fffbeb !important;
  border: 1px solid #fcd34d !important;
}

.at-cr-hint span,
.at-cr-hint p {
  margin: 0;
  color: #92400e !important;
  font-size: 13px;
  line-height: 1.4;
}

.at-cr-resultado {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

.at-cr-grupo .cp-sheet-section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #0f172a !important;
  font-size: 14px !important;
}

.at-cr-grupo .cp-sheet-section-title small {
  color: #475569 !important;
  font-weight: 500;
  font-size: 11px;
}

.at-cr-grupo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.at-cr-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
  color: #0f172a;
}

.at-cr-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.at-cr-card__head strong {
  color: #0f172a !important;
  font-size: 14px;
}

.at-cr-card-fields {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}

.at-cr-card-fields .cp-sheet-field strong {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.at-cr-card__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Aside: mesmo padrão da ficha de compras (cp-sheet-action) */
.at-cr-layout > .cp-sheet-actions {
  gap: 2px;
  padding: 14px 10px;
  overflow-y: auto;
  background: #f4fbfc !important;
  border-left: 1px solid #d7e2e6;
  color: #0f172a;
}

/*
 * Dark mode global força:
 *   :root:not(.light-mode) .modal-content span { color:#e2e8f0 !important; }
 * No sheet branco isso apaga rótulos e ações. Trava contraste aqui.
 */
#atConsultaRapidaModal .cp-sheet-field span,
#atConsultaRapidaModal .cp-sheet-note span,
#atConsultaRapidaModal .cp-sheet-status-inline span,
#atConsultaRapidaModal .cp-sheet-links > span,
#atConsultaRapidaModal .cp-sheet-totals span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-field span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-note span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-status-inline span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-links > span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-totals span,
:root:not(.light-mode) #atConsultaRapidaModal .at-cr-hint span,
:root:not(.light-mode) #atConsultaRapidaModal .at-cr-grupo .cp-sheet-section-title small {
  color: #475569 !important;
}

#atConsultaRapidaModal .cp-sheet-field strong,
#atConsultaRapidaModal .cp-sheet-status-inline strong,
#atConsultaRapidaModal .cp-sheet-totals strong,
#atConsultaRapidaModal .at-cr-card__head strong,
#atConsultaRapidaModal .at-cr-grupo .cp-sheet-section-title,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-field strong,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-status-inline strong,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-totals strong,
:root:not(.light-mode) #atConsultaRapidaModal .at-cr-card__head strong,
:root:not(.light-mode) #atConsultaRapidaModal .at-cr-grupo .cp-sheet-section-title {
  color: #0f172a !important;
}

#atConsultaRapidaModal .cp-sheet-status-inline strong,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-status-inline strong {
  color: #9a3412 !important;
  background: #ffedd5 !important;
}

#atConsultaRapidaModal .cp-sheet-actions-title span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-actions-title span {
  color: #1e293b !important;
}

#atConsultaRapidaModal .cp-sheet-actions-title small,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-actions-title small {
  color: #64748b !important;
}

#atConsultaRapidaModal .cp-sheet-action,
#atConsultaRapidaModal .cp-sheet-action > span,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-action,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-action > span {
  color: #9f1239 !important;
}

#atConsultaRapidaModal .cp-sheet-action i,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-action i {
  color: #9f1239 !important;
}

#atConsultaRapidaModal .cp-sheet-action.is-ready small,
:root:not(.light-mode) #atConsultaRapidaModal .cp-sheet-action.is-ready small {
  color: #065f46 !important;
  background: #d1fae5 !important;
}

#atConsultaRapidaModal .at-cr-hint p,
:root:not(.light-mode) #atConsultaRapidaModal .at-cr-hint p {
  color: #92400e !important;
}

#atConsultaRapidaModal .ui-badge,
:root:not(.light-mode) #atConsultaRapidaModal .ui-badge {
  border: 1px solid transparent;
  font-weight: 650;
}

#atConsultaRapidaModal .ui-badge--info,
:root:not(.light-mode) #atConsultaRapidaModal .ui-badge--info {
  background: #e0f2fe !important;
  color: #075985 !important;
  border-color: #7dd3fc !important;
}

#atConsultaRapidaModal .ui-badge--ok,
:root:not(.light-mode) #atConsultaRapidaModal .ui-badge--ok {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

#atConsultaRapidaModal .ui-badge--warn,
:root:not(.light-mode) #atConsultaRapidaModal .ui-badge--warn {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-color: #fdba74 !important;
}

#atConsultaRapidaModal .ui-alert--warn,
:root:not(.light-mode) #atConsultaRapidaModal .ui-alert--warn {
  background: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #92400e !important;
}

#atConsultaRapidaModal .ui-alert--danger,
:root:not(.light-mode) #atConsultaRapidaModal .ui-alert--danger {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

#atConsultaRapidaModal .ui-empty,
:root:not(.light-mode) #atConsultaRapidaModal .ui-empty {
  color: #475569 !important;
}

.at-cr-table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

#atConsultaRapidaModal .at-cr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #0f172a !important;
}

#atConsultaRapidaModal .at-cr-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

#atConsultaRapidaModal .at-cr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a !important;
  vertical-align: middle;
}

#atConsultaRapidaModal .at-cr-row {
  cursor: pointer;
}

#atConsultaRapidaModal .at-cr-row:hover td {
  background: #eff6ff !important;
}

#atConsultaRapidaModal .at-cr-row:focus {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
}

/* Valor digitado em Pesquisar — destaque na tabela/relatório */
#atConsultaRapidaModal mark.at-cr-mark {
  background: #fde68a;
  color: #92400e;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #f59e0b;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.at-cr-report-block {
  margin-top: 4px;
  padding-top: 4px;
}

.at-cr-subtitle {
  margin: 10px 0 8px;
  color: #334155 !important;
  font-size: 12px;
  font-weight: 700;
}

.at-cr-empty-sec {
  margin: 0;
  color: #64748b !important;
  font-size: 13px;
}

.at-cr-kpis {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px 14px;
  margin-bottom: 8px;
}

.at-cr-table--compact td,
.at-cr-table--compact th {
  padding: 7px 10px !important;
  font-size: 12px !important;
}

@media (max-width: 900px) {
  .at-cr-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }

  .at-cr-layout > .cp-sheet-actions {
    border-left: none;
    border-top: 1px solid #d7e2e6;
  }
}
