/* ═══════════════════════════════════════════════════════════════
   components.css — Reusable UI Components
   Bird City Network — Seguimiento y Control
   NO duplica clases de Bootstrap (.btn, .card, .alert)
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   BOOTSTRAP OVERRIDES — Align with Brand Colors (Green palette)
   ═══════════════════════════════════════════════════════════════ */

/* Primary → Forest Green */
.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}
.btn-outline-primary {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Success → Light Green */
.btn-success {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary-light);
}
.btn-success:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Info → Brand Blue */
.btn-info {
  background-color: var(--color-info);
  border-color: var(--color-info);
  color: #fff;
}

/* Outline Secondary → Brand muted */
.btn-outline-secondary {
  color: var(--color-muted);
  border-color: var(--color-border);
}
.btn-outline-secondary:hover {
  background-color: var(--color-primary-lightest);
  border-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* Badges */
.badge.bg-primary {
  background-color: var(--color-primary) !important;
}
.badge.bg-info {
  background-color: var(--color-info) !important;
}

/* Nav tabs → Brand styling */
.nav-tabs .nav-link {
  color: var(--color-muted);
  border-color: var(--color-border);
}
.nav-tabs .nav-link.active {
  color: var(--color-primary-dark);
  border-color: var(--color-primary-light) var(--color-primary-light) #fff;
  background-color: #fff;
  font-weight: var(--font-weight-semibold);
}
.nav-tabs .nav-link:hover:not(.active) {
  border-color: var(--color-primary-lighter);
  color: var(--color-primary);
}

/* Nav pills → Brand styling */
.nav-pills .nav-link {
  color: var(--color-muted);
}
.nav-pills .nav-link.active {
  background-color: var(--color-primary);
  color: #fff;
}

/* Form controls → Brand focus */
.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.15);
}

/* Card headers → Subtle brand tint */
.card-header.bg-white {
  border-bottom: 2px solid var(--color-primary-lightest);
}

/* ── Programs Page Enhancements ── */
.sc-toggle-children,
.sc-toggle-levels,
.sc-toggle-ind,
.sc-toggle-indd,
.sc-toggle-ver,
.sc-toggle-calls {
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.sc-toggle-children:hover,
.sc-toggle-levels:hover,
.sc-toggle-ind:hover,
.sc-toggle-indd:hover,
.sc-toggle-ver:hover,
.sc-toggle-calls:hover {
  background-color: var(--color-primary-lightest);
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

/* Action buttons in cards */
.sc-mm-edit, .sc-mm-delete,
.sc-lvl-edit, .sc-lvl-delete,
.sc-cr-edit, .sc-cr-delete,
.sc-ind-edit, .sc-ind-delete,
.sc-req-edit, .sc-req-delete,
.sc-rub-edit, .sc-rub-delete,
.sc-ver-edit, .sc-ver-delete,
.sc-cy-edit, .sc-cy-delete,
.sc-call-edit, .sc-call-delete,
.sc-edit-program, .sc-delete-program {
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* ── Language Selector ── */
.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-body);
  transition: all var(--transition-fast);
  min-height: 44px;
}

.lang-selector:hover,
.lang-selector:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary-lightest);
}

.lang-selector i { font-size: 1.2rem; }

/* ── Hero Section ── */
.hero-section {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Imagen de fondo con velo verde degradado encima (legibilidad + marca).
     Fallback: si la imagen no existe, el background-color + capa rgba
     mantienen el verde sólido original. Reemplazable por foto: assets/img/hero.jpg */
  background-color: var(--color-primary);
  background-image:
    linear-gradient(135deg, rgba(27,67,50,0.86) 0%, rgba(45,106,79,0.78) 50%, rgba(82,183,136,0.66) 100%),
    url('../img/hero.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  padding: var(--space-10) var(--space-4);
  overflow: hidden;
}

/* En móvil el texto envuelve más: velo un poco más denso para contraste */
@media (max-width: 575.98px) {
  .hero-section {
    background-image:
      linear-gradient(135deg, rgba(27,67,50,0.92) 0%, rgba(45,106,79,0.87) 50%, rgba(82,183,136,0.78) 100%),
      url('../img/hero.svg');
  }
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
  opacity: 0.5;
}

.hero-section .hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-max-width);
}

.hero-section h1 {
  color: #fff;
  font-size: var(--font-size-5xl);
  margin-bottom: var(--space-5);
  font-weight: var(--font-weight-extrabold);
}

.hero-section p {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-6);
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  gap: var(--space-8);
  justify-content: center;
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-accent);
}

.hero-stat-label {
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

/* ── Section Title ── */
.section-title {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-title h2 {
  color: var(--color-primary-dark);
}

.section-title p {
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* ── Info Card ── */
.info-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  height: 100%;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.info-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--color-primary-lightest);
  color: var(--color-primary);
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
}

.info-card h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

.info-card p {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
  margin-bottom: 0;
}

/* ── Stat Badge ── */
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.stat-badge-success { background: var(--color-success-bg); color: var(--color-success); }
.stat-badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.stat-badge-info { background: var(--color-info-bg); color: var(--color-info); }

/* ── Map Container (Leaflet) ── */
.map-container {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.map-legend {
  background: var(--color-surface);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: var(--font-size-sm);
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.map-legend-color {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 400px;
}

.sc-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-primary);
  animation: slideInRight var(--transition-base) ease;
}

.sc-toast-success { border-left-color: var(--color-success); }
.sc-toast-error { border-left-color: var(--color-danger); }
.sc-toast-warning { border-left-color: var(--color-warning); }
.sc-toast-info { border-left-color: var(--color-info); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--color-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  color: var(--color-border);
}

.empty-state h4 {
  margin-bottom: var(--space-2);
}

/* ── Table Enhancements ── */
.sc-table {
  width: 100%;
  border-collapse: collapse;
}

.sc-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary-lightest);
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sc-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  overflow-wrap: anywhere; /* la tabla respeta su width:100% aunque haya emails/urls largos */
}

.sc-table tbody tr:hover {
  background: var(--color-primary-lightest);
  transition: background var(--transition-fast);
}

/* ── Pagination ── */
.sc-pagination {
  display: flex;
  gap: var(--space-1);
  justify-content: center;
  margin-top: var(--space-4);
}

.sc-pagination button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--color-body);
  transition: all var(--transition-fast);
}

.sc-pagination button:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary-lightest);
}

.sc-pagination button.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.sc-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Form Enhancements ── */
.form-label-required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-error {
  display: none;
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

.form-error.visible {
  display: block;
}

/* Ayuda de campo (requisitos visibles — Nielsen H5: prevención de errores) */
.form-hint {
  color: var(--color-text-muted, #6c757d);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

/* Toggle mostrar/ocultar contraseña: mínimo táctil 44px en móvil */
.sc-pwd-toggle {
  min-width: 44px;
}

/* Caja "solo desarrollo" del flujo de recuperación (enlace dev sin SMTP) */
.sc-dev-box {
  font-size: var(--font-size-sm);
}

/* ── Login: pestañas de método (Contraseña / Código / Passkey) ── */
.sc-login-tabs {
  display: flex;
  gap: var(--space-2);
  background: var(--color-bg-subtle, #f1f3f5);
  border-radius: 0.75rem;
  padding: 0.25rem;
  margin-bottom: var(--space-4);
}

.sc-login-tabs .nav-item {
  flex: 1 1 0;
  min-width: 0;
}

.sc-login-tabs .nav-link {
  width: 100%;
  min-height: 44px;           /* táctil: objetivo ≥44px */
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted, #6c757d);
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-login-tabs .nav-link.active {
  background: var(--bs-body-bg, #fff);
  color: var(--bs-primary);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

@media (max-width: 400px) {
  .sc-login-tabs .nav-link i { display: none; }  /* en móvil muy estrecho: solo texto */
}

/* Entrada de código OTP: dígitos grandes espaciados */
.sc-otp-input {
  font-size: 1.5rem;
  letter-spacing: 0.6em;
  font-variant-numeric: tabular-nums;
}

/* QR del enrolamiento TOTP */
.sc-totp-qr {
  background: #fff;
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 0.75rem;
  padding: var(--space-2);
  width: fit-content;
}

.sc-totp-qr svg {
  display: block;
  width: 160px;
  height: 160px;
}

.sc-totp-key {
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  word-break: break-all;
  background: var(--color-bg-subtle, #f1f3f5);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
}

.form-control.is-invalid {
  border-color: var(--color-danger);
}

.form-control.is-valid {
  border-color: var(--color-success);
}

/* ── Editor Quill (portal-admin) ──
   Quill convierte el contenedor dado en .ql-container con height:100%
   (CSS propio) — dentro de un padre de altura automática el padre no
   crece y el editor PINTA ENCIMA de los controles siguientes (bug real:
   solapamiento de 27px sobre el campo Orden). Receta: wrapper con altura
   explícita + flex; toolbar fuera del flujo del editor. */
.sc-quill {
  display: flex;
  flex-direction: column;
  height: 340px;                /* altura explícita: el layout siempre la respeta */
  background: var(--color-surface);
}

.sc-quill .ql-toolbar { flex: 0 0 auto; }

.sc-quill .ql-container {
  flex: 1 1 auto;
  height: auto !important;     /* anula el height:100% de quill.css */
  min-height: 0;
  overflow: hidden;
}

.sc-quill .ql-editor {
  min-height: 180px;
  font-size: 0.95rem;
}

.sc-quill .ql-editor p,
.sc-quill .ql-editor h2,
.sc-quill .ql-editor h3 { margin-bottom: 0.5rem; }

.sc-quill .ql-editor img { max-width: 100%; height: auto; }

/* Vista de código (HTML fuente) — alternativa al editor visual */
.sc-quill-source {
  height: 340px;                /* misma altura que .sc-quill */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: vertical;
}

@media (max-width: 575.98px) {
  .sc-quill, .sc-quill-source { height: 260px; }
  .sc-editor-switch .btn { min-height: 44px; }   /* táctil */
}

.sc-nw-prog { min-height: 44px; border-radius: 2rem; font-weight: 600; }

/* ── Permisos por rol (roles-admin) ── */
.sc-role-pill {
  min-height: 44px;              /* táctil */
  border-radius: 2rem;
  font-weight: 600;
}

.sc-perm-groups {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;    /* móvil: apilado */
  align-items: start;
}

@media (min-width: 768px) {
  .sc-perm-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* tableta: 2 col */
}

@media (min-width: 1200px) {
  .sc-perm-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } /* desktop: 3 col */
}

.sc-perm-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
  min-width: 0;                  /* grid: sin desbordes */
}

.sc-perm-group summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  background: var(--color-primary-lightest);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  list-style: none;
  user-select: none;
}

.sc-perm-group summary::-webkit-details-marker { display: none; }

.sc-perm-group-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sc-perm-all { width: 1.15rem; height: 1.15rem; flex-shrink: 0; margin: 0; }
.sc-perm-chev { color: var(--color-muted); transition: transform var(--transition-fast); }
.sc-perm-group[open] > summary .sc-perm-chev { transform: rotate(180deg); }

.sc-perm-list { display: block; }

.sc-perm-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  min-height: 44px;              /* táctil + click en toda la fila */
  border-top: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sc-perm-item:hover { background: var(--color-primary-lightest); }
.sc-perm-item.is-on .sc-perm-code { color: var(--color-primary-dark); }

.sc-perm-item input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.sc-perm-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;                  /* permite encoger dentro del flex */
}

.sc-perm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sc-perm-desc {
  font-size: var(--font-size-xs);
  color: var(--color-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Etiqueta de módulo dentro de la sección funcional */
.sc-perm-module {
  flex: 0 1 auto;
  align-self: center;
  font-size: var(--font-size-xs);
  font-weight: 500;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .sc-perm-module { display: none; } /* móvil: la descripción ya identifica */
}

/* Barra de acciones: sticky abajo (zona del pulgar en móvil) */
.sc-perm-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.06);
  padding: 0.6rem 0.9rem;
  margin-top: 0.9rem;
}

@media (max-width: 575.98px) {
  /* H1: la barra de acciones SIEMPRE visible en móvil — sticky-bottom solo
     actúa cerca del final del scroll; fixed la mantiene en la zona del pulgar. */
  .sc-perm-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
  }
  .sc-perm-bar .btn { flex: 1 1 auto; min-height: 46px; }
  .sc-perm-groups { padding-bottom: 84px; } /* no tapar el último grupo */
}

/* ── Certification Level Badge ── */
.cert-level {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.cert-level-1 { background: #E0F2FE; color: #0C4A6E; }
.cert-level-2 { background: var(--color-primary-lightest); color: var(--color-primary-dark); }
.cert-level-3 { background: #FEF3C7; color: #92400E; }
.cert-level-4 { background: #FCE7F3; color: #9D174D; }
.cert-level-5 { background: var(--color-accent); color: var(--color-dark); }

/* ═══════════════════════════════════════════════════════════════
   LANDING PAGE — Componentes de impacto visual
   ═══════════════════════════════════════════════════════════════ */

/* Hero Fullscreen */
.hero-fullscreen {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 40%, #1B4332 100%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(82, 183, 136, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 183, 3, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(0, 119, 182, 0.1) 0%, transparent 60%);
  z-index: 0;
}

.hero-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><g fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"><path d="M30 10 L35 25 L50 25 L38 35 L43 50 L30 40 L17 50 L22 35 L10 25 L25 25 Z"/></g></svg>');
  background-size: 120px 120px;
}

.hero-fullscreen .hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  backdrop-filter: blur(10px);
  animation: fadeInDown 0.8s ease;
}

.hero-badge i { color: var(--color-accent); }

.hero-fullscreen h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: var(--font-weight-extrabold);
  line-height: 1.15;
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.8s ease 0.1s both;
}

.hero-lead {
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  max-width: 600px;
  margin: 0 auto var(--space-5);
  animation: fadeInUp 0.8s ease 0.2s both;
}

/* CTA Buttons */
.btn-cta-primary {
  background: var(--color-accent);
  color: var(--color-dark) !important;
  border: 2px solid var(--color-accent);
  font-weight: var(--font-weight-bold);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  box-shadow: 0 4px 15px rgba(255, 183, 3, 0.4);
}

.btn-cta-primary:hover {
  background: #FFC933;
  border-color: #FFC933;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 183, 3, 0.5);
}

.btn-cta-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
  transition: all var(--transition-base);
}

.btn-cta-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

/* Hero Stats Bar */
.hero-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  animation: fadeInUp 0.8s ease 0.3s both;
}

.hero-stat-item {
  text-align: center;
  position: relative;
}

.hero-stat-number {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-accent);
  line-height: 1;
  display: inline;
}

.hero-stat-suffix {
  display: inline;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-accent);
}

.hero-stat-label {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.7);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-stat-divider {
  width: 1px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
}

/* Scroll indicator */
.hero-scroll-down {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  z-index: 2;
  animation: bounceDown 2s ease infinite;
}

.hero-scroll-down:hover { color: rgba(255, 255, 255, 0.9); }

@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Eyebrow */
.section-eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

/* Feature Cards */
.feature-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  height: 100%;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary-light);
}

.feature-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  font-size: 1.75rem;
  margin-bottom: var(--space-4);
}

.feature-icon-blue { background: #E0F2FE; color: #0077B6; }
.feature-icon-green { background: var(--color-primary-lightest); color: var(--color-primary); }
.feature-icon-yellow { background: #FEF3C7; color: #D97706; }
.feature-icon-orange { background: #FFEDD5; color: #EA580C; }

.feature-card h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

.feature-card p {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
  margin-bottom: 0;
  line-height: var(--line-height-relaxed);
}

/* Impact Section */
.impact-section {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  padding: var(--space-12) 0;
  position: relative;
  overflow: hidden;
}

.impact-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 30%, rgba(255, 183, 3, 0.1) 0%, transparent 50%);
}

.impact-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all var(--transition-base);
}

.impact-stat-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.impact-stat-number {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-accent);
  line-height: 1;
}

.impact-stat-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--font-size-sm);
  margin-top: var(--space-2);
}

/* Process Steps */
.process-step {
  text-align: center;
  padding: var(--space-5);
  position: relative;
}

.process-step-number {
  position: absolute;
  top: 0;
  right: var(--space-4);
  font-size: 5rem;
  font-weight: var(--font-weight-extrabold);
  color: var(--color-primary-lightest);
  line-height: 1;
  z-index: 0;
}

.process-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-size: 2rem;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 20px rgba(45, 106, 79, 0.3);
}

.process-step h3 {
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-2);
}

.process-step p {
  position: relative;
  z-index: 1;
  color: var(--color-muted);
  font-size: var(--font-size-sm);
}

/* Partner Cards */
.partner-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  text-align: center;
  height: 100%;
  transition: all var(--transition-base);
}

.partner-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.partner-card-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--color-primary-lightest);
  color: var(--color-primary);
  font-size: 2rem;
  margin-bottom: var(--space-4);
}

.partner-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  margin-top: var(--space-3);
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--color-primary-lightest) 0%, #B7E4C7 100%);
  padding: var(--space-12) 0;
  text-align: center;
}

.cta-section h2 {
  color: var(--color-primary-dark);
  margin-bottom: var(--space-3);
}

.cta-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-body);
  max-width: 500px;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-stats-bar {
    flex-direction: column;
    gap: var(--space-4);
  }
  .hero-stat-divider {
    width: 60px;
    height: 1px;
  }
  .hero-scroll-down { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   PROGRAMS PAGE — Jerarquía visual + Badges + Wizard + Animations
   ═══════════════════════════════════════════════════════════════ */

/* Hierarchy depth indicators */
.sc-depth-0 { margin-left: 0; }
.sc-depth-1 { margin-left: 1.5rem; border-left: 3px solid var(--color-primary-lighter); padding-left: .75rem; }
.sc-depth-2 { margin-left: 1.5rem; border-left: 3px solid #B7E4C7; padding-left: .75rem; }
.sc-depth-3 { margin-left: 1.5rem; border-left: 3px solid #FEF3C7; padding-left: .75rem; }
.sc-depth-4 { margin-left: 1.5rem; border-left: 3px solid #FCE7F3; padding-left: .75rem; }

/* Status badges */
.sc-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: var(--font-weight-semibold);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sc-status-draft    { background: #F3F4F6; color: #6B7280; }
.sc-status-active   { background: #D1FAE5; color: #065F46; }
.sc-status-inactive { background: #FEE2E2; color: #991B1B; }
.sc-status-pending  { background: #FEF3C7; color: #92400E; }

/* Child count pills */
.sc-count-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; color: var(--color-muted);
  background: var(--color-primary-lightest);
  padding: 2px 8px; border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
}

/* Breadcrumb */
.sc-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--color-muted);
  padding: 6px 0; flex-wrap: wrap;
}
.sc-breadcrumb-item { display: inline-flex; align-items: center; gap: 4px; }
.sc-breadcrumb-sep { color: var(--color-border); font-size: 0.6rem; }

/* Wizard Stepper */
.sc-wizard-stepper {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; position: relative;
}
.sc-wizard-stepper::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 3px; background: var(--color-border); z-index: 0;
}
.sc-wizard-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; z-index: 1; flex: 1;
}
.sc-wizard-step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-surface); border: 3px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--font-weight-bold); font-size: 0.85rem;
  color: var(--color-muted); transition: all 0.3s ease;
}
.sc-wizard-step.active .sc-wizard-step-circle {
  border-color: var(--color-primary); background: var(--color-primary);
  color: #fff; box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15);
}
.sc-wizard-step.completed .sc-wizard-step-circle {
  border-color: var(--color-primary); background: var(--color-primary-light); color: #fff;
}
.sc-wizard-step-label {
  font-size: 0.72rem; font-weight: var(--font-weight-medium);
  color: var(--color-muted); text-align: center;
}
.sc-wizard-step.active .sc-wizard-step-label {
  color: var(--color-primary-dark); font-weight: var(--font-weight-semibold);
}
.sc-wizard-progress-bar {
  height: 6px; background: var(--color-border);
  border-radius: var(--radius-full); overflow: hidden; margin-bottom: 1.5rem;
}
.sc-wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-full); transition: width 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════════
   ADR-014 (F4-B E6) — Componentes SC_UI + patrones responsive
   Mobile-first: <768 móvil · 768–1199 tablet · ≥1200 desktop
   ═══════════════════════════════════════════════════════════════ */

/* ── Badge de tipo de comunidad ── */
.sc-badge-type {
  display: inline-flex; align-items: center;
  font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold);
  padding: 0.15rem 0.55rem; border-radius: var(--radius-full);
  border: 1px solid transparent; text-transform: uppercase;
  letter-spacing: 0.02em; white-space: nowrap;
}
.sc-badge-type[data-type="city"]         { background: #E7F5EE; color: #1B4332; border-color: #B7E4C7; }
.sc-badge-type[data-type="neighborhood"] { background: #FFF6E0; color: #7A5200; border-color: #FFE29A; }
.sc-badge-type[data-type="university"]   { background: #E8F1FF; color: #174A8B; border-color: #BBD8FF; }
.sc-badge-type[data-type="township"]     { background: #F0EFFF; color: #44379E; border-color: #D4CDF7; }
.sc-badge-type[data-type="borough"]      { background: #FDEFF2; color: #9D2449; border-color: #F8D3DC; }
.sc-badge-type[data-type="county"]       { background: #EAF6F6; color: #0F5E5E; border-color: #BFE3E3; }
.sc-badge-type[data-type="vereda"]       { background: #EAF4E2; color: #3F6212; border-color: #CFE3B8; }
.sc-badge-type[data-type="corregimiento"] { background: #EDF1F5; color: #34495E; border-color: #D0DAE3; }
.sc-badge-type[data-type="resguardo"]    { background: #F6E8E0; color: #7E3A1C; border-color: #EBCFC0; }
.sc-badge-type[data-type="manzana"]      { background: #F3EFFD; color: #5B21B6; border-color: #DDD3F8; }
.sc-badge-type[data-type="cuadra"]       { background: #E2F6FB; color: #0E7490; border-color: #B9EAF4; }
.sc-badge-type[data-type="predio"]       { background: #E3F9EC; color: #166534; border-color: #B8ECCB; }

/* ── Badge de tipo de organización aliada (Organizaciones 2.0) ──
   Misma base que sc-badge-type; código del catálogo organization_type. */
.sc-org-type {
  display: inline-flex; align-items: center;
  font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold);
  padding: 0.2rem 0.6rem; border-radius: var(--radius-full);
  border: 1px solid transparent; white-space: nowrap;
}
.sc-org-type[data-type="NGO"]           { background: #D8F3DC; color: #1B4332; border-color: #B7E4C7; }
.sc-org-type[data-type="GOV"]           { background: #DBEAFE; color: #1E40AF; border-color: #BBD8FF; }
.sc-org-type[data-type="PRIVATE"]       { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.sc-org-type[data-type="UNIVERSITY"]    { background: #EDE9FE; color: #5B21B6; border-color: #DDD6FE; }
.sc-org-type[data-type="INTERNATIONAL"] { background: #CCFBF1; color: #115E59; border-color: #99F6E4; }
.sc-org-type[data-type="COMMUNITY"]     { background: #FCE7F3; color: #9D174D; border-color: #FBCFE8; }

/* ── SC_Typeahead ── */
.sc-typeahead .sc-typeahead-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(26, 26, 46, 0.12);
  max-height: 280px; overflow-y: auto; z-index: 1050;
  list-style: none; margin: 0; padding: 4px; display: none;
}
.sc-typeahead .sc-typeahead-list.show { display: block; }
.sc-typeahead-option {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  cursor: pointer; min-height: 44px; /* objetivo táctil */
}
.sc-typeahead-option:hover, .sc-typeahead-option.active {
  background: var(--color-primary-lightest);
}
.sc-typeahead-option .sc-typeahead-label { font-size: var(--font-size-sm); }
.sc-typeahead-empty { padding: 0.75rem; color: var(--color-muted); font-size: var(--font-size-sm); }
/* Resultado con línea de contexto (ruta · región, país) — la etiqueta y el
   badge comparten línea; el detail pasa a la siguiente, tenue. */
.sc-typeahead-option.sc-typeahead-opt-detail { flex-wrap: wrap; }
.sc-typeahead-option .sc-typeahead-detail {
  flex-basis: 100%; font-size: var(--font-size-xs); color: var(--color-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-typeahead.is-loading::after {
  content: ''; position: absolute; right: 10px; top: 50%;
  width: 14px; height: 14px; margin-top: -7px;
  border: 2px solid var(--color-border); border-top-color: var(--color-primary);
  border-radius: 50%; animation: sc-spin 0.7s linear infinite;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ── SC_Tree (jerarquía ciudad → hijas) ── */
.sc-tree { font-size: var(--font-size-sm); }
.sc-tree-node.has-children > .sc-tree-row .sc-tree-caret {
  transition: transform 0.2s ease; display: inline-flex;
}
.sc-tree-node.has-children.expanded > .sc-tree-row .sc-tree-caret { transform: rotate(90deg); }
/* Fix deploy: sin esta regla los hijos cargados nunca se ocultan al colapsar */
.sc-tree-node:not(.expanded) > .sc-tree-children { display: none; }
.sc-tree-caret-spacer { display: inline-block; width: 1em; }
.sc-tree-row {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: none; border: none; text-align: left;
  padding: 0.5rem 0.5rem; border-radius: var(--radius-sm);
  min-height: 44px; cursor: pointer; color: var(--color-body);
}
.sc-tree-row:hover { background: var(--color-bg); }
.sc-tree-row.selected { background: var(--color-primary-lightest); font-weight: var(--font-weight-semibold); }
.sc-tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-tree-children { margin-left: 1.15rem; border-left: 1px dashed var(--color-border); padding-left: 0.35rem; }

/* ── Utilidad flex: permitir que un hijo flex encoja (truncate/ellipsis) ──
   Bootstrap 5 no incluye min-width utilities; sin esto text-truncate dentro
   de d-flex no encoge y el contenido desborda la tarjeta (móvil). */
.min-w-0 { min-width: 0 !important; }

/* ── Quick links (dashboard) — tile icono + etiqueta ──
   Móvil (<576px): apilado vertical para que la etiqueta quepa en col-6. */
.quick-link-body { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.6rem; }
.quick-link-icon {
  flex: 0 0 44px; width: 44px; height: 44px;
  background: rgba(45, 106, 79, 0.10);
}
.quick-link-label {
  flex: 1 1 auto; min-width: 0;
  font-size: 0.9rem; line-height: 1.2;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; box-orient: vertical; overflow: hidden;
}
/* Foco visible del tile completo (WCAG 2.4.7) — la tarjeta "es" el enlace */
.quick-link-a:focus-visible {
  outline: 2px solid var(--color-primary, #2D6A4F);
  outline-offset: 2px;
  border-radius: 0.75rem;
}
.quick-link-a:focus-visible .quick-link-card { box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
@media (max-width: 575.98px) {
  .quick-link-body { flex-direction: column; text-align: center; gap: 0.4rem; padding: 0.7rem 0.4rem; }
  .quick-link-icon { flex: 0 0 40px; width: 40px; height: 40px; }
  .quick-link-label { font-size: 0.8rem; }
}

/* ── SC_Wizard (stepper responsive) ── */
.sc-wizard { display: flex; flex-direction: column; gap: 1rem; }
.sc-wizard-steps { display: flex; gap: 0.25rem; overflow-x: auto; padding-bottom: 2px; }
.sc-wizard-step {
  display: flex; align-items: center; gap: 0.5rem; flex: 1 0 auto;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--color-muted); font-size: var(--font-size-xs);
  border-bottom: 2px solid var(--color-border); white-space: nowrap;
}
.sc-wizard-step .sc-wizard-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-border); color: var(--color-body);
  font-weight: var(--font-weight-bold); font-size: var(--font-size-xs); flex-shrink: 0;
}
.sc-wizard-step.active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }
.sc-wizard-step.active .sc-wizard-dot { background: var(--color-primary); color: #fff; }
.sc-wizard-step.done { color: var(--color-primary); }
.sc-wizard-step.done .sc-wizard-dot { background: var(--color-primary-lightest); color: var(--color-primary-dark); }
.sc-wizard-body { min-height: 120px; }
.sc-wizard-footer {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding-top: 0.75rem; border-top: 1px solid var(--color-border);
}
.sc-wizard-footer .btn { min-height: 44px; min-width: 110px; }
/* Móvil: stepper horizontal compacto y desplazable. Antes era vertical:
   4 pasos apilados ocupaban ~286px del modal y el contenido quedaba exprimido. */
@media (max-width: 767.98px) {
  .sc-wizard { gap: 0.75rem; }
  .sc-wizard-steps { gap: 0.35rem; }
  .sc-wizard-step { flex: 0 0 auto; padding: 0.4rem 0.55rem; }
  .sc-wizard-step .sc-wizard-dot { width: 22px; height: 22px; }
  .sc-wizard-step .sc-wizard-step-title {
    font-size: var(--font-size-xs); max-width: 96px;
    overflow: hidden; text-overflow: ellipsis;
  }
  .sc-wizard-footer { position: sticky; bottom: 0; background: var(--color-surface); z-index: 2; }
}

/* ── SC_BottomSheet ── */
.sc-sheet-overlay {
  position: fixed; inset: 0; background: rgba(26, 26, 46, 0.45);
  /* 1045: sobre el contenido de la página pero DEBAJO de los modales de
     Bootstrap (backdrop 1050 / modal 1055) — un modal abierto desde la ficha
     en bottom sheet (Editar/Desactivar en móvil) nunca queda detrás. */
  z-index: 1045; display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.25s ease;
}
.sc-sheet-overlay.show { opacity: 1; }
/* Sheet abierto cuando YA había un modal Bootstrap: flota sobre el modal
   (1055) — confirm/alert disparados desde dentro de un modal. */
.sc-sheet-overlay.sc-sheet-over-modal { z-index: 2000; }
.sc-sheet {
  background: var(--color-surface); width: 100%; max-width: 520px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  max-height: 85vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.25s ease;
}
.sc-sheet-overlay.show .sc-sheet { transform: translateY(0); }
.sc-sheet-grabber {
  width: 42px; height: 4px; border-radius: var(--radius-full);
  background: var(--color-border); margin: 0.35rem auto 0.75rem;
}
.sc-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sc-sheet-header h5 { margin: 0; }
@media (min-width: 768px) {
  .sc-sheet-overlay { align-items: center; }
  .sc-sheet { border-radius: var(--radius-lg); transform: scale(0.96); }
  .sc-sheet-overlay.show .sc-sheet { transform: scale(1); }
  .sc-sheet-grabber { display: none; }
}

/* ── SC_Skeleton ── */
.sc-skeleton-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.sc-skel {
  height: 14px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-border) 25%, #F1F5F9 50%, var(--color-border) 75%);
  background-size: 200% 100%; animation: sc-shimmer 1.4s ease infinite;
}
.sc-skel-title { height: 20px; width: 45%; }
.sc-skel-short { width: 65%; }
.sc-skel-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem;
}
@keyframes sc-shimmer { to { background-position: -200% 0; } }

/* ── SC_EmptyState ── */
.sc-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 3rem 1.5rem; gap: 0.5rem;
  border: 1px dashed var(--color-border); border-radius: var(--radius-lg);
  color: var(--color-muted);
}
.sc-empty-state i { font-size: 2.75rem; color: var(--color-primary-lighter); }
.sc-empty-state h3 { font-size: var(--font-size-lg); color: var(--color-body); margin: 0; }
.sc-empty-state p { max-width: 420px; margin: 0; font-size: var(--font-size-sm); }

/* ── Tabla responsive → tarjetas (móvil) ──
   Uso: <table class="sc-table-cards"> con <td data-label="Campo"> */
@media (max-width: 767.98px) {
  .sc-table-cards thead { display: none; }
  .sc-table-cards, .sc-table-cards tbody, .sc-table-cards tr, .sc-table-cards td {
    display: block; width: 100%;
  }
  .sc-table-cards tr {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 0.75rem; margin-bottom: 0.75rem;
  }
  .sc-table-cards td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    flex-wrap: wrap; /* contenido largo pasa a la línea siguiente, no desborda */
    border: none; padding: 0.4rem 0; text-align: right; min-height: 32px;
  }
  .sc-table-cards td > * {
    /* min-width:auto por defecto impide encoger/romper textos largos
       (emails, nombres). SIN max-width:100% — el 100% del td completo
       ignora la etiqueta que comparte línea y re-crea el desborde:
       con min-width:0 + flex-shrink el valor se ajusta al espacio libre. */
    min-width: 0; overflow-wrap: anywhere; word-break: break-word;
  }
  /* Celda principal (column): el ancho de los hijos es el eje transversal
     y NO se encoge solo — sí necesitan el tope del 100% del td. */
  .sc-table-cards td.sc-card-main > * { max-width: 100%; }
  .sc-table-cards td::before {
    content: attr(data-label); font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs); color: var(--color-muted);
    text-align: left; text-transform: uppercase; letter-spacing: 0.03em;
    flex-shrink: 0; /* la etiqueta nunca se comprime */
  }
  /* Celda "principal" (bloque de identidad): cabecera de la tarjeta,
     apilada y a la izquierda — el texto largo no compite por ancho con
     la etiqueta y jamás desborda la tarjeta. */
  .sc-table-cards td.sc-card-main {
    flex-direction: column; align-items: flex-start; text-align: left;
    gap: 0.15rem; padding-bottom: 0.6rem; margin-bottom: 0.45rem;
    border-bottom: 1px dashed var(--color-border);
  }
  .sc-table-cards td.sc-card-main::before { display: none; }
  .sc-table-cards td.sc-card-actions { justify-content: flex-end; }
}

/* ── Action bar móvil (fija abajo, zona del pulgar) ── */
.sc-action-bar {
  position: sticky; bottom: 0; left: 0; right: 0;
  display: flex; gap: 0.75rem; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  z-index: 100;
}

/* ── Context bar (contexto de trabajo compartido — Fase 1 UX) ──
   Sticky al inicio del contenido de página (mismo mecanismo que
   .cd-tabs-wrap del 360°: el contenedor de scroll es .app-content,
   así que top:0 queda DEBAJO del header sin solaparse). */
.sc-ctx-bar {
  position: sticky; top: 0; z-index: 1019; /* bajo el header (1020) */
  background: var(--bs-body-bg, #fff);
  padding: 0.5rem 0 0.6rem; margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.sc-ctx-main {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.sc-ctx-program { max-width: 230px; flex-shrink: 1; }
.sc-ctx-country { max-width: 190px; flex-shrink: 1; }

/* ── Nodo ancho del árbol: sub-listado con buscador (hijas > 50) ── */
.sc-tree-wide {
  background: var(--color-primary-lightest, #f8f9fa);
  border: 1px solid var(--color-border);
}
.sc-tree-wide-results { max-height: 320px; overflow-y: auto; }
.sc-tree-wide-results .sc-tree-row { border-radius: var(--radius-sm); }
.sc-tree-wide-results .sc-tree-row.selected {
  background: var(--color-primary-lightest);
}
.sc-ctx-sep { color: var(--color-muted); flex-shrink: 0; }
.sc-ctx-community { position: relative; flex: 1 1 220px; min-width: 180px; }
.sc-ctx-depth { flex-shrink: 0; }
.sc-ctx-chip-btn { justify-content: flex-start; }
@media (max-width: 767.98px) {
  /* El chip móvil es lo único visible; el bottom sheet hace el trabajo. */
  .sc-ctx-chip-btn { min-height: 44px; }
}
.sc-action-bar .btn { flex: 1; min-height: 48px; }

/* ── Ergonomía táctil: targets ≥44px en controles densos ── */
@media (pointer: coarse) {
  .btn-sm, .btn-group-sm > .btn { min-height: 44px; min-width: 44px; }
  .form-control, .form-select { min-height: 44px; }
  .page-link { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
}

/* ── Backdrop del drawer del sidebar (móvil/tablet) ──
   Se sobregira 64px por lado: en navegadores móviles el pan/overscroll o el
   colapso de la barra de URL podían exponer una franja sin atenuar junto al
   menú (reporte: "franja blanca"). Con el margen extra el backdrop cubre
   incluso el área de rebote. */
.app-sidebar-backdrop {
  position: fixed; top: -64px; left: -64px; right: -64px; bottom: -64px;
  background: rgba(26, 26, 46, 0.5);
  z-index: 1035; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.app-sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

/* ── Tablet: densidad intermedia ── */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .app-content { padding: 1rem 1.25rem; }
  .sc-tree-children { margin-left: 0.9rem; }
}


/* Expand/collapse all */
.sc-expand-all-btn {
  font-size: 0.75rem; color: var(--color-primary); cursor: pointer;
  border: 1px solid var(--color-primary-light); border-radius: var(--radius-md);
  padding: 4px 12px; transition: all var(--transition-fast); background: transparent;
}
.sc-expand-all-btn:hover { background: var(--color-primary-lightest); }

/* Modal context subtitle */
.sc-modal-context {
  font-size: 0.8rem; color: var(--color-muted);
  background: var(--color-primary-lightest);
  padding: 6px 12px; border-radius: var(--radius-md); margin-bottom: 1rem;
}

/* Entity type icon colors */
.sc-icon-program    { color: var(--color-primary); }
.sc-icon-model      { color: var(--color-primary-light); }
.sc-icon-criteria   { color: #0891B2; }
.sc-icon-indicator  { color: #D97706; }
.sc-icon-requirement { color: #BE185D; }
.sc-icon-rubric     { color: #7C3AED; }
.sc-icon-cycle      { color: #2563EB; }
.sc-icon-call       { color: #DC2626; }

/* Card header hover */
[data-program-uuid] > .card-header:hover {
  background: var(--color-primary-lightest) !important; cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   MASTER-DETAIL LAYOUT — Programs Page Redesign
   Responsive: Desktop (side-by-side) / Tablet / Mobile (stack)
   ═══════════════════════════════════════════════════════════════ */
.sc-master-detail { display: grid; grid-template-columns: 340px 1fr; gap: var(--space-4); }
/* scrollbar-gutter estable: sin él, al cambiar de pestaña (contenido más alto)
   aparece/desaparece la barra y el ancho re-fluye → las grillas auto-fill
   (checklist, tarjetas) cambiaban de nº de columnas al presionar Aliados. */
.sc-md-master { scrollbar-gutter: stable; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow-y: auto; max-height: calc(100vh - 160px); position: sticky; top: 80px; }
.sc-md-master-header { padding: var(--space-3); border-bottom: 2px solid var(--color-primary-lightest); position: sticky; top: 0; background: var(--color-surface); z-index: 2; }
.sc-md-master-search { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: var(--font-size-sm); }
.sc-md-master-search:focus { border-color: var(--color-primary-light); box-shadow: 0 0 0 0.2rem rgba(45,106,79,0.15); outline: none; }
.sc-md-tree { padding: var(--space-2); }
.sc-md-tree-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); cursor: pointer; font-size: var(--font-size-sm); color: var(--color-body); transition: all var(--transition-fast); min-height: 40px; border: 1px solid transparent; }
.sc-md-tree-item:hover { background: var(--color-primary-lightest); border-color: var(--color-primary-lighter); }
.sc-md-tree-item.active { background: var(--color-primary); color: #fff; font-weight: var(--font-weight-semibold); }
.sc-md-tree-item.active i { color: #fff !important; }
.sc-md-tree-item i { font-size: 1rem; flex-shrink: 0; }
.sc-md-tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sc-md-tree-count { font-size: 0.7rem; background: rgba(0,0,0,0.08); padding: 1px 6px; border-radius: var(--radius-full); font-weight: var(--font-weight-semibold); }
.sc-md-tree-item.active .sc-md-tree-count { background: rgba(255,255,255,0.25); }
.sc-md-tree-children { margin-left: var(--space-4); border-left: 2px solid var(--color-border); padding-left: var(--space-1); }
.sc-md-detail { scrollbar-gutter: stable; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); overflow-y: auto; }
.sc-md-trail { display: flex; align-items: center; gap: var(--space-1); font-size: var(--font-size-sm); color: var(--color-muted); margin-bottom: var(--space-3); flex-wrap: wrap; }
.sc-md-trail-item { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--color-primary-lightest); color: var(--color-primary-dark); font-weight: var(--font-weight-medium); }
.sc-md-trail-sep { color: var(--color-border); font-size: 0.7rem; }
.sc-md-detail-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 2px solid var(--color-primary-lightest); }
.sc-md-detail-title { display: flex; align-items: center; gap: var(--space-2); }
.sc-md-detail-title i { font-size: 1.5rem; }
.sc-md-detail-title h3 { margin: 0; font-size: var(--font-size-lg); }
.sc-entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.sc-entity-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); transition: all var(--transition-fast); cursor: pointer; position: relative; }
.sc-entity-card:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sc-entity-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.sc-entity-card-number { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: var(--font-weight-bold); font-size: var(--font-size-sm); flex-shrink: 0; }
.sc-entity-card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition-fast); }
.sc-entity-card:hover .sc-entity-card-actions { opacity: 1; }
.sc-entity-card-actions button { min-width: 28px; min-height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.sc-entity-card-title { font-weight: var(--font-weight-semibold); font-size: var(--font-size-sm); margin-bottom: 4px; }
.sc-entity-card-desc { font-size: var(--font-size-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-entity-card-meta { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }
.sc-md-back { display: none; align-items: center; gap: var(--space-1); font-size: var(--font-size-sm); color: var(--color-primary); font-weight: var(--font-weight-medium); background: transparent; border: none; cursor: pointer; padding: var(--space-2); margin-bottom: var(--space-2); border-radius: var(--radius-md); }
.sc-md-back:hover { background: var(--color-primary-lightest); }
@media (max-width: 992px) { .sc-master-detail { grid-template-columns: 280px 1fr; } }
@media (max-width: 768px) { .sc-master-detail { grid-template-columns: 1fr; } .sc-md-master { position: static; max-height: none; } .sc-md-detail { display: none; } .sc-md-detail.sc-md-detail-mobile-visible { display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: var(--z-modal); border-radius: 0; padding: var(--space-4) var(--space-3); overflow-y: auto; } .sc-md-back { display: inline-flex; } .sc-md-master.sc-md-master-mobile-hidden { display: none; } .sc-entity-grid { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════════
   Evidence panel — Evaluación↔Evidencias (cierre brecha F0→F3)
   WCAG: focus-visible, target táctil ≥44px, contraste de badges
   ═══════════════════════════════════════════════════════════════ */

/* Card de evidencia: región común (Gestalt) con borde sutil */
.evidence-card {
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: var(--radius-md, 0.375rem);
  background: #fff;
  transition: box-shadow var(--transition-fast, 0.15s);
}
.evidence-card:hover { box-shadow: var(--shadow-sm, 0 0.125rem 0.25rem rgba(0,0,0,0.075)); }

/* Focus-visible accesible en el enlace "Ver detalle" (WCAG 2.4.7) */
.evidence-card a:focus-visible,
.evidence-card button:focus-visible {
  outline: 2px solid var(--color-primary, #2D6A4F);
  outline-offset: 2px;
}

/* Móvil: target táctil ≥44px y padding cómodo (UX Laws: Fitts) */
@media (max-width: 575.98px) {
  .evidence-card .card-body { padding: 0.75rem; }
  .evidence-card .btn { min-height: 44px; min-width: 44px; padding: 0.5rem 0.75rem; }
  .evidence-card .badge { font-size: 0.8rem; padding: 0.4em 0.6em; }
  /* Reflow: título no se corta, envuelve */
  .evidence-card h4 { white-space: normal; }
}

/* Modal de calificación fullscreen en móvil para que quepa cascada + panel + score */
@media (max-width: 575.98px) {
  #qualificationModal .modal-dialog {
    max-width: 100%;
    margin: 0;
    height: 100vh;
  }
  #qualificationModal .modal-content {
    height: 100vh;
    border-radius: 0;
  }
  #qualificationModal .modal-body { overflow-y: auto; }
}

/* Botón primario deshabilitado con feedback visual claro (Nielsen H5/H1) */
#btn-save-qualification[disabled],
#btn-save-qualification[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Card de evidencia expandible (Bug 3: progressive disclosure inline) */
.evidence-card .collapse { transition: height 0.25s ease-in-out; }
.evidence-card .evidence-toggle-btn i { transition: transform 0.2s ease; }
.evidence-toggle-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.evidence-card dl dt { font-weight: 500; }

/* ═══ Certificado verificable — estilos .vf-* compartidos (LOG 100/103) ═══
   Scope .vf-scope: la página pública (#scVerify) y el preview del editor de
   plantillas (#sc-ctpl-preview en programs) ven el certificado IGUAL. Las
   reglas de impresión viven en verify.html (solo esa página imprime). */
.vf-scope .vf-cert {
  position: relative; background: #fffdf7; color: #1b3a2a;
  border: 3px solid #14532d; border-radius: 10px;
  padding: clamp(1.2rem, 4vw, 2.6rem);
  box-shadow: 0 10px 30px rgba(20, 83, 45, .12);
  overflow: hidden;
}
.vf-scope .vf-cert-inner {
  border: 1px solid #b7d9c4; border-radius: 6px;
  padding: clamp(1rem, 3vw, 2rem);
  position: relative; z-index: 1;
}
.vf-scope .vf-watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: clamp(11rem, 34vw, 19rem); color: rgba(20, 83, 45, .06);
  z-index: 0; pointer-events: none;
}
.vf-scope .vf-head { text-align: center; border-bottom: 2px solid #b7d9c4; padding-bottom: .9rem; margin-bottom: 1.1rem; }
.vf-scope .vf-head .vf-program-icon { font-size: 2rem; color: #14532d; }
.vf-scope .vf-head h2 { font-family: var(--font-family-heading, serif); font-weight: 800; color: #14532d; margin: .2rem 0 0; letter-spacing: .04em; }
.vf-scope .vf-head .vf-sub { color: #4a6b58; font-size: .9rem; }
.vf-scope .vf-certifies { text-align: center; font-style: italic; color: #4a6b58; margin: .8rem 0 .3rem; }
.vf-scope .vf-community {
  text-align: center; font-family: var(--font-family-heading, serif);
  font-size: clamp(1.6rem, 5vw, 2.5rem); font-weight: 700; color: #1b3a2a;
  margin-bottom: .2rem;
}
.vf-scope .vf-type { text-align: center; color: #6b8577; font-size: .85rem; margin-bottom: 1rem; }
.vf-scope .vf-medal { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem auto 1.2rem; flex-wrap: wrap; }
.vf-scope .vf-medal-circle {
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #2f9e5f, #14532d 72%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 2.3rem; font-weight: 800; box-shadow: 0 4px 14px rgba(20, 83, 45, .35);
  border: 3px solid #ffd977; flex-shrink: 0;
}
.vf-scope .vf-revoked-strip {
  background: var(--bs-danger, #dc3545); color: #fff; font-weight: 700;
  border-radius: 6px; padding: .55rem .9rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  letter-spacing: .03em; font-size: .9rem;
}
.vf-scope .vf-medal-circle.vf-medal-revoked {
  background: radial-gradient(circle at 32% 28%, #8a8f96, #495057 72%);
  border-color: #ced4da;
}
.vf-scope .vf-medal-txt .vf-level-name { font-size: 1.25rem; font-weight: 700; color: #14532d; }
.vf-scope .vf-medal-txt .vf-level-sub { color: #4a6b58; font-size: .85rem; }
.vf-scope .vf-dates { display: flex; justify-content: center; gap: clamp(1rem, 5vw, 3rem); flex-wrap: wrap; margin: .8rem 0 1.2rem; text-align: center; }
.vf-scope .vf-dates .vf-date-label { color: #6b8577; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.vf-scope .vf-dates .vf-date-val { font-weight: 600; color: #1b3a2a; }
.vf-scope .vf-sign { display: flex; justify-content: center; margin-top: 1.2rem; }
.vf-scope .vf-sign-inner { text-align: center; border-top: 1px solid #b7d9c4; padding-top: .5rem; min-width: 260px; }
.vf-scope .vf-sign-inner .vf-sign-name { font-family: var(--font-family-heading, serif); font-style: italic; font-size: 1.15rem; color: #1b3a2a; }
.vf-scope .vf-sign-inner .vf-sign-role { color: #6b8577; font-size: .8rem; }
.vf-scope .vf-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 2px solid #b7d9c4; margin-top: 1.3rem; padding-top: .9rem;
}
.vf-scope .vf-code-label { color: #6b8577; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.vf-scope .vf-code { font-family: var(--font-family-monospace, monospace); font-weight: 700; font-size: 1.05rem; color: #14532d; letter-spacing: .06em; }
.vf-scope .vf-qr { background: #fff; padding: .4rem; border: 1px solid #b7d9c4; border-radius: 8px; line-height: 0; }
.vf-scope .vf-qr svg { width: 92px; height: 92px; }
.vf-scope .vf-verify-hint { color: #6b8577; font-size: .78rem; max-width: 300px; }

/* ═══ Editor/catálogo de plantillas de certificado — scope .sc-ctpl-scope ═══
   LOG 104/106: compartido entre la pestaña Plantilla (programs) y el
   catálogo de Certificaciones. Papel a ancho real (920px) escalado. */
.sc-ctpl-scope .sc-ctpl-subtab {
  display: inline-flex; align-items: center;
  border: 1px solid var(--color-border, #dee2e6); background: var(--color-surface, #fff);
  color: var(--color-muted, #6c757d); border-radius: 9999px;
  padding: .3rem .95rem; font-size: .85rem; min-height: 38px;
}
.sc-ctpl-scope .sc-ctpl-subtab:hover { color: var(--color-primary, #2563eb); border-color: var(--color-primary-light, #93c5fd); }
.sc-ctpl-scope .sc-ctpl-subtab.active {
  background: var(--color-primary, #2563eb); border-color: var(--color-primary, #2563eb); color: #fff; font-weight: 500;
}
.sc-ctpl-scope .sc-ctpl-note { border-left: 4px solid var(--color-primary, #2563eb); border-radius: .375rem; }
.sc-ctpl-scope .sc-ctpl-chip {
  display: inline-flex; align-items: center;
  padding: .12rem .5rem; border-radius: 9999px;
  font-family: var(--font-family-monospace, monospace);
  font-size: .72rem; line-height: 1.5;
  border: 1px solid var(--color-border, #dee2e6);
  background: var(--color-surface, #fff);
  color: var(--color-text, #212529);
  white-space: nowrap;
}
.sc-ctpl-scope .sc-ctpl-chip:hover { border-color: var(--color-primary, #2563eb); color: var(--color-primary, #2563eb); }
.sc-ctpl-scope .sc-ctpl-chip.sc-ctpl-chip-dyn { border-style: dashed; }
.sc-ctpl-scope .sc-ctpl-chip-group { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted, #6c757d); }
.sc-ctpl-scope textarea.sc-ctpl-body { font-size: .8rem; line-height: 1.55; }
.sc-ctpl-scope .sc-ctpl-desk { background: #eef1f5; border-radius: .5rem; padding: 12px; overflow: hidden; position: relative; }
.sc-ctpl-scope .sc-ctpl-paper { width: 920px; transform-origin: top left; background: #fff; box-shadow: 0 10px 28px rgba(15, 23, 42, .16); }
.sc-ctpl-scope .sc-ctpl-mini { position: absolute; width: 920px; transform-origin: top left; background: #fff; box-shadow: 0 6px 18px rgba(15, 23, 42, .14); }
/* LOG 107: rack del catálogo — miniaturas a proporción real (920px) dentro
   de marcos uniformes (fit-contain por JS): tarjetas comparables y bajas. */
.sc-ctpl-scope .sc-ctpl-rack { display: flex; flex-wrap: wrap; gap: .75rem; }
.sc-ctpl-scope .sc-ctpl-rack .sc-ctpl-cardwrap { flex: 1 1 260px; max-width: 420px; }
.sc-ctpl-scope .sc-ctpl-rack .sc-ctpl-cardwrap .sc-ctpl-card { width: 100%; }
/* LOG 109: rack dentro del modal del catálogo — más denso (3-4 por fila). */
.sc-ctpl-scope .sc-ctpl-rack-modal .sc-ctpl-cardwrap { flex: 1 1 220px; max-width: 300px; }
/* LOG 110: grupos por categoría + botón "ver más grande" por tarjeta. */
.sc-ctpl-scope .sc-ctpl-group + .sc-ctpl-group { margin-top: 1.1rem; }
.sc-ctpl-scope .sc-ctpl-group-head { display: flex; align-items: center; gap: .45rem; margin-bottom: .55rem; }
.sc-ctpl-scope .sc-ctpl-cardwrap { position: relative; }
.sc-ctpl-scope .sc-ctpl-zoom { position: absolute; right: .5rem; bottom: .5rem; z-index: 2; border: 1px solid var(--color-border, #dee2e6); }
.sc-ctpl-scope .sc-ctpl-zoom:hover { border-color: var(--color-primary, #2563eb); color: var(--color-primary, #2563eb); }
/* LOG 115: toggle de vista H/V — en la tarjeta (mini) y en la barra del detalle. */
.sc-ctpl-scope .sc-ctpl-orient { position: absolute; top: .5rem; right: .5rem; z-index: 2; --bs-btn-padding-y: .1rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .68rem; }
.btn-group-xs > .btn { padding: .1rem .5rem; font-size: .68rem; }
/* LOG 118: tabla del catálogo — miniatura por fila + filas de grupo. */
.sc-ctpl-scope .sc-cattpl-thumb { width: 108px; height: 68px; border-radius: .4rem; display: inline-block; vertical-align: middle; }
.sc-cattpl-colthumb { width: 124px; }
.sc-cattpl-group-row > td { background: #f1f4f8; border-top: 2px solid #dee2e6; font-size: .8rem; padding: .35rem .75rem; }
.sc-cattpl-group-row:hover > td { background: #f1f4f8; }
/* LOG 111: navegación ←/→ en la vista ampliada (lightbox). */
.sc-ctpl-scope .sc-ctpl-detwrap { position: relative; }
.sc-ctpl-scope .sc-ctpl-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, .94); border: 1px solid var(--color-border, #dee2e6);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.sc-ctpl-scope .sc-ctpl-nav-prev { left: 6px; }
.sc-ctpl-scope .sc-ctpl-nav-next { right: 6px; }
.sc-ctpl-scope .sc-ctpl-nav:hover { border-color: var(--color-primary, #2563eb); color: var(--color-primary, #2563eb); }
.sc-ctpl-scope .sc-ctpl-cardprev { display: block; height: 176px; }
.sc-ctpl-scope button.sc-ctpl-card { display: block; width: 100%; padding: 0; text-align: left; color: inherit; }
.sc-ctpl-scope button.sc-ctpl-card:hover { border-color: var(--color-primary, #2563eb); }
.sc-ctpl-scope button.sc-ctpl-card:focus-visible { outline: 3px solid var(--color-primary, #2563eb); outline-offset: 2px; }
.sc-ctpl-scope .sc-ctpl-card-inner { display: block; padding: .5rem; }
.sc-ctpl-scope .sc-ctpl-dirty { animation: sc-ctpl-pulse 2s ease-in-out infinite; }
.sc-ctpl-scope .sc-ctpl-card.sel { border-color: var(--color-primary, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
@keyframes sc-ctpl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ═══ Ayuda de página (estándar plataforma): botón cabecera + panel acoplado ═══ */
/* Punto de "guía sin leer" sobre el botón de ayuda; desaparece al abrirla 1 vez */
.sc-help-new { position: relative; }
.sc-help-new::after {
  content: ""; position: absolute; top: -3px; right: -3px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bs-primary, #2d6a4f);
  border: 2px solid var(--bs-body-bg, #fff);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}
/* Panel lateral de ayuda: acoplado, SIN backdrop (la página queda visible y
   navegable mientras se lee la guía) */
.sc-help-panel { width: 380px; max-width: 92vw; }
.sc-help-body { font-size: .9rem; }
.sc-help-body p { margin-bottom: .6rem; }
.sc-help-body strong { color: var(--bs-body-color, #212529); }
@media (max-width: 575.98px) {
  .sc-help-panel { width: 100%; max-width: 100%; }
}
