/* ---------------------------------------------------------------------------
   Campanhas promocionais por email (painel super-admin)
   Reaproveita as classes base (card, field, input, btn) do style.css.
--------------------------------------------------------------------------- */

.campaign-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  align-items: start;
}
/* Impede que conteúdo largo (ex.: nome longo de modelo sem quebra) estique
   a coluna e desconfigure o layout — deixa as colunas encolherem. */
.campaign-grid > * { min-width: 0; }
@media (max-width: 900px) {
  .campaign-grid { grid-template-columns: 1fr; }
}

/* Seletor de público (todos / assinantes / não assinantes) */
.audience-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.audience-opt {
  flex: 1;
  min-width: 130px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 14px;
}
.audience-opt:hover { border-color: #c7d2fe; }
.audience-opt input { accent-color: #4f7cff; }
.audience-opt:has(input:checked) {
  border-color: #4f7cff;
  background: #eff3ff;
}
.audience-opt .aud-count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f7cff;
  font-size: 12px;
  text-align: center;
}
.audience-opt:has(input:checked) .aud-count { background: #4f7cff; color: #fff; }

/* Prévia do email dentro do painel */
.campaign-preview {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 14px;
  max-height: 560px;
  overflow: auto;
}
.cp-card {
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.cp-head {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
}
.cp-head img { max-height: 40px; max-width: 160px; vertical-align: middle; }
.cp-body { padding: 20px; }
.cp-greeting { margin: 0 0 12px; color: #374151; font-size: 15px; }
.cp-title { margin: 0 0 14px; font-size: 21px; line-height: 1.3; color: #111827; }
.cp-img { width: 100%; border-radius: 10px; display: block; margin: 0 0 16px; }
.cp-text { margin: 0 0 18px; font-size: 15px; line-height: 1.6; color: #374151; white-space: pre-wrap; word-break: break-word; }
.cp-btn-wrap { text-align: center; margin: 0 0 20px; }
.cp-btn {
  display: inline-block;
  background: #4f7cff;
  color: #fff;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 9px;
  font-weight: bold;
  font-size: 15px;
}
.cp-foot {
  padding: 14px 20px;
  background: #f9fafb;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

/* Histórico de campanhas enviadas */
.cp-hist-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cp-hist-item:last-child { border-bottom: none; }
.cp-hist-item .cp-hist-subj { font-weight: 600; color: var(--text); }
.cp-hist-meta { margin-top: 3px; color: var(--muted); }
.cp-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.cp-badge.sent { background: #dcfce7; color: #166534; }
.cp-badge.partial { background: #fef9c3; color: #854d0e; }
.cp-badge.sending { background: #dbeafe; color: #1e40af; }
.cp-badge.failed { background: #fee2e2; color: #991b1b; }

/* Modelos de campanha salvos */
.cp-tpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  transition: border-color .15s, background .15s;
}
.cp-tpl-item:last-child { margin-bottom: 0; }
.cp-tpl-item:hover { border-color: var(--brand); }
.cp-tpl-item.active { border-color: var(--brand); background: rgba(79, 124, 255, .12); }
.cp-tpl-info { flex: 1; min-width: 0; cursor: pointer; }
.cp-tpl-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-tpl-meta { margin-top: 2px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-tpl-actions { display: flex; gap: 6px; flex-shrink: 0; }
