/* === Newsletter Engine · Admin UI === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0ece4;
  color: #222;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "SF Mono", Consolas, Menlo, monospace; font-size: 0.92em; background: #f5f3ed; padding: 1px 5px; border-radius: 3px; }

/* === Top bar === */
.topbar {
  background: var(--color-primary);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--color-accent);
  position: sticky; top: 0; z-index: 100;
}
.topbar-brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name { font-size: 20px; font-weight: 900; font-family: Georgia, serif; letter-spacing: 0.04em; }
.brand-sub { font-size: 11px; color: var(--color-accent); letter-spacing: 0.12em; text-transform: uppercase; }
.topbar-nav { display: flex; gap: 18px; align-items: center; }
.topbar-nav a { color: #fff; font-weight: 600; font-size: 13px; }

/* === Layout === */
.main { padding: 28px; max-width: 1280px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; color: var(--color-primary); }
.subtitle { color: #777; font-size: 13px; margin-top: 4px; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 5px; border: none;
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  text-decoration: none; transition: opacity 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-gold     { background: var(--color-accent); color: var(--color-primary); }
.btn-green    { background: #1a6b3c; color: #fff; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-danger   { background: #c0392b; color: #fff; }
.btn-outline  { background: transparent; border: 1px solid currentColor; color: var(--color-primary); }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; }
.btn-icon {
  width: 28px; height: 28px; padding: 0;
  border-radius: 4px; border: 1px solid #ddd;
  background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: #888;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.btn-icon:hover { background: #faf8f4; }
.btn-star { color: #aaa; }
.btn-star.active { color: var(--color-accent); border-color: var(--color-accent); background: #fff8e8; }
.btn-del { color: #c0392b; }
.btn-del:hover { background: #fdf0ee; border-color: #c0392b; }
.btn-del.restore { color: #1a6b3c; }
.btn-del.restore:hover { background: #eef7f2; border-color: #1a6b3c; }

/* === Flash messages === */
.flash-stack { padding: 12px 24px 0; }
.flash { padding: 10px 16px; border-radius: 5px; margin-bottom: 8px; font-size: 13px; }
.flash-error { background: #fdecea; color: #a01717; border: 1px solid #f5c6cb; }
.flash-info  { background: #e8f4fd; color: #0c5482; border: 1px solid #bee5f4; }

/* === Login === */
.login-card {
  max-width: 380px; margin: 80px auto;
  background: #fff; border-radius: 8px; padding: 36px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .brand-name { font-size: 28px; color: var(--color-primary); display: block; }
.login-brand .brand-sub { color: #999; }
.login-card h1 { font-size: 18px; color: var(--color-primary); margin-bottom: 20px; text-align: center; font-weight: 600; }
.login-form label { display: block; margin-bottom: 14px; }
.login-form label span { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.login-form input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 5px; font-family: inherit;
  transition: border-color 0.15s;
}
.login-form input:focus { outline: none; border-color: var(--color-primary); }

/* === Dashboard === */
.dashboard .empty-state {
  text-align: center; padding: 60px; background: #fff;
  border-radius: 8px; border: 2px dashed #ddd; color: #888;
}
.newsletter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.newsletter-card {
  background: #fff; border-radius: 8px; padding: 16px;
  display: flex; gap: 14px; align-items: center;
  border: 1px solid #e5dfd0; transition: box-shadow 0.15s, transform 0.05s;
}
.newsletter-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.card-date {
  background: var(--color-primary); color: #fff;
  border-radius: 6px; padding: 10px 14px; text-align: center;
  min-width: 70px;
}
.card-day { font-size: 22px; font-weight: 800; line-height: 1; }
.card-month { font-size: 10px; color: var(--color-accent); margin-top: 4px; letter-spacing: 0.06em; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.card-status { display: flex; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 6px; }

/* === Badges === */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-sent     { background: #cce5ff; color: #004085; }
.badge-whatsapp { background: #d4f4dd; color: #1a6b3c; }

/* === Review screen === */
.review-layout {
  display: flex; height: calc(100vh - 56px);
  margin: -28px; /* break out of .main padding */
}
.main:has(.review-layout) { padding: 0; max-width: 100%; }
.review-sidebar {
  width: 380px; min-width: 320px; background: #fff;
  border-right: 1px solid #ddd;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header { padding: 14px 16px; background: #f8f6f0; border-bottom: 1px solid #ddd; flex-shrink: 0; }
.sidebar-header h2 { font-size: 13px; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.sidebar-stats { font-size: 11px; color: #888; margin-bottom: 10px; }
.sidebar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sidebar-body { overflow-y: auto; flex: 1; }
.sidebar-footer { padding: 10px 16px; background: #f8f6f0; border-top: 1px solid #ddd; }
.review-preview { flex: 1; overflow: hidden; background: #ddd; }
.review-preview iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* === Section groups === */
.sec-group { border-bottom: 1px solid #eee; }
.sec-label {
  padding: 8px 16px; background: #f0ece4;
  font-size: 11px; font-weight: 700; color: var(--color-primary);
  text-transform: uppercase; letter-spacing: 0.08em;
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between;
}
.sec-count { color: #888; font-weight: 400; }

/* === Item rows === */
.item-row {
  padding: 9px 14px; border-bottom: 1px dashed #eee;
  display: flex; align-items: flex-start; gap: 8px;
  transition: background 0.1s;
}
.item-row:hover { background: #faf8f4; }
.item-row.deleted { opacity: 0.4; background: #fff5f5; }
.item-info { flex: 1; min-width: 0; }
.item-title-small {
  font-size: 12px; font-weight: 600; color: #1a5276;
  line-height: 1.4; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-meta-small { font-size: 10px; color: #888; }
.item-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.rel { padding: 0 4px; border-radius: 2px; font-weight: 600; }
.rel-alta { background: #fde8e8; color: #c0392b; }
.rel-media { background: #fff3cd; color: #8a6500; }
.rel-contexto { background: #e8eef4; color: #4a6480; }

/* === Modal === */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; border-radius: 8px; padding: 28px;
  width: 480px; max-width: 92vw;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal h3 { font-size: 16px; color: var(--color-primary); margin-bottom: 16px; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 12px; }
.modal input, .modal textarea, .modal select {
  width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 13px; margin-top: 4px; font-family: inherit;
}
.modal textarea { height: 80px; resize: vertical; }
.modal .hint { font-size: 11px; color: #888; margin-top: -4px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* === Toast === */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 6px;
  background: #1a6b3c; color: #fff; font-weight: 600; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #c0392b; }

/* === Config page === */
.config-page { max-width: 880px; }
.config-section {
  background: #fff; border-radius: 8px; padding: 20px 24px;
  margin-bottom: 16px; border: 1px solid #e5dfd0;
}
.config-section h2 { font-size: 14px; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.config-section h3 { font-size: 12px; color: #888; margin: 14px 0 6px; }
.config-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.config-table th, .config-table td { padding: 6px 10px; border-bottom: 1px solid #eee; text-align: left; }
.config-table th { background: #f8f6f0; font-weight: 600; color: #555; font-size: 11px; text-transform: uppercase; }
.config-list { list-style: none; padding: 0; }
.config-list li { padding: 4px 0; border-bottom: 1px dashed #eee; font-size: 13px; }
.config-list li:last-child { border: none; }
.config-list.muted li { color: #999; }
.config-dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; font-size: 13px; }
.config-dl dt { font-weight: 600; color: #555; }
.muted { color: #888; }
