.rp-ap-wrap {
  --rp-ap-text: #111827;
  --rp-ap-muted: #6b7280;
  --rp-ap-border: #e5e7eb;
  --rp-ap-soft: #f8fafc;
  --rp-ap-shadow: 0 10px 28px rgba(17, 24, 39, 0.05);
  --rp-ap-primary: #4b1d75;
  --rp-ap-danger: #991b1b;
  --rp-ap-success: #166534;
  --rp-ap-warning: #b45309;
  max-width: 1160px;
  width: 92%;
  margin: 0 auto 28px;
  color: var(--rp-ap-text);
  font-size: 15px;
}

.rp-ap-wrap * {
  box-sizing: border-box;
}

.rp-ap-wrap a {
  box-shadow: none;
}

.rp-ap-header {
  margin: 0 0 16px;
  padding: 20px 22px;
  border: 1px solid var(--rp-ap-border);
  border-radius: 26px;
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
  box-shadow: var(--rp-ap-shadow);
}

.rp-ap-header-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.rp-ap-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rp-ap-central-badge-only {
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #d1fae5;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rp-ap-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rp-ap-muted);
  font-weight: 800;
}

.rp-ap-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  font-weight: 800;
}

.rp-ap-message {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
  color: #334155;
  max-width: 72ch;
}

.rp-ap-ampliacion {
  margin: 0;
  color: var(--rp-ap-muted);
  line-height: 1.55;
  max-width: 76ch;
  font-size: 14px;
}

.rp-ap-central {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--rp-ap-border);
  font-size: 13px;
  font-weight: 700;
}

.rp-ap-central-badge,
.rp-ap-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Themes */
.rp-ap-theme-active .rp-ap-central-badge,
.rp-ap-theme-active .rp-ap-card-badge {
  background: #dcfce7;
  color: #166534;
}

.rp-ap-theme-neutral .rp-ap-central-badge,
.rp-ap-theme-neutral .rp-ap-card-badge {
  background: #e0f2fe;
  color: #075985;
}

.rp-ap-theme-warning .rp-ap-central-badge,
.rp-ap-theme-warning .rp-ap-card-badge {
  background: #fff7ed;
  color: #b45309;
}

.rp-ap-theme-danger .rp-ap-central-badge,
.rp-ap-theme-danger .rp-ap-card-badge {
  background: #fef2f2;
  color: #991b1b;
}

.rp-ap-theme-muted .rp-ap-central-badge,
.rp-ap-theme-muted .rp-ap-card-badge {
  background: #f3f4f6;
  color: #374151;
}

/* Menu */
.rp-ap-menu {
  position: relative;
  flex: 0 0 auto;
}

.rp-ap-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid var(--rp-ap-border);
  background: #fff;
  color: var(--rp-ap-text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.rp-ap-menu-btn:hover {
  background: #f3eefb;
  border-color: var(--rp-ap-primary);
  transform: translateY(-1px);
}

.rp-ap-menu-pop {
  position: absolute;
  right: 0;
  top: 46px;
  min-width: 200px;
  padding: 8px;
  border: 1px solid var(--rp-ap-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.1);
  display: none;
  z-index: 40;
}

.rp-ap-menu.is-open .rp-ap-menu-pop {
  display: block;
}

.rp-ap-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rp-ap-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #fff;
  color: #111827;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}

.rp-ap-menu-item:hover {
  background: #f3f4f6;
  border-color: var(--rp-ap-border);
  color: var(--rp-ap-primary);
}

.rp-ap-menu-item.is-discreet {
  font-size: 12px;
  color: #6b7280;
}

.rp-ap-menu-item.is-danger {
  color: var(--rp-ap-primary);
  opacity: 0.7;
}

/* Forzar colores propios del menú para evitar herencia de Elementor global */
.rp-ap-menu-pop,
.rp-ap-menu-item,
.rp-ap-menu-item:focus {
  background: #fff !important;
  color: #111827 !important;
  border-color: #e5e7eb !important;
  font-weight: 400 !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
}
.rp-ap-menu-item:hover {
  font-weight: 600 !important;
}

/* Para los items discretos y de peligro también mantenemos look legible */
.rp-ap-menu-item.is-discreet,
.rp-ap-menu-item.is-danger {
  background: #fff !important;
  color: #111827 !important;
  font-weight: 400 !important;
}

/* Feedback */
.rp-ap-feedback {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.rp-ap-feedback.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.rp-baja-feedback {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(60, 90, 160, 0.22);
  background: rgba(60, 90, 160, 0.06);
  color: rgb(45, 70, 130);
  font-size: 14px;
  line-height: 1.45;
}

.rp-baja-contexto {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 14px;
  margin: 0 0 20px;
  background: #fafafa;
}

.rp-baja-contexto-meta {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.rp-baja-contexto-note {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
}

/* Detail panel */
.rp-ap-detail {
  border: 1px solid var(--rp-ap-border);
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: var(--rp-ap-shadow);
  margin: 0 0 16px;
  position: sticky;
  top: 8px;
  z-index: 10;
  overflow: hidden;
  scroll-margin-top: 24px;
  transition:
    padding 0.22s ease,
    border-radius 0.22s ease;
}

.rp-ap-detail--groups {
  position: static;
  top: auto;
}

/* Panel colapsado: se reduce a una línea al hacer scroll */
.rp-ap-detail.is-collapsed {
  padding: 10px 18px;
  border-radius: 14px;
}

.rp-ap-detail.is-collapsed .rp-ap-detail-text,
.rp-ap-detail.is-collapsed .rp-ap-detail-list,
.rp-ap-detail.is-collapsed .rp-ap-actions {
  display: none;
}

.rp-ap-detail.is-collapsed .rp-ap-detail-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--rp-ap-muted);
  display: inline;
}

.rp-ap-detail.is-collapsed .rp-ap-detail-label {
  display: inline;
  margin: 0;
  margin-right: 6px;
}

.rp-ap-detail-collapsed-hint {
  display: none;
  font-size: 12px;
  color: var(--rp-ap-muted);
  margin-left: 8px;
}

.rp-ap-detail.is-collapsed .rp-ap-detail-collapsed-hint {
  display: inline;
}

.rp-ap-detail-label {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rp-ap-muted);
  font-weight: 800;
}

.rp-ap-detail-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.15;
}

.rp-ap-detail-text {
  margin: 0 0 12px;
  color: #475569;
  line-height: 1.6;
  max-width: 78ch;
  font-size: 14px;
}

.rp-ap-detail-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: #334155;
  line-height: 1.6;
  font-size: 14px;
}

.rp-ap-detail-list li {
  margin: 0 0 6px;
  white-space: pre-line;
}

/* Actions */
.rp-ap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rp-ap-contact-panel {
  margin: 0;
}

.rp-ap-contact-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--rp-ap-primary);
  border-radius: 12px;
  background: #fff;
  color: var(--rp-ap-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  list-style: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.rp-ap-contact-toggle::marker {
  content: "";
}

.rp-ap-contact-toggle::-webkit-details-marker {
  display: none;
}

.rp-ap-contact-toggle:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.rp-ap-contact-detail {
  margin-top: 0;
}

.rp-ap-contact-panel[open] .rp-ap-contact-toggle {
  margin-bottom: 12px;
}

.rp-ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--rp-ap-border);
  background: #fff;
  color: #111827;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.rp-ap-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.rp-ap-btn-primary {
  border-color: var(--rp-ap-primary);
  color: var(--rp-ap-primary);
}

.rp-ap-btn-danger {
  border-color: var(--rp-ap-danger);
  color: var(--rp-ap-danger);
}

.rp-ap-btn-secondary-row {
  flex-basis: 100%;
  margin-top: 4px;
  justify-content: flex-start;
}

.rp-ap-btn-discreet-danger {
  color: #7f1d1d;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.82;
}

.rp-ap-btn-discreet-danger:hover {
  color: var(--rp-ap-danger);
  background: transparent;
  transform: none;
  opacity: 1;
}

.rp-ap-btn-link {
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
  text-decoration: underline;
  background: transparent;
}

/* Zona de acciones discretas (baja voluntaria al pie del dashboard) */
.rp-ap-discreet {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 8px 0 0;
}

.rp-ap-discreet .rp-ap-btn {
  font-size: 12px;
  padding: 8px 10px;
}

/* Timeline */
.rp-ap-line {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--rp-ap-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
}

.rp-ap-line-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-ap-line-step {
  padding: 9px 11px;
  border-radius: 14px;
  background: var(--rp-ap-soft);
  border: 1px solid transparent;
  font-size: 12px;
  line-height: 1.35;
  color: #475569;
}

.rp-ap-line-step strong {
  display: block;
  font-size: 12px;
  color: #0f172a;
  margin-bottom: 2px;
}

.rp-ap-line-step.is-current {
  border-color: #cbd5e1;
  background: #fff;
}

.rp-ap-line-step.is-done {
  background: #f8fafc;
}

.rp-ap-line-step.is-pending {
  opacity: 0.9;
}

/* Generic cards */
.rp-ap-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.rp-ap-card {
  border: 1px solid var(--rp-ap-border);
  background: #fff;
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.04);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  outline: none;
  position: relative;
  min-height: 138px;
}

.rp-ap-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}

.rp-ap-card.is-active {
  border-color: #cbd5e1;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.1);
}

.rp-ap-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.2;
}

.rp-ap-card p {
  margin: 0;
  color: #475569;
  line-height: 1.5;
  font-size: 13px;
}

/* Dashboard layout */
.rp-ap-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 14px;
  margin: 0 0 16px;
}

.rp-ap-card.card-documentacion {
  min-height: 138px;
}

/* Groups */
.rp-ap-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rp-ap-group {
  border: 1px solid var(--rp-ap-border);
  border-radius: 18px;
  padding: 15px;
  background: #fff;
}

.rp-ap-group h4 {
  margin: 0 0 8px;
  font-size: 17px;
}

.rp-ap-group p {
  margin: 0 0 8px;
  color: #475569;
  line-height: 1.5;
  font-size: 14px;
}

/* Fields */
.rp-ap-field {
  margin: 0 0 12px;
}

.rp-ap-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.rp-ap-field input,
.rp-ap-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

.rp-ap-field textarea {
  min-height: 130px;
  resize: vertical;
}

.rp-ap-field input:focus,
.rp-ap-field textarea:focus,
.rp-ap-menu-btn:focus,
.rp-ap-menu-item:focus,
.rp-ap-btn:focus,
.rp-ap-card:focus {
  outline: 2px solid rgba(75, 29, 117, 0.18);
  outline-offset: 2px;
}

.rp-ap-mini {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.rp-ap-section-space {
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1100px) {
  .rp-ap-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .rp-ap-header-top {
    flex-direction: column;
  }

  .rp-ap-menu {
    align-self: flex-end;
  }

  .rp-ap-dashboard-grid,
  .rp-ap-group-grid,
  .rp-ap-line-list {
    grid-template-columns: 1fr;
  }

  .rp-ap-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rp-ap-detail {
    position: static;
  }
}

@media (max-width: 640px) {
  .rp-ap-cards,
  .rp-ap-group-grid,
  .rp-ap-line-list {
    grid-template-columns: 1fr;
  }

  .rp-ap-card {
    min-height: auto;
  }

  .rp-ap-wrap {
    width: 94%;
  }

  .rp-ap-header {
    padding: 18px 16px;
  }

  .rp-ap-detail {
    padding: 16px;
  }
}
