/* Central Gestão ERP — padrão de formulários, Clube de Fidelidade e Metas.
   Seletor ancorado em IDs das duas páginas. Não altera o restante do ERP.
   Não modifica programação, campos, dados nem relatórios/impressões. */

/* Clube de Fidelidade: formulário em quadro alinhado, padrão dos cadastros. */
#page-content:has(#loyalty-name) > .page-header {
  display:flex; flex-wrap:wrap; align-items:center;
  gap:10px; margin:0 0 18px !important;
}
#page-content:has(#loyalty-name) > .card {
  box-sizing:border-box;
  width:100%;
  max-width:920px !important;
  min-width:0;
  padding:22px 24px !important;
  margin-bottom:18px;
  background:#f1f6fd !important;
  border:1px solid #aec6e4 !important;
  border-radius:8px !important;
  box-shadow:0 1px 3px rgba(12,42,86,.055);
}
#page-content:has(#loyalty-name) > .card > h3 {
  margin:0 0 20px !important;
  padding:0 0 13px;
  color:#183b6a !important;
  font-size:16px !important;
  font-weight:700 !important;
  line-height:1.4;
  border-bottom:1px solid #c8d8ec;
}
#page-content:has(#loyalty-name) > .card .form-group {
  display:flex;
  flex-direction:column;
  min-width:0;
  gap:7px;
}
#page-content:has(#loyalty-name) > .card > .form-group {
  margin-bottom:16px !important;
}
#page-content:has(#loyalty-name) > .card > div[style*="display:grid"] {
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:14px 16px !important;
  margin-bottom:16px !important;
  align-items:start;
}
#page-content:has(#loyalty-name) > .card .form-group label {
  display:block;
  color:#183b6a !important;
  font-size:12px !important;
  font-weight:700 !important;
  line-height:1.4;
}
#page-content:has(#loyalty-name) > .card .form-control {
  box-sizing:border-box;
  display:block;
  width:100% !important;
  min-width:0;
  max-width:100%;
  height:42px;
  min-height:42px;
  padding:9px 12px !important;
  border:1px solid #b2c6e0 !important;
  border-radius:6px !important;
  background:#fff;
  color:#183960;
  font-size:14px;
}
#page-content:has(#loyalty-name) > .card .form-control:focus-visible {
  outline:2px solid #306cdb;
  outline-offset:1px;
}
#page-content:has(#loyalty-name) > .card .form-group span {
  display:block;
  color:#566f8c !important;
  font-size:12px !important;
  line-height:1.5;
}
#page-content:has(#loyalty-name) > .card > button[onclick="submitSaveLoyaltyRules()"] {
  display:block;
  min-height:42px;
  margin:18px 0 0 auto;
  padding:9px 20px;
}

/* Metas Comerciais: cabeçalho, métricas e tabelas uniformes. */
#page-content:has(#goal-sellers-table) > .page-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px 20px;
  margin-bottom:20px;
}
#page-content:has(#goal-sellers-table) > .page-header > div {
  flex:1 1 520px;
  min-width:0;
}
#page-content:has(#goal-sellers-table) > .page-header .page-title {
  margin:0;
  line-height:1.35;
}
#page-content:has(#goal-sellers-table) > .page-header .page-subtitle {
  margin:5px 0 0;
  line-height:1.5;
}
#page-content:has(#goal-sellers-table) > .page-header > button {
  min-height:42px;
  margin-left:auto;
  white-space:normal;
}
#page-content:has(#goal-sellers-table) > .metrics-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  align-items:stretch;
  gap:16px;
  margin-bottom:18px !important;
}
#page-content:has(#goal-sellers-table) .metric-card {
  box-sizing:border-box;
  height:100%;
  min-height:142px;
  min-width:0;
  padding:20px 22px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:8px;
  border:1px solid #c4d3e8;
  border-radius:8px;
  background:#fff;
}
#page-content:has(#goal-sellers-table) .metric-card > div {min-width:0}
#page-content:has(#goal-sellers-table) .metric-value {
  margin-bottom:8px;
  line-height:1.15;
  font-size:clamp(23px,2vw,32px);
  font-weight:800;
  overflow-wrap:anywhere;
}
#page-content:has(#goal-sellers-table) .metric-label {
  font-size:13px;
  line-height:1.45;
}
#page-content:has(#goal-sellers-table) .metric-sub {
  margin-top:7px;
  font-size:12px;
  line-height:1.45;
}
#page-content:has(#goal-sellers-table) > .card {
  overflow:hidden;
  border:1px solid #c4d3e8;
  border-radius:8px;
  background:#fff;
  box-shadow:0 1px 3px rgba(12,42,86,.06);
}
#page-content:has(#goal-sellers-table) > .card > .card-header {
  box-sizing:border-box;
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:13px 18px;
  min-height:58px;
  background:#f7faff;
  border-bottom:1px solid #cddbee;
  color:#173b66;
  font-size:16px;
  line-height:1.4;
}
#page-content:has(#goal-sellers-table) > .card > .card-header > button {
  min-height:36px;
  padding:7px 13px;
  margin-left:auto;
  white-space:normal;
}
#page-content:has(#goal-sellers-table) > .card > .data-table-container {
  overflow-x:auto;
  overflow-y:visible;
  border:0;
  border-radius:0;
}
#page-content:has(#goal-sellers-table) > .card .data-table {
  width:100%;
  min-width:720px;
  border-collapse:collapse;
}
#page-content:has(#goal-sellers-table) > .card .data-table th {
  padding:13px 16px;
  background:#f4f8fd;
  color:#325273;
  font-size:12px;
  font-weight:700;
  line-height:1.4;
  border-bottom:1px solid #d3dfef;
}
#page-content:has(#goal-sellers-table) > .card .data-table td {
  padding:13px 16px;
  font-size:13px;
  line-height:1.5;
  vertical-align:middle;
  border-bottom:1px solid #edf2f8;
}
#page-content:has(#goal-sellers-table) > .card .data-table tbody tr:last-child td {border-bottom:0}

/* Janela de Nova/Alterar Meta: campos na mesma altura e botões alinhados. */
form:has(#goal-code) > .form-grid {
  display:grid;
  gap:13px 15px;
  align-items:end;
  min-width:0;
  box-sizing:border-box;
  margin-bottom:16px;
  padding:16px;
  background:#f1f6fd;
  border:1px solid #b6c9e5;
  border-radius:8px;
}
form:has(#goal-code) > .form-grid > .form-group {
  min-width:0;
  gap:7px;
}
form:has(#goal-code) .form-group label {
  display:block;
  margin:0;
  color:#193d6d;
  font-size:12px;
  font-weight:700;
  line-height:1.4;
}
form:has(#goal-code) .form-control {
  box-sizing:border-box;
  width:100%;
  min-width:0;
  max-width:100%;
  min-height:42px;
  height:42px;
  font-size:14px;
  padding:9px 12px;
  border:1px solid #b4c8e3;
  border-radius:6px;
}
form:has(#goal-code) > h4 {
  margin:14px 0 12px;
  padding:0 0 9px;
  border-bottom:1px solid #d3deed;
  color:#173b66;
  font-size:14px;
}
form:has(#goal-code) > div:has(> button[type="submit"]) {
  display:flex;
  justify-content:flex-end !important;
  align-items:center;
  flex-wrap:wrap;
  gap:10px !important;
  margin:16px 0 0;
  padding:14px 0 0;
  border-top:1px solid #d1deee;
}
form:has(#goal-code) > div:has(> button[type="submit"]) .btn {min-height:40px}

@media (max-width:950px) {
  #page-content:has(#goal-sellers-table) > .metrics-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:650px) {
  #page-content:has(#loyalty-name) > .card {padding:16px 13px !important}
  #page-content:has(#loyalty-name) > .card > div[style*="display:grid"] {
    grid-template-columns:minmax(0,1fr) !important;
  }
  #page-content:has(#loyalty-name) > .card > button[onclick="submitSaveLoyaltyRules()"] {
    width:100%;
    margin-left:0;
  }
  #page-content:has(#goal-sellers-table) > .metrics-grid {
    grid-template-columns:minmax(0,1fr);
    gap:12px;
  }
  #page-content:has(#goal-sellers-table) .metric-card {min-height:120px;padding:17px}
  #page-content:has(#goal-sellers-table) > .page-header > button {margin-left:0;width:100%}
  #page-content:has(#goal-sellers-table) > .card > .card-header {padding:12px}
  form:has(#goal-code) > .form-grid {padding:12px;gap:12px}
  form:has(#goal-code) > .form-grid > .form-group {
    grid-column:1/-1;
  }
  form:has(#goal-code) > div:has(> button[type="submit"]) .btn {flex:1 1 125px}
}
