*, *::before, *::after { box-sizing: border-box; }
body { font-family: system-ui, Arial, sans-serif; color: #374151; margin: 0; }
.secao-bloco textarea, .secao-bloco input { max-width: 100%; }
.topbar { background: #051020; color: #fff; padding: 12px 20px;
  display: flex; justify-content: center; align-items: center; }
.topbar a { color: #fff; margin-left: 16px; text-decoration: none; }
main { max-width: 820px; margin: 24px auto; padding: 0 16px; }
h1 { color: #051020; } h2 { color: #1a3a5c; font-size: 18px; }
.day { border-bottom: 1px solid #eee; padding-bottom: 8px; margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 6px 10px; text-align: left; font-size: 14px; }
th { background: #f5f8ff; }
.note { color: #888; font-size: 13px; }

/* Cabeçalho de página com botão de sync */
.page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.sync-bar { display: flex; align-items: center; gap: 10px; }
.sync-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: #e5e7eb; color: #111827; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 13px; font-weight: 700; cursor: pointer; }
.sync-btn:hover { background: #d1d5db; }
.sync-icon { font-size: 15px; line-height: 1; }
.htmx-indicator { display: none; color: #6b7280; font-size: 13px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* Lista de boletins (Histórico) */
.boletim-list { list-style: none; padding: 0; margin: 16px 0; }
.boletim-list li { margin: 0 0 8px; }
.boletim-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  text-decoration: none; color: #374151; transition: border-color .15s, box-shadow .15s; }
.boletim-row:hover { border-color: #c9a84c; box-shadow: 0 2px 8px rgba(5,16,32,.06); }
.boletim-date { font-weight: 700; color: #051020; font-size: 16px; min-width: 104px; }
.boletim-metrics { display: flex; gap: 14px; color: #6b7280; font-size: 14px; }
.boletim-metrics .metric-err { color: #b45309; }
.boletim-metrics .boletim-brevo { display: inline-flex; gap: 12px; }
.boletim-metrics .metric-muted { color: #9ca3af; }
.boletim-arrow { margin-left: auto; color: #c9a84c; font-size: 18px; }

/* Badge de status do envio */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: capitalize; line-height: 1.4; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-pending { background: #dbeafe; color: #1e40af; }
.badge-cancel { background: #e5e7eb; color: #4b5563; }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

/* Detalhe do boletim */
.back-link { color: #1a3a5c; text-decoration: none; font-size: 14px; }
.info-cards { display: flex; flex-wrap: nowrap; gap: 10px; margin: 16px 0 28px;
  overflow-x: auto; }
.info-card { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; background: #f5f8ff; border: 1px solid #d0dff0;
  border-radius: 8px; min-width: 92px; }
.info-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; }
.info-value { font-size: 18px; font-weight: 700; color: #051020; }
.email-frame { width: 100%; height: 900px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #f0f2f5; }
.recipient-summary { display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 12px 0 16px; font-size: 14px; color: #374151; }
.hoje-status { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.hoje-actions { display: flex; gap: 12px; margin: 16px 0 24px; }
.btn-approve { padding: 10px 20px; background: #166534; color: #fff; border: none;
  border-radius: 6px; font-weight: 700; cursor: pointer; }
.btn-cancel { padding: 10px 20px; background: #991b1b; color: #fff; border: none;
  border-radius: 6px; font-weight: 700; cursor: pointer; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px;
  padding: 12px; color: #991b1b; white-space: pre-wrap; }
.edit-label { display: block; margin: 12px 0; font-weight: 700; color: #051020; }
.subject-input { display: block; width: 100%; padding: 8px; margin-top: 4px;
  border: 1px solid #d1d5db; border-radius: 6px; font-size: 15px; }
body.edit-page { background: #cdd5e0; }
body.edit-page main { max-width: 1280px; }
.edit-layout { display: flex; gap: 24px; align-items: flex-start; }
.edit-form { flex: 1 1 0; min-width: 0; }
.edit-preview { flex: 1 1 0; min-width: 0; position: sticky; top: 16px; }
.edit-preview .preview-frame { width: 100%; height: 82vh; background: #fff; }
@media (max-width: 980px) {
  .edit-layout { flex-direction: column; }
  .edit-preview { position: static; width: 100%; }
}
.secao-bloco { border: 1px solid #d7dde6; border-radius: 8px; padding: 14px; margin: 12px 0;
  background: #ffffff; box-shadow: 0 1px 3px rgba(5,16,32,.05); }
.secao-titulo { width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid #d1d5db;
  border-radius: 6px; font-weight: 700; }
.secao-html { width: 100%; padding: 8px; font-family: monospace; font-size: 13px;
  border: 1px solid #d1d5db; border-radius: 6px; }
.secao-controls { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.btn-mover { padding: 6px 12px; background: #e5e7eb; color: #111827; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; line-height: 1; }
.btn-mover:hover { background: #d1d5db; }
.btn-remove-secao { padding: 6px 12px; background: #fee2e2; color: #991b1b;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-add-secao { margin: 8px 0; padding: 8px 14px; background: #e5e7eb; color: #111827;
  border: none; border-radius: 6px; cursor: pointer; font-weight: 700; }
.edit-actions { display: flex; gap: 12px; align-items: center; margin: 20px 0; }
.btn-edit { padding: 10px 20px; background: #1a3a5c; color: #fff; text-decoration: none;
  border-radius: 6px; font-weight: 700; }
.btn-cancel-link { color: #6b7280; text-decoration: none; }
.secao-imagem { margin: 10px 0; }
.img-atual { display: block; max-width: 240px; height: auto; border-radius: 6px; margin-bottom: 6px; }
.img-url-input { width: 100%; padding: 6px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.img-busca { display: flex; gap: 8px; margin-top: 6px; }
.busca-input { flex: 1; padding: 6px; border: 1px solid #d1d5db; border-radius: 6px; }
.btn-buscar-img { padding: 6px 12px; background: #e5e7eb; color: #111827; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; }
.candidatas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cand { padding: 0; border: 2px solid transparent; background: none; cursor: pointer; border-radius: 6px; }
.cand:hover { border-color: #c9a84c; }
.cand img { width: 120px; height: 80px; object-fit: cover; display: block; border-radius: 4px; }
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; gap: 12px; width: 280px;
  padding: 28px; border: 1px solid #d0dff0; border-radius: 8px; }
.login-box input, .login-box button { padding: 10px; font-size: 15px; }
.login-box button { background: #051020; color: #c9a84c; border: none; cursor: pointer; }
.error { color: #b91c1c; font-size: 14px; margin: 0; }

/* ---- Emails (/clientes) ---- */
.add-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.add-form input { padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.add-form button { padding: 8px 16px; background: #051020; color: #c9a84c; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; }
.lista-toolbar { display: flex; gap: 8px; align-items: center; margin: 6px 0 14px; }
.filtro { flex: 1; max-width: 360px; padding: 8px;
  border: 1px solid #d1d5db; border-radius: 6px; }
.btn-novos { padding: 8px 16px; background: #e5e7eb; color: #111827; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; }
.btn-novos.ativo { background: #1d4ed8; color: #fff; }
.form-error { color: #b91c1c; font-size: 13px; margin-left: 4px; }
.clientes-tabela { width: 100%; border-collapse: collapse; table-layout: fixed; }
.clientes-tabela th { text-align: left; font-size: 13px; color: #6b7280; padding: 8px;
  border-bottom: 2px solid #e5e7eb; }
.clientes-tabela td { padding: 8px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
/* larguras fixas por coluna → input width:100% preenche a celula com qualquer nº de linhas */
.clientes-tabela th:nth-child(1), .clientes-tabela td:nth-child(1) { width: 24%; }
.clientes-tabela th:nth-child(2), .clientes-tabela td:nth-child(2) { width: 38%; }
.clientes-tabela th:nth-child(3), .clientes-tabela td:nth-child(3) { width: 10%; }
.clientes-tabela th:nth-child(4), .clientes-tabela td:nth-child(4) { width: 28%; }
.cliente-nome, .cliente-email { overflow-wrap: anywhere; }
.cliente-row--inativo { opacity: .55; }
.cliente-acoes { white-space: nowrap; }
.cliente-acoes button { padding: 5px 10px; margin-left: 4px; background: #e5e7eb; color: #111827;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.cliente-acoes .btn-danger { background: #fee2e2; color: #991b1b; }
.cliente-edit-input { width: 100%; padding: 5px 8px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 14px; }
.badge-novo { background: #1d4ed8; color: #fff; font-size: 11px; font-weight: 700;
  text-transform: uppercase; padding: 1px 6px; border-radius: 10px; margin-left: 6px; }
.btn-suspender { padding: 8px 16px; background: #fee2e2; color: #991b1b; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; }
.btn-retomar { padding: 8px 16px; background: #1d4ed8; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-weight: 700; }
