:root {
  --bg:           #f4f6f9;
  --bg-panel:     #ffffff;
  --bg-hover:     #f0f2f5;
  --border:       #e1e4e8;
  --text:         #1a1f2e;
  --text-muted:   #6b7280;
  --accent:       #2563eb;
  --accent-dim:   rgba(37,99,235,.1);
  --accent-hover: #1d4ed8;
  --green:        #16a34a;
  --red:          #dc2626;
  --blue:         #2563eb;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --radius:       10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size: .95rem; }

/* ── LOGIN ── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#eff6ff 0%,#f4f6f9 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 44px 36px; box-shadow: var(--shadow-md); }
.login-brand { text-align: center; margin-bottom: 32px; }
.brand-icon-wrap { width: 64px; height: 64px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.brand-icon-wrap img { width: 100%; height: 100%; border-radius: 14px; display: block; }
.login-brand h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.login-brand p  { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }

/* ── TOPBAR ── */
.topbar { height: 58px; background: var(--bg-panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.topbar-brand-icon { width: 36px; height: 36px; border-radius: 10px; display: block; flex-shrink: 0; }
.topbar-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.topbar-user  { font-size: .82rem; color: var(--text-muted); }
.role-badge   { font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--accent-dim); color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }

/* ── LAYOUT ── */
.app-layout { display: flex; height: calc(100vh - 58px); }
.sidebar { width: 220px; flex-shrink: 0; background: var(--bg-panel); border-right: 1px solid var(--border); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.main-content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── SIDEBAR ── */
.snav-btn { width: 100%; background: none; border: none; color: var(--text-muted); font-size: .88rem; font-weight: 500; padding: 9px 12px; border-radius: 8px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background .15s, color .15s; position: relative; }
.snav-btn:hover  { background: var(--bg-hover); color: var(--text); }
.snav-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.snav-ico { font-size: 1rem; display: flex; align-items: center; }
.snav-ico svg { stroke: currentColor; }
.snav-compose { background: var(--accent); color: #fff !important; font-weight: 700; justify-content: center; border-radius: 8px; }
.snav-compose:hover { background: var(--accent-hover); }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 4px; }

/* ── BADGE ── */
.badge-count { background: var(--red); color: #fff; font-size: .65rem; font-weight: 700; border-radius: 10px; padding: 1px 6px; min-width: 16px; text-align: center; margin-left: auto; }

/* ── SECCIONES ── */
.sec { display: none; }
.sec.active { display: block; }
.sec-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sec-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--text); }

/* ── LISTA MENSAJES ── */
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.msg-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.msg-card.unread { border-left: 3px solid var(--accent); }
.msg-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 5px; }
.msg-card-title { font-weight: 700; font-size: .95rem; color: var(--text); }
.msg-card.unread .msg-card-title::before { content: '● '; color: var(--accent); font-size: .65rem; vertical-align: middle; }
.msg-card-date { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.msg-card-meta { font-size: .78rem; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.msg-card-preview { font-size: .83rem; color: var(--text-muted); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audience-tag { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: .72rem; }
.msg-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ── MODALES ── */
.modal-content { background: var(--bg-panel); border: 1px solid var(--border); color: var(--text); border-radius: 14px; }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.msg-meta { font-size: .8rem; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.msg-body-content { line-height: 1.8; color: var(--text); }
.msg-body-content img   { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.msg-body-content video { max-width: 100%; border-radius: 6px; margin: 8px 0; }

/* ── QUILL ── */
.ql-toolbar   { background: #f8fafc; border: 1px solid var(--border) !important; border-radius: var(--radius) var(--radius) 0 0; }
.ql-container { background: #fff; border: 1px solid var(--border) !important; border-top: none !important; border-radius: 0 0 var(--radius) var(--radius); }
.ql-editor { min-height: 240px; font-size: .95rem; color: #111; }

/* ── RECIPIENT PICKER ── */
.recipient-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel); }
.recipient-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); transition: background .1s; cursor: pointer; }
.recipient-item:last-child { border-bottom: none; }
.recipient-item:hover { background: var(--bg-hover); }
.recipient-item label { margin: 0; cursor: pointer; flex: 1; font-size: .88rem; }
.recipient-item small { color: var(--text-muted); font-size: .75rem; }

/* ── BOTONES ── */
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; border: none; border-radius: 8px; padding: 9px 20px; cursor: pointer; font-size: .88rem; transition: background .15s; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.w-100 { width: 100%; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: .82rem; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-ghost.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-secondary-action { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 18px; cursor: pointer; font-size: .88rem; }
.btn-secondary-action:hover { border-color: var(--text-muted); }
.btn-danger-sm { background: none; border: 1px solid #fca5a5; color: var(--red); border-radius: 5px; padding: 3px 8px; cursor: pointer; font-size: .75rem; }
.btn-danger-sm:hover { background: var(--red); color: #fff; }

/* ── FORM ── */
.form-control, .form-select { background: #fff; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: .9rem; width: 100%; }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-label { color: var(--text-muted); font-size: .82rem; margin-bottom: 5px; display: block; }
.form-label.fw-semibold { font-weight: 600; color: var(--text); }

/* ── ESTADOS ── */
.loading-state { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: .9rem; }
.empty-state { text-align: center; color: var(--text-muted); padding: 60px 20px; }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ── BADGES ── */
.sched-badge { background: #dbeafe; color: #1d4ed8; font-size: .72rem; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.draft-badge  { background: var(--bg-hover); color: var(--text-muted); font-size: .72rem; padding: 2px 7px; border-radius: 4px; }

/* ── UTILIDADES ── */
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mb-3 { margin-bottom: 12px; }
.d-none { display: none !important; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: .85rem; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── SELECTOR PLANTILLA ── */
.pf-template-selector {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.pf-tpl-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px; font-size: .83rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.pf-tpl-btn:hover { border-color: var(--accent); color: var(--accent); }
.pf-tpl-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pf-tpl-btn svg { stroke: currentColor; }

/* ── POPUP EDITOR ── */
.popup-editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.popup-editor-form { display: flex; flex-direction: column; gap: 16px; }
.popup-form-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.popup-form-section-title {
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.pf-group { display: flex; flex-direction: column; gap: 5px; }
.pf-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.pf-input, .pf-textarea {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 7px 10px; font-size: .85rem; width: 100%; outline: none;
  font-family: inherit;
}
.pf-input:focus, .pf-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.pf-textarea { resize: vertical; min-height: 64px; }
.pf-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-swatch {
  width: 28px; height: 28px; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.pf-swatch:hover { transform: scale(1.12); }
.pf-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--text); }
.pf-features-area { display: flex; flex-direction: column; gap: 6px; }
.pf-feature-row { display: flex; gap: 6px; align-items: center; }
.pf-feature-row .pf-input { flex: 1; }
.pf-btn-remove {
  background: #fee2e2; border: none; color: var(--red);
  width: 28px; height: 28px; border-radius: 6px;
  cursor: pointer; font-size: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.pf-btn-remove:hover { background: var(--red); color: #fff; }
.pf-btn-add {
  background: none; border: 1px dashed var(--border); color: var(--text-muted);
  border-radius: 8px; padding: 7px; font-size: .8rem;
  cursor: pointer; transition: border-color .15s, color .15s; width: 100%;
}
.pf-btn-add:hover { border-color: var(--accent); color: var(--accent); }
.pf-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pf-text-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; gap: 8px;
}
.pf-size-control { display: flex; align-items: center; gap: 8px; }
.pf-size-label { font-size: .72rem; color: var(--text-muted); }
.pf-size-btns { display: flex; align-items: center; gap: 4px; }
.pf-size-btn {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px;
  padding: 3px 8px; font-size: .78rem; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.pf-size-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pf-size-val { font-size: .72rem; color: var(--text-muted); min-width: 28px; text-align: center; }
.pf-bold-btn {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  width: 30px; height: 28px; cursor: pointer;
  font-size: .85rem; display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.pf-bold-btn:hover { border-color: var(--accent); color: var(--accent); }
.pf-bold-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── PREVIEW FRAME ── */
.popup-editor-preview { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 10px; }
.pf-preview-label { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; }
.pf-preview-frame {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.pf-mock-bg {
  background: #111827; display: flex; flex-direction: column;
  height: 480px; position: relative;
}
.pf-mock-topbar {
  height: 36px; background: #1f2937; border-bottom: 1px solid #374151;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; flex-shrink: 0;
}
.pf-mock-logo { font-size: .72rem; font-weight: 700; color: #fff; }
.pf-mock-logo span { color: #2563eb; }
.pf-mock-dots { display: flex; gap: 4px; }
.pf-mock-dots span { width: 6px; height: 6px; border-radius: 50%; background: #374151; }
.pf-mock-map {
  flex: 1;
  background: repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(255,255,255,.015) 24px, rgba(255,255,255,.015) 25px),
              repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(255,255,255,.015) 24px, rgba(255,255,255,.015) 25px),
              #1a2332;
}
.pf-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(1px);
}
.pf-popup {
  background: #fff; border-radius: 14px; width: 88%; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.3);
  animation: pfPopIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pfPopIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pf-popup-header {
  background: #4f46e5; padding: 16px 16px 12px; position: relative;
}
.pf-icon-badge-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pf-popup-icon {
  width: 34px; height: 34px; background: rgba(255,255,255,.15);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pf-badge {
  display: inline-block; background: rgba(255,255,255,.2); color: #fff;
  font-size: 8px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  letter-spacing: 1px;
}
.pf-popup-title { color: #fff; font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.pf-popup-desc  { color: rgba(255,255,255,.78); font-size: 10px; line-height: 1.5; }
.pf-popup-body  { padding: 10px 14px 4px; }
.pf-feature-list { list-style: none; }
.pf-feature-list li {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 5px 0; border-bottom: 1px solid #f0f0f0;
  font-size: 10px; color: #1a1a1a; line-height: 1.4;
}
.pf-feature-list li:last-child { border-bottom: none; }
.pf-check {
  width: 14px; height: 14px; min-width: 14px; border-radius: 50%;
  background: #eef2ff; display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.pf-popup-footer { display: flex; gap: 6px; padding: 4px 14px 12px; }
.pf-btn-primary {
  flex: 1; background: #4f46e5; color: #fff; border: none;
  padding: 7px 0; border-radius: 7px; font-size: 10px; font-weight: 600; cursor: pointer;
}
.pf-btn-secondary {
  flex: 1; background: #f5f5f5; color: #666;
  border: 1px solid #e0e0e0; padding: 7px 0;
  border-radius: 7px; font-size: 10px; cursor: pointer;
}
.pf-popup-note { text-align: center; font-size: 9px; color: #bbb; padding: 0 14px 10px; }

/* ── PREVIEW PAGO ── */
.pp-header { background: #b45309; }
.pp-dias-badge {
  display: inline-block; background: #fef3c7; color: #92400e;
  font-size: 8px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; margin-bottom: 7px;
}
.pp-invoice-box {
  background: #f9f9f9; border: 1px solid #eee;
  border-radius: 8px; padding: 6px 8px; margin-bottom: 6px;
}
.pp-invoice-row {
  display: flex; justify-content: space-between;
  font-size: 9px; padding: 4px 0;
  border-bottom: 1px solid #f0f0f0; color: #666;
}
.pp-invoice-row:last-child { border-bottom: none; }
.pp-invoice-row span:last-child { color: #1a1a1a; font-weight: 600; }
.pp-total {
  display: flex; justify-content: space-between;
  font-size: 10px; font-weight: 600;
  padding: 6px 8px; background: #fef3c7;
  border-radius: 7px; margin-bottom: 6px; color: #92400e;
}
.pp-metodos-label { font-size: 8px; color: #999; margin-bottom: 5px; }
.pp-metodos { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.pp-metodo {
  background: #f5f5f5; border: 1px solid #e0e0e0;
  border-radius: 5px; padding: 2px 6px; font-size: 8px; color: #555;
}
.pp-btn-primary { background: #b45309; }
.pm-btn-primary-init { background: #0f766e; }

/* ── PREVIEW MANTENIMIENTO ── */
.pm-header { background: #0f766e; }
.pm-time-box {
  background: #f0fdfa; border: 1px solid #99f6e4;
  border-radius: 8px; padding: 8px 10px;
  margin-bottom: 7px; display: flex; align-items: center; gap: 8px;
}
.pm-time-icon {
  width: 28px; height: 28px; min-width: 28px;
  background: #ccfbf1; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.pm-time-date { font-size: 9px; color: #0f766e; font-weight: 600; margin-bottom: 1px; }
.pm-time-hora { font-size: 8px; color: #0d9488; }
.pm-affects-label { font-size: 8px; color: #999; font-weight: 600; margin-bottom: 5px; }
.pm-affect-list { list-style: none; margin-bottom: 7px; }
.pm-affect-list li {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0; border-bottom: 1px solid #f0f0f0;
  font-size: 9px; color: #555;
}
.pm-affect-list li:last-child { border-bottom: none; }
.pm-dot { width: 6px; height: 6px; min-width: 6px; border-radius: 50%; }
.pm-info-note {
  background: #f0fdfa; border-left: 3px solid #0f766e;
  border-radius: 0 6px 6px 0; padding: 6px 8px;
  font-size: 8px; color: #0f766e; line-height: 1.5;
}
.pm-btn-primary { background: #0f766e; }

/* ── PREVIEW DESCUENTOS ── */
.pd-header { background: linear-gradient(135deg,#7c3aed,#db2777); text-align: center; }
.pd-circle {
  width: 56px; height: 56px;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 6px auto 8px;
}
.pd-pct { font-size: 16px; font-weight: 700; color: #fff; line-height: 1; }
.pd-off { font-size: 7px; color: rgba(255,255,255,.8); letter-spacing: 1px; }
.pd-countdown-box {
  background: #fdf4ff; border: 1px solid #e9d5ff;
  border-radius: 8px; padding: 7px 10px;
  margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between;
}
.pd-countdown-label { font-size: 8px; color: #7c3aed; font-weight: 600; }
.pd-timer { display: flex; gap: 3px; align-items: center; }
.pd-time-block {
  background: #7c3aed; color: #fff;
  border-radius: 4px; padding: 2px 5px;
  font-size: 9px; font-weight: 600; min-width: 22px; text-align: center;
}
.pd-sep { color: #7c3aed; font-size: 10px; font-weight: 700; }
.pd-check { background: #fdf4ff !important; }
.pd-code-box {
  background: #fdf4ff; border: 1.5px dashed #c084fc;
  border-radius: 8px; padding: 7px 10px;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
}
.pd-code-label { font-size: 7px; color: #7c3aed; margin-bottom: 2px; }
.pd-code-text { font-size: 13px; font-weight: 700; color: #6d28d9; letter-spacing: 2px; }
.pd-copy-btn {
  background: #7c3aed; color: #fff; border: none;
  padding: 4px 8px; border-radius: 5px; font-size: 8px; cursor: pointer;
}
.pd-btn-primary { background: #7c3aed; }

/* ── PREVIEW BIENVENIDA ── */
.pb-header { background: linear-gradient(135deg,#1d4ed8,#0891b2); text-align: center; }
.pb-avatar {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
}
.pb-steps-label { font-size: 7px; color: #999; font-weight: 700; letter-spacing: .8px; margin-bottom: 6px; }
.pb-step {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 5px 0; border-bottom: 1px solid #f0f0f0;
}
.pb-step-last { border-bottom: none; }
.pb-step-num {
  width: 18px; height: 18px; min-width: 18px;
  border-radius: 50%; background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: #1d4ed8;
}
.pb-step-body { flex: 1; }
.pb-step-title { font-size: 9px; font-weight: 600; color: #1a1a1a; margin-bottom: 1px; }
.pb-step-desc  { font-size: 8px; color: #666; line-height: 1.4; }
.pb-support-box {
  margin-top: 7px; background: #eff6ff; border-radius: 7px;
  padding: 7px 9px; display: flex; align-items: center; gap: 7px;
}
.pb-support-icon {
  width: 24px; height: 24px; min-width: 24px;
  background: #bfdbfe; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.pb-support-title { font-size: 8px; font-weight: 600; color: #1d4ed8; margin-bottom: 1px; }
.pb-support-text  { font-size: 7px; color: #3b82f6; }
.pb-btn-primary { background: #1d4ed8; }

/* ── PREVIEW PERSONALIZADO ── */
.pc-body { padding: 10px 14px 6px; }
.pc-rich-content {
  font-size: 9px; line-height: 1.5; color: #1a1a1a;
  max-height: 160px; overflow-y: auto;
  padding: 0 !important;
}
.pc-rich-content img { max-width: 100%; border-radius: 4px; margin: 4px 0; }
.pc-rich-content p { margin-bottom: 4px; }
.pc-rich-content ul, .pc-rich-content ol { padding-left: 14px; margin-bottom: 4px; }

/* selector degradado */
.pd-grad-swatch {
  width: 28px; height: 28px; border-radius: 8px;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.pd-grad-swatch:hover { transform: scale(1.12); }
.pd-grad-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--text); }

/* ── Recurrencia mensual ── */
.pf-recurrence-toggle { display:flex; align-items:center; gap:10px; cursor:pointer; user-select:none; }
.pf-recurrence-toggle input[type=checkbox] { width:16px; height:16px; accent-color:var(--accent); cursor:pointer; }
.pf-recurrence-body { display:none; margin-top:12px; }
.pf-recurrence-body.open { display:block; }
.pf-day-grid { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.pf-day-chip { display:flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:8px; border:1px solid var(--border); font-size:.78rem; font-weight:600; cursor:pointer; transition:all .15s; background:var(--bg); color:var(--text-muted); user-select:none; }
.pf-day-chip:hover { border-color:var(--accent); color:var(--accent); }
.pf-day-chip.selected { background:var(--accent); color:#fff; border-color:var(--accent); }
.pf-day-chip.urgent { background:#dc2626; color:#fff; border-color:#dc2626; }
.pf-day-chip.urgent.selected { background:#dc2626; color:#fff; }
.pf-recurrence-legend { display:flex; gap:14px; font-size:.72rem; color:var(--text-muted); margin-top:8px; flex-wrap:wrap; }
.pf-recurrence-legend span { display:flex; align-items:center; gap:4px; }
.pf-recurrence-legend i { width:12px; height:12px; border-radius:3px; display:inline-block; }
.pf-rule-list { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.pf-rule-item { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:10px 12px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.pf-rule-item.inactive { opacity:.5; }
.pf-rule-name { font-size:.82rem; font-weight:600; color:var(--text); }
.pf-rule-meta { font-size:.72rem; color:var(--text-muted); margin-top:2px; }
.pf-rule-actions { display:flex; gap:6px; flex-shrink:0; }
.pf-rule-toggle { font-size:.72rem; padding:3px 9px; border-radius:6px; border:1px solid var(--border); background:none; cursor:pointer; }
.pf-rule-toggle.on  { border-color:#16a34a; color:#16a34a; }
.pf-rule-toggle.off { border-color:var(--text-muted); color:var(--text-muted); }
.pf-rule-delete { font-size:.72rem; padding:3px 9px; border-radius:6px; border:1px solid #fee2e2; background:none; color:#dc2626; cursor:pointer; }

/* ── Ver ejemplo ── */
.pf-example-btn {
  font-size: .72rem; color: var(--text-muted); background: none;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; transition: all .15s;
  align-self: flex-end;
}
.pf-example-btn:hover { background: var(--bg-hover); color: var(--text); }
.pf-ex-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pf-ex-row:last-child { border-bottom: none; }
.pf-ex-label { font-size: .75rem; font-weight: 700; color: var(--text-muted); min-width: 120px; flex-shrink: 0; padding-top: 1px; }
.pf-ex-val { font-size: .82rem; color: var(--text); line-height: 1.5; }
.pf-ex-list { margin: 0; padding-left: 16px; font-size: .82rem; color: var(--text); line-height: 1.7; }
.pf-send-card { margin-top: 16px; }

/* ── Estadísticas ── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: .78rem; color: var(--text-muted); }
.stats-list { display: flex; flex-direction: column; gap: 1px; }
.msg-stat-row { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.msg-stat-main { flex: 1; min-width: 0; }
.msg-stat-title { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-stat-meta { font-size: .74rem; color: var(--text-muted); margin-top: 2px; }
.msg-stat-bar-wrap { width: 180px; flex-shrink: 0; }
.msg-stat-rate-label { font-size: .74rem; color: var(--text-muted); margin-bottom: 4px; text-align: right; }
.msg-stat-bar-bg { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.msg-stat-bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ── Historial ── */
.hist-selector { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.hist-content { display: flex; flex-direction: column; gap: 6px; }
.hist-section-title { font-size: .78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 6px; }
.hist-item { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
.hist-item-left { flex-shrink: 0; opacity: .8; }
.hist-item-body { flex: 1; min-width: 0; }
.hist-item-title { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item-meta { font-size: .74rem; color: var(--text-muted); margin-top: 2px; }
.hist-tag { font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.hist-tag-open { background: #dcfce7; color: #16a34a; }
.hist-tag-pending { background: #fef3c7; color: #b45309; }
.hist-tag-cancel { background: #f3f4f6; color: #6b7280; }
.hist-urgent { font-size: .68rem; font-weight: 700; background: #fee2e2; color: #dc2626; padding: 1px 7px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }

/* ── Flujo de cobro guiado ── */
.fl-wizard-card { background: linear-gradient(135deg,#eff6ff,#f0fdf4); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.fl-wizard-header { font-size: .8rem; font-weight: 700; color: #1e40af; display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.fl-wizard-steps { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.fl-step { display: flex; align-items: center; gap: 10px; }
.fl-step-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; flex-shrink: 0; background: #fff; }
.fl-step-text { font-size: .8rem; color: var(--text); }
.fl-urgent-tag { font-size: .68rem; background: #fee2e2; color: #dc2626; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.fl-wizard-btn { background: #1e40af; color: #fff; border: none; border-radius: 7px; padding: 7px 14px; font-size: .78rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background .15s; }
.fl-wizard-btn:hover { background: #1d3a9e; }

@media (max-width: 900px) {
  .popup-editor-layout { grid-template-columns: 1fr; }
  .popup-editor-preview { position: static; }
}

@media (max-width: 640px) {
  .sidebar { width: 52px; }
  .snav-btn span:not(.snav-ico):not(.badge-count) { display: none; }
  .snav-compose { padding: 8px; justify-content: center; }
  .main-content { padding: 14px; }
}

/* ── Destinatarios (superadmin) ─────────────────────────────────────────────── */
.dest-add-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.dest-add-panel .form-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: .4px; }
.dest-add-panel textarea { width: 100%; font-family: inherit; font-size: .88rem; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; resize: vertical; }
.dest-add-panel textarea:focus { outline: none; border-color: var(--accent); }
.dest-msg { margin-top: 8px; font-size: .82rem; padding: 8px 10px; border-radius: 6px; }
.dest-msg.ok { background: #d1fae5; color: #047857; }
.dest-msg.error { background: #fee2e2; color: #b91c1c; }
.dest-list { display: flex; flex-direction: column; gap: 6px; }
.dest-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.dest-info { min-width: 0; flex: 1; }
.dest-name { font-size: .92rem; font-weight: 600; color: var(--text); }
.dest-sub { font-size: .76rem; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.dest-status { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; }
.dest-status.pending { background: #fef3c7; color: #b45309; }
.dest-status.active  { background: #d1fae5; color: #047857; }
.dest-empty { padding: 24px; text-align: center; color: var(--text-muted); background: var(--bg-panel); border: 1px dashed var(--border); border-radius: 10px; }

/* Destinatarios toolbar + roles */
.dest-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.dest-toolbar .btn-primary { display: inline-flex; align-items: center; gap: 6px; }
.dest-role { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; margin-right: 4px; }
.dest-role.gerente { background: #dbeafe; color: #1d4ed8; }
.dest-role.usuario { background: #f3f4f6; color: #374151; }
