/* === Tokens (dark mode, default) === */
:root {
  --bg-1: #0b1024;
  --bg-2: #1a1442;
  --bg-3: #2d1b69;
  --primary: #6366f1;
  --primary-light: #a5b4fc;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-teal: #14b8a6;
  --accent-violet: #a855f7;
  --accent-slate: #64748b;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --surface-hover: rgba(255, 255, 255, 0.13);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 50px -10px rgba(99, 102, 241, 0.4);
  /* Para que el body gradient quede coherente en light/dark */
  --body-bg: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  --blob-opacity: 0.5;
}

/* === Light mode === */
:root[data-theme="light"] {
  --bg-1: #f5f6fc;
  --bg-2: #e8eaf6;
  --bg-3: #f0e6ff;
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --text: #1e293b;
  --text-muted: #475569;
  --text-soft: #64748b;
  --surface: rgba(0, 0, 0, 0.04);
  --surface-2: rgba(0, 0, 0, 0.06);
  --surface-hover: rgba(0, 0, 0, 0.09);
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.18);
  --shadow: 0 18px 50px -16px rgba(15, 23, 42, 0.15);
  --shadow-glow: 0 0 50px -10px rgba(99, 102, 241, 0.25);
  --body-bg: linear-gradient(135deg, #f5f6fc 0%, #e8eaf6 50%, #f0e6ff 100%);
  --blob-opacity: 0.2;
}
:root[data-theme="light"] body { background: var(--body-bg); }
:root[data-theme="light"] .blob { opacity: var(--blob-opacity); }

/* ── Light mode: arreglar todos los títulos con gradient-text ──
   En dark, los gradientes son blanco→índigo→rosa que se ven sobre fondo
   oscuro. En light no se ven (claros sobre claro). Re-gradiente con
   tonos oscuros para mantener efecto bonito y legible. */
:root[data-theme="light"] .hero h1,
:root[data-theme="light"] .page-header h1,
:root[data-theme="light"] .news-article-header h1 {
  background: linear-gradient(135deg, #1e293b 0%, #4f46e5 60%, #be185d 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}

/* Texto secundario y elementos que en dark usaban blanco-translúcido */
:root[data-theme="light"] .eyebrow { color: var(--primary); }
:root[data-theme="light"] .page-header p,
:root[data-theme="light"] .hero p.lead,
:root[data-theme="light"] .news-article-header .lead { color: var(--text-muted); }

/* Cards: fondos blanco-translúcido → gris-translúcido para que se vean */
:root[data-theme="light"] .card,
:root[data-theme="light"] .form-card,
:root[data-theme="light"] .gloss-entry,
:root[data-theme="light"] .article-card,
:root[data-theme="light"] .dash-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 16px -8px rgba(15, 23, 42, 0.08);
}

/* Links en light mode: usar tono más contrastado.
   Excluimos los que son botones disfrazados (.btn, .btn-sm, .card, etc.)
   porque deben mantener su color propio. */
:root[data-theme="light"] a:not(.btn):not(.btn-sm):not(.btn-primary-sm):not(.card):not(.share-btn):not(.theme-toggle):not([class*="-btn"]) {
  color: var(--primary);
}
:root[data-theme="light"] a:not(.btn):not(.btn-sm):not(.btn-primary-sm):not(.card):not(.share-btn):not(.theme-toggle):not([class*="-btn"]):hover {
  color: #3730a3;
}

/* CTA principal .btn (gradient indigo-pink): el texto SIEMPRE blanco.
   Excluimos .btn-ghost que tiene fondo transparente y necesita texto oscuro. */
:root[data-theme="light"] .btn:not(.btn-ghost),
:root[data-theme="light"] a.btn:not(.btn-ghost),
:root[data-theme="light"] button.btn:not(.btn-ghost) {
  color: #ffffff !important;
}
:root[data-theme="light"] .btn:not(.btn-ghost):hover,
:root[data-theme="light"] a.btn:not(.btn-ghost):hover { color: #ffffff !important; }

/* Botones primary-sm (pill morado del estilo de "Publicar oferta") */
:root[data-theme="light"] .btn-primary-sm,
:root[data-theme="light"] a.btn-primary-sm { color: #ffffff !important; }

/* Variante .btn.btn-ghost: fondo claro + borde visible + texto oscuro */
:root[data-theme="light"] .btn.btn-ghost,
:root[data-theme="light"] a.btn.btn-ghost,
:root[data-theme="light"] button.btn.btn-ghost {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: var(--text) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
:root[data-theme="light"] .btn.btn-ghost:hover,
:root[data-theme="light"] a.btn.btn-ghost:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: var(--text) !important;
}

/* Botones .share-btn: mantienen sus colores de marca también en light mode
   (no necesitan override — verde WhatsApp, azul LinkedIn, etc. funcionan
   en cualquier tema porque tienen sus propios bg sólidos coloreados) */

/* Card CTAs ("Leer más →"): índigo más oscuro para legibilidad */
:root[data-theme="light"] .card-cta { color: var(--primary); }

/* "Volver al inicio" en topnav y similares */
:root[data-theme="light"] .topnav .back { color: var(--text-muted); }
:root[data-theme="light"] .topnav .back:hover { color: var(--primary); }

/* Code inline: fondo claro */
:root[data-theme="light"] code {
  background: rgba(99, 102, 241, 0.10);
  color: #3730a3;
}

/* Botones .btn-sm en light: fondo blanco sólido, borde gris claro, texto oscuro */
:root[data-theme="light"] .btn-sm:not(.danger):not(.success):not(.is-featured):not(.rss-link) {
  background: #ffffff;
  color: var(--text);
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
:root[data-theme="light"] .btn-sm:not(.danger):not(.success):not(.is-featured):not(.rss-link):hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--text);
}
/* Botones de acción primaria (.btn-sm dentro de .search-bar y similares):
   resaltar más para que se vea como "click here" */
:root[data-theme="light"] .search-bar .btn-sm,
:root[data-theme="light"] .search-bar button[type="submit"] {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink)) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.35) !important;
}
:root[data-theme="light"] .search-bar .btn-sm:hover,
:root[data-theme="light"] .search-bar button[type="submit"]:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.5) !important;
}

/* ── Light mode: inputs / search / textareas / selects ──
   En dark, los inputs usan fondo blanco-traslúcido sobre body oscuro → visible.
   En light, ese mismo fondo es invisible. Volcamos a fondo blanco sólido con
   borde gris claro nítido.

   Excluimos explícitamente checkbox y radio: tienen estilos propios
   (.consent-check, .check-card, etc.) y aplicar fondo/borde aquí los rompe. */
:root[data-theme="light"] .field input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .search-bar input[type="search"],
:root[data-theme="light"] .search-bar input[type="text"],
:root[data-theme="light"] input[type="email"],
:root[data-theme="light"] input[type="text"],
:root[data-theme="light"] input[type="search"],
:root[data-theme="light"] input[type="password"],
:root[data-theme="light"] input[type="number"],
:root[data-theme="light"] input[type="tel"],
:root[data-theme="light"] input[type="url"],
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
:root[data-theme="light"] .field input:not([type="checkbox"]):not([type="radio"]):focus,
:root[data-theme="light"] .field textarea:focus,
:root[data-theme="light"] .field select:focus,
:root[data-theme="light"] .search-bar input[type="search"]:focus,
:root[data-theme="light"] input[type="text"]:focus,
:root[data-theme="light"] input[type="email"]:focus,
:root[data-theme="light"] input[type="search"]:focus,
:root[data-theme="light"] input[type="password"]:focus,
:root[data-theme="light"] input[type="number"]:focus,
:root[data-theme="light"] input[type="tel"]:focus,
:root[data-theme="light"] input[type="url"]:focus,
:root[data-theme="light"] textarea:focus,
:root[data-theme="light"] select:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}
:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
  color: #94a3b8;
}

/* Caja del hero-search (página principal) */
:root[data-theme="light"] .hero-search {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}
:root[data-theme="light"] .hero-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), 0 4px 12px -4px rgba(15, 23, 42, 0.12);
}
:root[data-theme="light"] .hero-search input { color: var(--text); }
:root[data-theme="light"] .hero-search input::placeholder { color: #64748b; }
/* Botón circular con lupa: gradiente indigo→rosa, mantener texto blanco */
:root[data-theme="light"] .hero-search button { color: #ffffff; }

/* Botón "Buscar" del .search-bar interno (sin gradient, es btn-sm): ya está
   cubierto por la regla de .btn-sm más arriba — usa fondo blanco + texto oscuro */

/* ── Light mode: contenido de noticias (h2, h3, enlaces inline) ──
   El cuerpo de las noticias usa .news-content. Sus h2/h3 deben ser oscuros
   y los enlaces inline más contrastados que el var(--primary-light) original. */
:root[data-theme="light"] .news-content h2,
:root[data-theme="light"] .news-content h3,
:root[data-theme="light"] .news-content h4,
:root[data-theme="light"] .news-content strong,
:root[data-theme="light"] .norm-desc h2,
:root[data-theme="light"] .norm-desc h3 {
  color: var(--text) !important;
}
:root[data-theme="light"] .news-content a,
:root[data-theme="light"] .norm-desc a {
  color: #4338ca !important;       /* indigo-700, mucho más contrastado */
  text-decoration: underline !important;
  text-decoration-color: rgba(67, 56, 202, 0.4);
  text-underline-offset: 3px;
  border-bottom: none !important;
}
:root[data-theme="light"] .news-content a:hover,
:root[data-theme="light"] .norm-desc a:hover {
  color: #3730a3 !important;
  text-decoration-color: #3730a3;
}

/* Términos del glosario (abbr.gloss): subrayado más visible */
:root[data-theme="light"] abbr.gloss {
  text-decoration-color: rgba(67, 56, 202, 0.65);
}
:root[data-theme="light"] abbr.gloss:hover {
  background: rgba(99, 102, 241, 0.12);
  text-decoration-color: #4338ca;
}

/* Code inline en news-content: ya lo cubrí pero refuerzo aquí */
:root[data-theme="light"] .news-content code,
:root[data-theme="light"] .norm-desc code,
:root[data-theme="light"] p code,
:root[data-theme="light"] li code {
  background: rgba(99, 102, 241, 0.12);
  color: #3730a3;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ── Light mode: anular colores INLINE pastel del editor Quill ──
   Cuando se edita una noticia desde el admin (que está en dark mode), Quill
   guarda colores inline pastel directamente en el HTML (style="color: rgb(245,243,255)").
   Esos colores son INVISIBLES en light mode. Forzamos a que se ignoren para que
   herede el color del tema (--text oscuro). */
:root[data-theme="light"] .news-content [style*="color: rgb(2"],
:root[data-theme="light"] .news-content [style*="color:rgb(2"],
:root[data-theme="light"] .news-content [style*="color: #f"],
:root[data-theme="light"] .news-content [style*="color:#f"],
:root[data-theme="light"] .news-content [style*="color: #e"],
:root[data-theme="light"] .news-content [style*="color:#e"],
:root[data-theme="light"] .news-content [style*="color: #d"],
:root[data-theme="light"] .news-content [style*="color:#d"],
:root[data-theme="light"] .news-content [style*="color: rgb(163"],
:root[data-theme="light"] .news-content [style*="color: rgb(196"],
:root[data-theme="light"] .news-content [style*="color: rgb(165"],
:root[data-theme="light"] .news-content [style*="color: rgb(199"],
:root[data-theme="light"] .news-content [style*="color: rgb(167"],
:root[data-theme="light"] .news-content [style*="color: rgb(94"],
:root[data-theme="light"] .news-content [style*="color: rgb(148"],
:root[data-theme="light"] .news-content [style*="color: rgb(100"],
:root[data-theme="light"] .news-content [style*="color: white"] {
  color: var(--text) !important;
}

/* Lo mismo para el admin de comentarios y otros contenidos editables */
:root[data-theme="light"] .norm-desc [style*="color: rgb(2"],
:root[data-theme="light"] .norm-desc [style*="color: #f"],
:root[data-theme="light"] .norm-desc [style*="color: #e"],
:root[data-theme="light"] .norm-desc [style*="color: white"] {
  color: var(--text) !important;
}

/* ── Light mode: filtros tipo pill (.admin-filters, .cert-rd-btn, .filter-chip) ── */
:root[data-theme="light"] .admin-filters a {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-muted);
}
:root[data-theme="light"] .admin-filters a:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--text);
}
:root[data-theme="light"] .admin-filters a.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: #ffffff !important;
  border-color: transparent;
}

/* Filtros de RD en certificados (cert-rd-btn) */
:root[data-theme="light"] .cert-rd-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text);
}
:root[data-theme="light"] .cert-rd-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
:root[data-theme="light"] .cert-rd-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  border-color: transparent;
  color: #ffffff;
}
:root[data-theme="light"] .cert-rd-btn-new.active {
  background: linear-gradient(135deg, var(--accent-teal), #2dd4bf);
  border-color: transparent;
  color: #ffffff;
}
:root[data-theme="light"] .cert-rd-count {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}
:root[data-theme="light"] .cert-rd-btn.active .cert-rd-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
:root[data-theme="light"] .cert-rd-btn-new.active .cert-rd-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
/* Si el sistema prefiere light pero no hay override explícito, NO cambiamos
   nada (porque el sitio se diseñó dark y los usuarios pueden cambiar a mano).
   La preferencia automática solo aplica si:data-theme NO está en localStorage
   — eso lo decide el JS antes del paint. */

/* === Toggle de tema (en topnav O flotante esquina) === */
.theme-toggle {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-pink) 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 0.6rem;
  box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.45), 0 0 0 0 rgba(99, 102, 241, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  position: relative;
}
.theme-toggle::before {
  /* Anillo pulsante sutil para llamar la atención */
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.35);
  animation: theme-pulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes theme-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.15); }
}
.theme-toggle:hover {
  transform: translateY(-2px) rotate(-8deg);
  filter: brightness(1.1);
  box-shadow: 0 12px 32px -4px rgba(99, 102, 241, 0.6);
}
.theme-toggle:active { transform: translateY(0) rotate(0); }
.theme-toggle svg { width: 22px; height: 22px; stroke-width: 2.2; }
.theme-toggle .icon-light { display: none; }

/* En modo light: cambio sutil de gradiente para que se vea bien sobre fondo claro */
:root[data-theme="light"] .theme-toggle {
  background: linear-gradient(135deg, #4f46e5 0%, #ec4899 100%);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 24px -4px rgba(79, 70, 229, 0.35);
}
:root[data-theme="light"] .theme-toggle .icon-dark  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-light { display: inline-block; }

/* En posición flotante (bottom-right en páginas sin topnav) — PILL con texto */
.theme-toggle-floating {
  position: fixed !important;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 100;
  width: auto !important;
  height: auto !important;
  padding: 0.65rem 1.1rem 0.65rem 0.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  white-space: nowrap;
}
.theme-toggle-floating svg { width: 20px; height: 20px; flex-shrink: 0; }
.theme-toggle-label {
  display: inline-block;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
/* En móvil, ocultar el texto y dejar solo el icono (más espacio) */
@media (max-width: 480px) {
  .theme-toggle-floating { padding: 0.7rem; width: 48px !important; height: 48px !important; }
  .theme-toggle-floating .theme-toggle-label { display: none; }
}
/* Topnav: tamaño compacto (sin label) */
.topnav .theme-toggle { width: 42px; height: 42px; }
.topnav .theme-toggle svg { width: 20px; height: 20px; }
@media (max-width: 600px) {
  .topnav .theme-toggle { width: 38px; height: 38px; }
  .topnav .theme-toggle svg { width: 18px; height: 18px; }
}

/* Print: ocultar el botón */
@media print { .theme-toggle { display: none !important; } }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary-light); }

/* === Animated background blobs === */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  animation: float 22s infinite ease-in-out;
  will-change: transform;        /* fuerza compositing layer dedicado */
  transform: translateZ(0);      /* hint de promote-to-layer en navegadores antiguos */
  contain: layout paint;         /* aísla del flujo principal */
}
.blob-1 { width: 540px; height: 540px; background: var(--primary); top: -12%; left: -10%; }
.blob-2 { width: 460px; height: 460px; background: var(--accent-pink); bottom: -15%; right: -10%; animation-delay: -10s; }
.blob-3 { width: 380px; height: 380px; background: var(--accent-amber); top: 45%; left: 55%; opacity: 0.25; animation-delay: -5s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.08); }
  66% { transform: translate(-40px, 50px) scale(0.94); }
}

/* === Layout === */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* === Top nav (inner pages) === */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  margin-bottom: 1rem;
}
.topnav a.brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s ease;
}
.topnav a.brand:hover { transform: translateY(-1px); }
.topnav a.brand img {
  height: 28px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}
.topnav .back {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
}
.topnav .back:hover { color: var(--text); border-color: var(--border-strong); transform: translateX(-2px); }
.topnav .back svg { width: 14px; height: 14px; }

/* === Hero === */
.hero { padding: 3rem 0 2rem; text-align: center; }
.hero-logo {
  display: block;
  width: fit-content;
  margin: 0 auto 1.75rem;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-logo:hover { transform: translateY(-3px) scale(1.02); }
.hero-logo img {
  height: 80px;
  width: auto;
  display: block;
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.45));
}
@media (max-width: 640px) {
  .hero-logo { margin-bottom: 1.25rem; }
  .hero-logo img { height: 56px; }
}
.hero-eyebrow {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  backdrop-filter: blur(10px);
  margin-bottom: 1.75rem;
  letter-spacing: 0.01em;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #c7d2fe 45%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.25rem;
}
.hero p {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto;
  line-height: 1.65;
}
.hero p strong { color: var(--text); font-weight: 600; }

/* === Card grid === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-top: 3.5rem;
}
/* Eyebrow del grid (H2 sutil que ocupa toda la fila) */
.grid-heading {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-align: center;
  opacity: 0.7;
}

/* Subtítulos dentro del grid (separan secciones: Recursos públicos / Comunidad).
   Tamaño intermedio: más prominentes que el h2 etiqueta superior, pero sin
   competir visualmente con los títulos de las cards (que son h3 también). */
.grid-subheading {
  grid-column: 1 / -1;
  margin: 1.2rem 0 0.1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--border);
}
.grid-subheading:first-of-type { margin-top: 0; }
.grid-subheading > .gs-emoji {
  font-size: 1.15rem;
  line-height: 1;
}
.grid-subheading > small {
  margin-left: auto;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Sección "Sobre" sutil al final, antes del footer */
.about {
  max-width: 720px;
  margin: 4rem auto 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.about h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 1.2rem 0;
  opacity: 0.7;
}
.about p {
  margin: 0 0 0.8rem 0;
}
.about p:last-child {
  margin-bottom: 0;
}
.about strong {
  color: var(--text);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  text-decoration: none;
  color: var(--text);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              opacity 0.6s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 220px;
}

.reveal { opacity: 0; transform: translateY(24px); }
.reveal.visible { opacity: 1; transform: translateY(0); }

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-pink));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,0.06), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow), var(--shadow-glow);
}
.card:hover::before { transform: scaleX(1); }
.card:hover::after { opacity: 1; }

.card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: white;
  box-shadow: 0 8px 22px -8px var(--primary);
  flex-shrink: 0;
}
.card-icon.icon-pink   { background: linear-gradient(135deg, var(--accent-pink), #f472b6); box-shadow: 0 8px 22px -8px var(--accent-pink); }
.card-icon.icon-amber  { background: linear-gradient(135deg, var(--accent-amber), #fbbf24); box-shadow: 0 8px 22px -8px var(--accent-amber); }
.card-icon.icon-teal   { background: linear-gradient(135deg, var(--accent-teal), #2dd4bf); box-shadow: 0 8px 22px -8px var(--accent-teal); }
.card-icon.icon-violet { background: linear-gradient(135deg, var(--accent-violet), #c084fc); box-shadow: 0 8px 22px -8px var(--accent-violet); }
.card-icon.icon-slate  { background: linear-gradient(135deg, #475569, #94a3b8); }

.card-icon svg { width: 28px; height: 28px; }

.card h3 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.card p { color: var(--text-muted); line-height: 1.6; flex: 1; font-size: 0.96rem; }

.card-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.92rem; font-weight: 600;
  color: var(--primary-light);
  margin-top: 0.25rem;
}
.card-cta svg { width: 16px; height: 16px; transition: transform 0.3s ease; }
.card:hover .card-cta svg { transform: translateX(5px); }

.card-external {
  position: absolute;
  top: 1rem; right: 1rem;
  font-size: 0.68rem;
  padding: 0.25rem 0.65rem;
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === Inner page (prose) === */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 1rem 0 4rem;
}
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}
.page-header .eyebrow {
  display: inline-block;
  padding: 0.4rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.page-header h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 0.85rem;
}
.page-header p { color: var(--text-muted); font-size: 1.08rem; max-width: 580px; margin: 0 auto; }

.prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.25rem 0 0.85rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); }
.prose p, .prose li { color: var(--text-muted); line-height: 1.7; margin-bottom: 1rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--primary-light); text-decoration: none; border-bottom: 1px dashed rgba(165,180,252,0.4); }
.prose a:hover { border-bottom-color: var(--primary-light); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose .meta {
  font-size: 0.85rem;
  color: var(--text-soft);
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  margin-bottom: 1.5rem;
}

/* === Form === */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.form-grid { display: grid; gap: 1.25rem; }
.form-row { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.field label .req { color: var(--accent-pink); }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.field textarea[rows="3"] { min-height: 90px; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}
.field select option { background: #1e1b4b; color: var(--text); }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Filtros del listado de normativa: chips multi-línea */
.admin-filters.norm-filters {
  flex-wrap: wrap;
  gap: 0.4rem;
}
.admin-filters.norm-filters a {
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
}

/* Botón danger pequeño */
.btn-sm.danger {
  background: rgba(244,63,94,0.12);
  border-color: rgba(244,63,94,0.35);
  color: #fda4af;
}
.btn-sm.danger:hover {
  background: rgba(244,63,94,0.2);
  color: #fecdd3;
}
.btn.btn-ghost.danger {
  color: #fda4af;
  border-color: rgba(244,63,94,0.35);
}
.btn.btn-ghost.danger:hover {
  background: rgba(244,63,94,0.12);
  color: #fecdd3;
}
.field .help { font-size: 0.82rem; color: var(--text-soft); }

/* Honeypot — hidden visually + accessibility */
.hp { position: absolute !important; left: -9999px !important; top: -9999px !important; opacity: 0 !important; height: 0 !important; width: 0 !important; pointer-events: none; }

.captcha {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
}
.captcha .question {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-weight: 700;
  color: var(--primary-light);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.captcha input { max-width: 120px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.95rem 1.6rem;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.25s ease, filter 0.2s ease;
  box-shadow: 0 10px 28px -10px rgba(99, 102, 241, 0.55);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 14px 36px -10px rgba(236, 72, 153, 0.55); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); filter: none; box-shadow: none; }

.alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex; align-items: flex-start; gap: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.alert svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.alert.success { background: rgba(20, 184, 166, 0.12); border: 1px solid rgba(20, 184, 166, 0.4); color: #5eead4; }
.alert.error   { background: rgba(244, 63, 94,  0.12); border: 1px solid rgba(244, 63, 94, 0.4);  color: #fda4af; }

/* Coming-soon (normativa placeholder) */
.coming-soon {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}
.coming-soon .badge {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-pink));
  color: white;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px -8px var(--accent-pink);
}
.coming-soon h2 { font-size: 1.75rem; margin-bottom: 0.85rem; }
.coming-soon p { color: var(--text-muted); max-width: 520px; margin: 0 auto 1.5rem; }

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  text-align: left;
}
.topic {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}
.topic strong { display: block; color: var(--text); margin-bottom: 0.3rem; font-size: 0.95rem; }
.topic span { color: var(--text-soft); font-size: 0.85rem; line-height: 1.5; }

/* Footer */
footer {
  margin-top: 5rem;
  padding: 2rem 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--primary-light); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .footer-meta {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}
footer .footer-logo {
  display: inline-block;
  margin: 0 0.3rem;
  line-height: 0;
}
footer .footer-logo img {
  height: 14px;
  width: auto;
  vertical-align: middle;
  transform: translateY(-3px);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.3));
}

/* === Página normativa === */
.norm-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  align-items: flex-start;
}
@media (max-width: 960px) {
  .norm-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

.toc {
  position: sticky;
  top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.1rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 0.88rem;
}
.toc h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: 0.85rem;
  font-weight: 700;
}
.toc ol { list-style: none; padding: 0; counter-reset: toc; }
.toc li { margin: 0.2rem 0; counter-increment: toc; }
.toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 0.45rem 0.6rem 0.45rem 1.85rem;
  border-radius: 8px;
  border-left: 2px solid transparent;
  position: relative;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  line-height: 1.35;
}
.toc a::before {
  content: counter(toc);
  position: absolute;
  left: 0.55rem;
  top: 0.45rem;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-soft);
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
}
.toc a:hover { color: var(--text); background: rgba(255,255,255,0.04); border-left-color: var(--primary); }
.toc a:hover::before { color: var(--text); background: rgba(99,102,241,0.25); }
.toc a.active {
  color: var(--text);
  background: rgba(99, 102, 241, 0.12);
  border-left-color: var(--primary);
}
.toc a.active::before {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
}

@media (max-width: 960px) {
  .toc { position: static; }
}

.norm-section {
  margin-bottom: 1rem;
  scroll-margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.2s ease;
}
.norm-section[open] { border-color: var(--border-strong); }
.norm-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 1.25rem 1.5rem;
  transition: background 0.2s ease;
}
.norm-section > summary::-webkit-details-marker { display: none; }
.norm-section > summary:hover { background: rgba(255, 255, 255, 0.03); }
.norm-section[open] > summary {
  border-bottom: 1px solid var(--border);
  background: rgba(99, 102, 241, 0.06);
}

/* === Estadísticas: KPIs, gráfico, top páginas === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.25rem;
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.kpi-card.kpi-primary {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(236,72,153,0.18));
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 40px -12px rgba(99, 102, 241, 0.45);
}
.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-soft);
}
.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi-card.kpi-primary .kpi-value {
  background: linear-gradient(135deg, #fff, #c7d2fe);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.kpi-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Gráfico de barras (CSS puro) */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 0.5rem 0;
  /* overflow: visible para que los tooltips de las barras NO se recorten al
     salir hacia arriba. Antes era overflow-x: auto, lo que forzaba overflow-y
     a no-visible y cortaba los tooltips dejándolos como cuadros vacíos. */
  overflow: visible;
}
.chart-col {
  flex: 1 1 0;
  min-width: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: default;
}
.chart-bar-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 100%;
  background: linear-gradient(to top, var(--primary), var(--accent-pink));
  border-radius: 4px 4px 0 0;
  min-height: 1px;
  transition: filter 0.15s ease;
}
.chart-bar-uniq {
  width: 60%;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 3px 3px 0 0;
  position: absolute;
  bottom: 0;
  min-height: 1px;
}
.chart-col:hover .chart-bar { filter: brightness(1.25); }
/* ── Tooltip de las barras de gráfico (chart-col) ──
   El padre .chart antes tenía overflow-x:auto que recortaba este tooltip;
   ya está corregido. Usamos color fijo para que no dependa de variables
   que puedan quedar mal en algún tema. */
.chart-col[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: auto;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1b4b;
  color: #ffffff;
  border: 1px solid rgba(167, 139, 250, 0.45);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,0.55);
  text-shadow: none;
}
.chart-col[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1e1b4b;
  z-index: 1000;
  pointer-events: none;
}
:root[data-theme="light"] .chart-col[data-tooltip]:hover::after {
  background: #1e293b;
  border-color: rgba(99, 102, 241, 0.4);
}
:root[data-theme="light"] .chart-col[data-tooltip]:hover::before {
  border-top-color: #1e293b;
}
.chart-label {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.chart-legend {
  display: flex; gap: 1.25rem;
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.chart-legend .dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.chart-legend .dot-views { background: linear-gradient(135deg, var(--primary), var(--accent-pink)); }
.chart-legend .dot-uniq  { background: rgba(255,255,255,0.55); }

/* Gráfico dedicado a SOLO visitantes únicos: barras índigo→violeta más anchas */
.chart-bar-uniq-solo {
  width: 75%;
  background: linear-gradient(180deg, #a78bfa 0%, #6366f1 100%);
  border-radius: 5px 5px 0 0;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  transition: height 0.3s ease, filter 0.2s;
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.4);
  min-height: 2px;
}
.chart-bar-uniq-solo:hover { filter: brightness(1.15); }
:root[data-theme="light"] .chart-bar-uniq-solo {
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
  box-shadow: 0 2px 8px -2px rgba(67, 56, 202, 0.35);
}

/* Top páginas */
.top-pages { display: flex; flex-direction: column; gap: 0.4rem; }
.top-row {
  position: relative;
  padding: 0.65rem 0.95rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: block;
}
a.top-row.top-row-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
a.top-row.top-row-link:hover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.08);
}

/* Tabla de detalle de visitas (admin → stats_detail) */
.visit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.visit-table th,
.visit-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.visit-table thead th {
  background: rgba(255,255,255,0.04);
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.visit-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.visit-table tbody tr:last-child td { border-bottom: 0; }
.top-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(236, 72, 153, 0.08));
  z-index: 0;
  transition: width 0.25s ease;
}
.top-info {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.top-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
}
.top-stats {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* === Lightbox para imágenes de las noticias === */
.img-zoom {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem auto;   /* centra la imagen como antes */
  cursor: zoom-in;
}
.img-zoom > img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;             /* el wrapper ya carga el margen */
}
.img-zoom::after {
  content: '';
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 38px; height: 38px;
  background:
    rgba(15, 23, 42, 0.72)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/><line x1='11' y1='8' x2='11' y2='14'/><line x1='8' y1='11' x2='14' y2='11'/></svg>")
    center / 18px 18px no-repeat;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.img-zoom:hover::after,
.img-zoom:focus-within::after {
  opacity: 1;
  transform: scale(1);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: zoom-out;
}
.lightbox.open {
  display: flex;
  animation: lightbox-fade 0.2s ease;
}
@keyframes lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px -14px rgba(0, 0, 0, 0.7);
  cursor: default;
  animation: lightbox-zoom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lightbox-zoom {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s ease, transform 0.15s ease;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}
.lightbox-caption {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  max-width: calc(100% - 6rem);
  text-align: center;
}

/* Etiqueta de slug en el listado de noticias */
.slug-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  word-break: break-all;
  max-width: 100%;
}

/* Trío de bloques (ciudades/SO/navegador) */
.stats-trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.stats-block { padding: 1.5rem; }
.stats-block h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
}
.stats-block h2 svg { color: var(--primary-light); }
.stats-block .empty-block {
  color: var(--text-soft);
  font-size: 0.88rem;
  padding: 0.85rem 0;
}

/* === Tarjetas-checkbox para visibilidad/destacado === */
.check-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}
.check-card {
  display: flex !important;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  font-weight: 400 !important;
  font-size: 0.92rem !important;
  letter-spacing: 0;
}
.check-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.check-card input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.check-card-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  flex-shrink: 0;
}
.check-card-icon.star { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.check-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.check-card-text strong {
  color: var(--text);
  font-weight: 700;
  font-size: 0.96rem;
}
.check-card-text small {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 400;
}
.check-card-text small code {
  background: rgba(255,255,255,0.07);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}
.check-card:has(input:checked) {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.45);
}
.check-card:has(input:checked) .check-card-icon {
  background: rgba(99, 102, 241, 0.3);
  color: white;
}
.check-card:has(input[name="destacado"]:checked) {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.4);
}
.check-card:has(input[name="destacado"]:checked) .check-card-icon.star {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
  box-shadow: 0 4px 14px -4px rgba(251, 191, 36, 0.5);
}

/* === Toggle Visual / HTML === */
.editor-mode-tabs {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.editor-tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.editor-tab:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.editor-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border-color: transparent;
}
.editor-mode-hint {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-left: 0.4rem;
}
.editor-html {
  display: none;
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  min-height: 380px;
  resize: vertical;
}
.editor-html.active { display: block; }
.editor-html:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* === Editor Quill (WYSIWYG) en tema oscuro === */
.ql-toolbar.ql-snow {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 0.5rem 0.6rem;
}
.ql-container.ql-snow {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  color: var(--text);
  min-height: 380px;
}
.ql-editor {
  min-height: 380px;
  line-height: 1.7;
  padding: 1.25rem 1.5rem;
}
.ql-editor.ql-blank::before {
  color: var(--text-soft) !important;
  font-style: normal !important;
  left: 1.5rem !important;
  opacity: 0.85 !important;
}

/* Botones de la toolbar — iconos blancos legibles sobre fondo oscuro */
.ql-snow .ql-stroke,
.ql-snow .ql-stroke.ql-fill { stroke: #f1f5f9 !important; }
.ql-snow .ql-fill { fill: #f1f5f9 !important; }
.ql-snow .ql-picker, .ql-snow .ql-picker-label { color: #f1f5f9 !important; }
.ql-snow .ql-picker-label { padding-left: 0.6rem; padding-right: 1.4rem; }
.ql-snow .ql-picker-label::before { color: #f1f5f9 !important; }

/* Hover y activo: violeta */
.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button:focus,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-picker.ql-expanded .ql-picker-label {
  background: rgba(99, 102, 241, 0.25) !important;
  border-radius: 5px;
}
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar button:focus .ql-stroke,
.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke,
.ql-snow .ql-picker-label:hover .ql-stroke {
  stroke: #c7d2fe !important;
}
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow.ql-toolbar button:focus .ql-fill,
.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill {
  fill: #c7d2fe !important;
}
.ql-snow.ql-toolbar button:hover .ql-picker-label,
.ql-snow .ql-picker.ql-expanded .ql-picker-label::before {
  color: #c7d2fe !important;
}

/* Items dentro de los desplegables (Header, Color, Align) */
.ql-snow .ql-picker-options .ql-picker-item { color: #cbd5e1 !important; }
.ql-snow .ql-picker-options .ql-picker-item:hover,
.ql-snow .ql-picker-options .ql-picker-item.ql-selected {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.25);
  border-radius: 4px;
}
/* Texto/etiqueta interna del header dropdown */
.ql-snow .ql-header .ql-picker-label::before,
.ql-snow .ql-header .ql-picker-item::before { color: inherit !important; }

/* Menús desplegables (color, alineación, header) — fondo oscuro
   !important porque quill.snow.css se carga después y vendría a ganar. */
.ql-snow .ql-picker-options {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 12px 40px -8px rgba(0,0,0,0.5) !important;
  border-radius: 8px !important;
  padding: 0.4rem !important;
}
/* Items dentro del dropdown — texto legible sobre fondo oscuro */
.ql-snow .ql-picker-options .ql-picker-item {
  color: #e2e8f0 !important;
  padding: 0.35rem 0.6rem !important;
  border-radius: 4px !important;
}
.ql-snow .ql-picker-options .ql-picker-item:hover {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.30) !important;
}
.ql-snow .ql-picker-options .ql-picker-item.ql-selected {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.18) !important;
}
/* El picker-label cuando está abierto: que se distinga sobre fondo oscuro */
.ql-snow .ql-picker.ql-expanded .ql-picker-label {
  color: #ffffff !important;
}
.ql-snow .ql-picker-item { color: var(--text-muted); }
.ql-snow .ql-color-picker .ql-picker-options {
  width: 168px;
}

/* Contenido del editor */
.ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4 {
  color: var(--text);
  margin: 1.2rem 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ql-editor h2 { font-size: 1.6rem; }
.ql-editor h3 { font-size: 1.3rem; }
.ql-editor h4 { font-size: 1.1rem; }
.ql-editor p { margin: 0 0 0.6rem; color: var(--text); }
.ql-editor strong { color: var(--text); font-weight: 700; }
.ql-editor a { color: var(--primary-light); text-decoration: underline; }
.ql-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 1rem 0;
}
.ql-editor blockquote {
  border-left: 3px solid var(--primary) !important;
  background: rgba(99, 102, 241, 0.08);
  padding: 0.7rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.8rem 0;
}
.ql-editor pre.ql-syntax {
  background: rgba(0, 0, 0, 0.45) !important;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
}
.ql-editor hr {
  border: none;
  border-top: 1px solid var(--border-strong);
  margin: 1.25rem 0;
}
.ql-editor table { border-collapse: collapse; width: 100%; margin: 0.8rem 0; }
.ql-editor table th, .ql-editor table td {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
}
.ql-editor table thead { background: rgba(99, 102, 241, 0.12); }
.ql-editor ul, .ql-editor ol { padding-left: 1.5rem; }
.ql-editor code {
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  color: #fcd34d;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Tooltip de inserción de enlace/imagen */
.ql-snow .ql-tooltip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
}
.ql-snow .ql-tooltip input[type=text] {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}
.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove { color: var(--primary-light); }

/* === Banner de capítulo (imagen) === */
.norm-banner-img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  object-position: center;
  border-bottom: 1px solid var(--border);
  margin: 0 !important;
  user-select: none;
  /* Oscurecido sutil + saturación para integrar con el tema oscuro */
  filter: brightness(0.75) saturate(1.1) contrast(1.05);
  transition: filter 0.3s ease;
}
.norm-section[open] .norm-banner-img:hover {
  filter: brightness(0.95) saturate(1.15) contrast(1.05);
}
@media (max-width: 600px) {
  .norm-banner-img { height: 100px; }
}
.norm-section > summary > h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.norm-section > summary > h2 .norm-chev {
  margin-left: auto;
  width: 11px;
  height: 11px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: rotate(45deg);
  transition: transform 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}
.norm-section > summary:hover > h2 .norm-chev { border-color: var(--text); }
.norm-section[open] > summary > h2 .norm-chev {
  transform: rotate(-135deg);
  border-color: var(--primary-light);
}
.norm-section > :not(summary) {
  /* Padding solo aplicable al contenido, no al summary */
}
.norm-section[open] > * + *:not(summary) { /* no aplica */ }
/* Padding del cuerpo: aplicamos margin lateral a los hijos directos que no sean summary */
.norm-section > h3,
.norm-section > p,
.norm-section > .norm,
.norm-section > .summary-wrap,
.norm-section > .portal-grid,
.norm-section > .notice,
.norm-section > .norm-subgroup {
  margin-left: 1.5rem;
  margin-right: 1.5rem;
}
.norm-section > :not(summary):first-of-type { margin-top: 1.25rem; }
.norm-section > :last-child { margin-bottom: 1.5rem; }

/* Agrupador visual de subsección: panel con cabecera <h3> + items que pertenecen.
   Cada subsección se renderiza como un panel claramente delimitado para que
   se vea sin ambigüedad qué items pertenecen a qué cabecera. */
.norm-section > .norm-subgroup {
  position: relative;
  padding: 1rem 1.1rem 0.7rem 1.5rem;
  margin-top: 1.6rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.norm-section > .norm-subgroup::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1rem;
  bottom: 1rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--primary), var(--accent-pink));
}
.norm-section > .norm-subgroup:first-of-type { margin-top: 1rem; }
.norm-section > .norm-subgroup > h3 {
  margin: 0 0 0.85rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.norm-section > .norm-subgroup > h3::before {
  /* anula el punto decorativo dentro del panel — la barra lateral ya marca el grupo */
  display: none;
}
.norm-section > .norm-subgroup > .norm {
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0.55rem;
}
.norm-section > .norm-subgroup > .norm:last-child {
  margin-bottom: 0;
}
.norm-section > .norm-subgroup > .portal-grid {
  margin: 0;
}
.norm-section h2 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.norm-section h2 .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  border-radius: 9px;
  font-size: 0.9rem;
  color: white;
  font-weight: 700;
  box-shadow: 0 6px 18px -6px var(--primary);
}
.norm-section h3 {
  font-size: 1.02rem;
  color: var(--text);
  margin: 1.65rem 0 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.norm-section h3::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-pink);
  margin-right: 0.55rem;
  vertical-align: middle;
}
.norm-intro { color: var(--text-muted); margin-bottom: 1.1rem; line-height: 1.65; }

.norm {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 0.6rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.norm:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.norm-body { min-width: 0; }
.norm-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
  letter-spacing: 0.005em;
}
.norm-title em {
  font-style: normal;
  color: var(--text-muted);
  font-weight: 400;
}
.norm-desc { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; }

/* Fila inferior: meta + fecha a la izquierda, botones a la derecha */
.norm-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.85rem 1rem;
  flex-wrap: wrap;
}
.norm-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 auto;
}
.norm-meta {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.norm-date {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.norm-date svg { opacity: 0.7; flex-shrink: 0; }

.norm-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.norm-link:hover { background: rgba(99, 102, 241, 0.28); border-color: rgba(99, 102, 241, 0.55); transform: translateY(-1px); }
.norm-link svg { width: 13px; height: 13px; }
.norm-link.dogc { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.norm-link.dogc:hover { background: rgba(245, 158, 11, 0.28); border-color: rgba(245, 158, 11, 0.55); }

/* Contenedor de acciones (botones Resumen + Descargar) en cada tarjeta de norma.
   Va dentro de .norm-footer y se alinea a la derecha; si no hay info al lado,
   margin-left:auto lo empuja contra el borde derecho igualmente. */
.norm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  flex-shrink: 0;
}

/* Botón "Resumen" — estilo distinto al enlace de descarga (verde-teal) */
.norm-resumen-btn {
  cursor: pointer;
  font-family: inherit;
  background: rgba(20, 184, 166, 0.14);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.32);
  -webkit-appearance: none;
  appearance: none;
}
.norm-resumen-btn:hover {
  background: rgba(20, 184, 166, 0.26);
  border-color: rgba(20, 184, 166, 0.55);
  transform: translateY(-1px);
}
.norm-resumen-btn:focus-visible {
  outline: 2px solid #5eead4;
  outline-offset: 2px;
}
.norm-resumen-btn svg { width: 13px; height: 13px; opacity: 0.95; }

/* Hide <template> just in case (algunos navegadores antiguos) */
.norm-resumen-tpl { display: none !important; }

@media (max-width: 600px) {
  /* En móvil, los botones bajan a su propia línea bajo la info */
  .norm-footer { flex-direction: column; align-items: stretch; }
  .norm-actions { justify-content: flex-start; margin-left: 0; }
}

/* ───── Modal de resumen de norma ───── */
.norm-modal {
  position: fixed; inset: 0;
  z-index: 9999;
  display: none;
  align-items: center; justify-content: center;
  padding: 1.25rem;
}
.norm-modal.is-open { display: flex; }
.norm-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 9, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: norm-modal-fade 0.18s ease-out;
}
.norm-modal-dialog {
  position: relative;
  width: min(820px, 100%);
  max-height: min(86vh, 900px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(99,102,241,0.10);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: norm-modal-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.norm-modal-head {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99,102,241,0.07), rgba(99,102,241,0));
}
.norm-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--text);
  font-weight: 700;
  flex: 1;
  letter-spacing: 0.005em;
}
.norm-modal-close {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.norm-modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--text);
}
.norm-modal-close:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
.norm-modal-body {
  padding: 1.4rem 1.5rem 1.6rem;
  overflow-y: auto;
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.65;
}
.norm-modal-body p { margin: 0 0 0.85rem; }
.norm-modal-body p:last-child { margin-bottom: 0; }
.norm-modal-body strong { color: var(--text); font-weight: 600; }
.norm-modal-body em { color: var(--text); font-style: italic; }
.norm-modal-body h3 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.02rem; font-weight: 700; color: var(--text);
  letter-spacing: 0.005em;
}
.norm-modal-body h4 {
  margin: 1.2rem 0 0.5rem;
  font-size: 0.94rem; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.norm-modal-body ul, .norm-modal-body ol {
  margin: 0 0 0.85rem; padding-left: 1.4rem;
}
.norm-modal-body li { margin-bottom: 0.3rem; }
.norm-modal-body a {
  color: var(--primary-light);
  text-decoration: underline;
  text-decoration-color: rgba(99,102,241,0.4);
  text-underline-offset: 2px;
}
.norm-modal-body a:hover { text-decoration-color: var(--primary-light); }
.norm-modal-body code {
  background: rgba(255,255,255,0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.norm-modal-body blockquote {
  margin: 0.85rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}

@keyframes norm-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes norm-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@media (max-width: 600px) {
  .norm-modal { padding: 0.5rem; }
  .norm-modal-dialog { max-height: 92vh; border-radius: 14px; }
  .norm-modal-head { padding: 0.9rem 1.1rem; }
  .norm-modal-head h2 { font-size: 1rem; }
  .norm-modal-body { padding: 1.1rem 1.2rem 1.3rem; font-size: 0.93rem; }
}

/* Aviso destacado */
.notice {
  display: flex; align-items: flex-start; gap: 0.9rem;
  padding: 1.15rem 1.3rem;
  background: rgba(99, 102, 241, 0.09);
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.94rem;
  line-height: 1.6;
}
.notice svg { width: 22px; height: 22px; color: var(--primary-light); flex-shrink: 0; margin-top: 1px; }
.notice strong { color: var(--text); }
.notice.tip { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.3); border-left-color: var(--accent-amber); }
.notice.tip svg { color: var(--accent-amber); }

/* Tabla resumen */
.summary-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.summary-table th, .summary-table td {
  padding: 0.75rem 0.95rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.summary-table thead { background: rgba(99, 102, 241, 0.12); }
.summary-table th {
  color: var(--text); font-weight: 700;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.summary-table tr:last-child td { border-bottom: none; }
.summary-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.summary-table .year { font-weight: 700; color: var(--primary-light); font-variant-numeric: tabular-nums; }
.summary-table a {
  color: var(--primary-light); text-decoration: none; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.summary-table a:hover { text-decoration: underline; }
/* Diferenciar visualmente las normas catalanas (DOGC) en la tabla resumen */
.summary-table a.dogc { color: #fcd34d; }
.summary-table a.dogc:hover { color: #fde68a; }

/* Portales oficiales */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.portal {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.25s;
}
.portal:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-3px); }
.portal-name { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.portal-tag {
  font-size: 0.66rem; padding: 0.2rem 0.5rem;
  background: rgba(99, 102, 241, 0.18); color: var(--primary-light);
  border-radius: 999px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.portal-tag.gc { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.portal-desc { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.portal-url { font-size: 0.78rem; color: var(--text-soft); margin-top: auto; padding-top: 0.5rem; word-break: break-all; }

/* === Panel de administración === */
.admin-login {
  max-width: 420px;
  margin: 5vh auto 0;
}
.admin-login .form-card { padding: 2.25rem 2rem; }
.admin-login h1 { font-size: 1.6rem; margin-bottom: 0.4rem; text-align: center; }
.admin-login .sub { color: var(--text-muted); text-align: center; margin-bottom: 1.75rem; font-size: 0.95rem; }

/* Navegación principal del panel (Mensajes / Noticias / Estadísticas) */
.admin-sections {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  margin-bottom: 1rem;
}
.admin-section {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.admin-section:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.admin-section svg { width: 18px; height: 18px; opacity: 0.85; }
.admin-section.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  box-shadow: 0 8px 22px -8px rgba(99, 102, 241, 0.55);
}
.admin-section.active svg { opacity: 1; }
.admin-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.5rem;
  background: rgba(244, 63, 94, 0.85);
  color: white;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.admin-section-badge.muted { background: rgba(255, 255, 255, 0.2); color: var(--text); }
.admin-section.active .admin-section-badge { background: rgba(255, 255, 255, 0.95); color: #4c1d95; }
.admin-section.active .admin-section-badge.muted { background: rgba(0, 0, 0, 0.25); color: white; }

@media (max-width: 600px) {
  .admin-section { padding: 0.55rem 0.85rem; font-size: 0.88rem; }
  .admin-section span { display: inline; }
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  margin-bottom: 1.5rem;
}
.admin-toolbar .stats {
  display: flex; gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  align-items: center;
}
.admin-toolbar .stats .badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
}
.admin-toolbar .stats .badge.unread {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.admin-toolbar form.search { flex: 1; min-width: 220px; display: flex; gap: 0.5rem; }
.admin-toolbar form.search input {
  flex: 1;
  padding: 0.6rem 0.95rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}
.admin-toolbar form.search input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

.admin-filters {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  position: relative;
  padding-left: 1rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--border);
}
@media (max-width: 700px) {
  .admin-filters {
    width: 100%;
    padding-left: 0;
    margin-left: 0;
    border-left: none;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
  }
}
.admin-filters a {
  padding: 0.4rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.84rem;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.admin-filters a:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.admin-filters a.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white; border-color: transparent;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-sm:hover { background: rgba(255,255,255,0.1); color: var(--text); border-color: var(--border-strong); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-sm.danger { color: #fda4af; border-color: rgba(244,63,94,0.3); }
.btn-sm.danger:hover { background: rgba(244,63,94,0.15); color: #fecdd3; border-color: rgba(244,63,94,0.5); }
.btn-sm.success { color: #5eead4; border-color: rgba(20,184,166,0.3); }
.btn-sm.success:hover { background: rgba(20,184,166,0.15); border-color: rgba(20,184,166,0.5); }
.btn-sm.is-featured { color: #fcd34d; border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.1); }
.btn-sm.is-featured:hover { color: #fef3c7; background: rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.65); }
.btn-sm.rss-link { color: #fdba74; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); cursor: pointer; }
.btn-sm.rss-link:hover { color: #fed7aa; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.6); }
.btn-sm.rss-link.is-success { color: #5eead4; border-color: rgba(20,184,166,0.5); background: rgba(20,184,166,0.15); }

/* Barra de búsqueda pública (noticias / normativa) */
.search-bar {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0 auto 1.25rem;
  max-width: 720px;
  flex-wrap: wrap;
}
.search-bar input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.search-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.search-bar input[type="search"]::placeholder { color: var(--text-soft); }
.search-bar .btn-sm { padding: 0.7rem 1rem; }

/* Chip de fecha en eventos (admin + página pública) */
.evento-date {
  flex-shrink: 0;
  width: 64px;
  text-align: center;
  padding: 0.55rem 0.4rem 0.45rem;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.28);
}
.evento-day   { font-size: 1.55rem; font-weight: 700; line-height: 1; color: var(--text); }
.evento-month { font-size: 0.7rem;  font-weight: 700; letter-spacing: 0.07em; color: var(--primary-light); margin-top: 0.15rem; }
.evento-year  { font-size: 0.68rem; color: var(--text-soft); margin-top: 0.1rem; }

.evento-tipo-convocatoria .evento-date { background: rgba(244, 63, 94, 0.10);  border-color: rgba(244, 63, 94, 0.30); }
.evento-tipo-convocatoria .evento-month { color: #fda4af; }
.evento-tipo-plazo        .evento-date { background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.30); }
.evento-tipo-plazo        .evento-month { color: #fcd34d; }
.evento-tipo-formacion    .evento-date { background: rgba(99, 102, 241, 0.10); border-color: rgba(99, 102, 241, 0.30); }
.evento-tipo-jornada      .evento-date { background: rgba(20, 184, 166, 0.10); border-color: rgba(20, 184, 166, 0.30); }
.evento-tipo-jornada      .evento-month { color: #5eead4; }

/* Widget de "próximos eventos" en el inicio (index.php) */
.upcoming {
  max-width: 1140px;
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
}
.upcoming-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}
.upcoming-head h2 {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  display: inline-flex; align-items: center; gap: 0.55rem; margin: 0;
}
.upcoming-head h2 svg { color: var(--primary-light); }
.upcoming-all {
  font-size: 0.88rem; color: var(--primary-light);
  text-decoration: none; font-weight: 600;
}
.upcoming-all:hover { text-decoration: underline; }
.upcoming-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}
.upcoming-item {
  display: flex; gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.upcoming-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.upcoming-item.is-important { border-color: rgba(244, 63, 94, 0.35); }
.upcoming-item .evento-date { width: 56px; padding: 0.4rem 0.3rem; }
.upcoming-item .evento-day  { font-size: 1.35rem; }
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-tipo {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--text-soft); text-transform: uppercase; margin-bottom: 0.3rem;
}
.upcoming-body h3 {
  font-size: 0.95rem; font-weight: 600; color: var(--text); margin: 0;
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Vista de extracción de fechas de un PDF (admin → evento_extract) */
.extract-form .extract-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
}
.extract-form .extract-row:has(input[name="c[]"]:checked) {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.07);
}

.extract-check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding-top: 0.2rem;
}
.extract-check input { position: absolute; opacity: 0; pointer-events: none; }
.extract-check span {
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04);
  transition: border-color 0.2s, background 0.2s;
}
.extract-check input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
}
.extract-check input:checked + span::after {
  content: '✓';
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

.extract-meta { flex: 1; min-width: 0; }
.extract-fecha {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.extract-fecha strong { color: var(--text); font-size: 1rem; }
.extract-fecha small { color: var(--text-soft); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.extract-context {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.55;
  padding: 0.5rem 0.7rem;
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
  margin-bottom: 0.7rem;
}

.extract-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0.6rem;
}
.extract-fields > .extract-full { grid-column: 1 / -1; }
.extract-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
}
.extract-fields label > span { padding-left: 0.15rem; }
.extract-fields input[type="text"],
.extract-fields textarea,
.extract-fields select {
  padding: 0.55rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  width: 100%;
}
.extract-fields textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-muted);
}
.extract-fields .check-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-end;
  padding: 0.55rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.extract-fields .check-inline input { width: 16px; height: 16px; }
@media (max-width: 700px) {
  .extract-fields { grid-template-columns: 1fr 1fr; }
}

/* Calendario público (calendario.php) */
.calendar-month {
  margin-bottom: 2.5rem;
}
.calendar-month-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.calendar-month .evento-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 0.7rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.calendar-month .evento-row:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.calendar-month .evento-row.is-important {
  border-color: rgba(244, 63, 94, 0.40);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.05) 0%, var(--surface) 100%);
}
.calendar-month .evento-row.is-past {
  opacity: 0.55;
}
.calendar-month .evento-body { flex: 1; min-width: 0; }
.calendar-month .evento-body h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.35rem;
  line-height: 1.4;
}
.calendar-month .evento-body h3 a { color: var(--text); text-decoration: none; }
.calendar-month .evento-body h3 a:hover { color: var(--primary-light); }
.calendar-month .evento-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.45rem;
}
.calendar-month .evento-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.55rem;
}

/* ───── Barra de compartir (en /noticia.php) ───── */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 2rem 0 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.share-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  margin-right: 0.4rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.share-btn:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 8px 20px -6px rgba(0,0,0,0.25); }
.share-btn svg { flex-shrink: 0; }

/* ── Colores de marca POR DEFECTO (siempre visibles, no solo hover) ── */
.share-whatsapp {
  background: #25D366; border-color: #25D366; color: #ffffff;
}
.share-whatsapp:hover { background: #1ebe5b; border-color: #1ebe5b; color: #ffffff; }

.share-linkedin {
  background: #0A66C2; border-color: #0A66C2; color: #ffffff;
}
.share-linkedin:hover { background: #094f99; border-color: #094f99; color: #ffffff; }

.share-x {
  background: #000000; border-color: #000000; color: #ffffff;
}
.share-x:hover { background: #1f1f1f; border-color: #1f1f1f; color: #ffffff; }

.share-mail {
  background: #f59e0b; border-color: #f59e0b; color: #ffffff;
}
.share-mail:hover { background: #d97e07; border-color: #d97e07; color: #ffffff; }

.share-copy {
  background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; color: #ffffff;
}
.share-copy:hover { filter: brightness(1.1); color: #ffffff; }
.share-copy.is-success {
  background: linear-gradient(135deg, #14b8a6, #06b6d4) !important;
  color: #ffffff !important;
}

.share-print {
  background: #475569; border-color: #475569; color: #ffffff;
}
.share-print:hover { background: #334155; border-color: #334155; color: #ffffff; }
.share-print:hover     { background: rgba(244,63,94,0.12);   border-color: rgba(244,63,94,0.5);    color: #fda4af; }

@media (max-width: 600px) {
  .share-btn span { display: none; }      /* en móvil sólo iconos */
  .share-bar { gap: 0.4rem; padding: 0.8rem 1rem; }
  .share-label { display: none; }
}

/* ───── Admin Newsletter · Estadísticas de bajas ──────────────────────── */
.bajas-bars {
  display: grid;
  gap: 0.55rem;
}
.bajas-bar {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr auto;
  gap: 0.85rem;
  align-items: center;
}
.bajas-bar-label {
  font-size: 0.88rem;
  color: var(--text, #f5f6fc);
}
.bajas-bar-track {
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 7px;
  overflow: hidden;
}
.bajas-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #6366f1), var(--accent-pink, #ec4899));
  border-radius: 7px;
  transition: width .3s ease;
}
.bajas-bar.is-warn .bajas-bar-fill {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.bajas-bar.is-bad .bajas-bar-fill {
  background: linear-gradient(90deg, #ef4444, #f43f5e);
}
.bajas-bar-count {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.bajas-bar-count strong { color: var(--text, #f5f6fc); margin-right: 0.2rem; }

@media (max-width: 600px) {
  .bajas-bar {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .bajas-bar-count { text-align: left; }
}

.bajas-comments {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.bajas-comments li {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(99, 102, 241, 0.4);
  padding: 0.7rem 0.9rem;
  border-radius: 0 8px 8px 0;
}
.bajas-comment-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  margin-bottom: 0.35rem;
}
.bajas-comment-text {
  margin: 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text, #f5f6fc);
  line-height: 1.5;
}

/* ───── Admin Seguridad · Lista de IPs baneadas (fail2ban) ──────────── */
.f2b-banned-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.f2b-banned-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.85rem;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 8px;
}
.f2b-banned-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  color: #fda4af;
  background: transparent;
  padding: 0;
}

/* ───── Mensajes de resultado en /privacidad.php ─────────────────────── */
.privacy-result {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  padding: 2rem 1.8rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.privacy-result-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}
.privacy-result-icon svg { width: 32px; height: 32px; }

.privacy-result-success {
  background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(20,184,166,0.06));
  border-color: rgba(34, 197, 94, 0.4);
}
.privacy-result-success .privacy-result-icon {
  background: rgba(34, 197, 94, 0.18);
  color: #5eead4;
}

.privacy-result-info {
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(244,114,182,0.06));
  border-color: rgba(99, 102, 241, 0.4);
}
.privacy-result-info .privacy-result-icon {
  background: rgba(99, 102, 241, 0.20);
  color: #a5b4fc;
}

.privacy-result-error {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.4);
}
.privacy-result-error .privacy-result-icon {
  background: rgba(244, 63, 94, 0.18);
  color: #fda4af;
}

.privacy-result-body { flex: 1; min-width: 0; }
.privacy-result-body h2 {
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
  color: var(--text, #f5f6fc);
  letter-spacing: -0.01em;
}
.privacy-result-text {
  color: var(--text-soft, #cbd5e1);
  font-size: 1rem;
  line-height: 1.55;
}
.privacy-result-text strong {
  color: var(--text, #f5f6fc);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.95em;
}
.privacy-result-text ul {
  margin: 0.6rem 0 0;
  padding-left: 1.4rem;
}
.privacy-result-text ul li { margin: 0.3rem 0; }
.privacy-result-text code {
  background: rgba(255, 255, 255, 0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.92em;
}

@media (max-width: 600px) {
  .privacy-result { flex-direction: column; padding: 1.4rem 1.2rem; gap: 0.85rem; }
  .privacy-result-icon { width: 48px; height: 48px; }
  .privacy-result-body h2 { font-size: 1.2rem; }
}

/* ───── Callout RGPD en politicas.html ──────────────────────────────── */
.rgpd-callout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(244,114,182,0.06));
  border: 1px solid rgba(99,102,241,0.32);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0 2rem;
}
.rgpd-callout-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99,102,241,0.18);
  border-radius: 10px;
}
.rgpd-callout-icon svg {
  width: 22px;
  height: 22px;
  color: var(--primary, #818cf8);
}
.rgpd-callout-body { flex: 1; min-width: 0; }
.rgpd-callout-body strong {
  display: block;
  color: var(--text, #f5f6fc);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.rgpd-callout-body p {
  color: var(--text-soft, #a8aabd);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 0.85rem;
}
.rgpd-callout-body .btn {
  font-size: 0.92rem;
  padding: 0.65rem 1.2rem;
}
@media (max-width: 600px) {
  .rgpd-callout { flex-direction: column; }
  .rgpd-callout-icon { width: 36px; height: 36px; }
}

/* ───── Newsletter — bloque de captura en el footer del index ──────────── */
.newsletter-cta {
  max-width: 920px;
  margin: 3rem auto 1.5rem;
  padding: 1.4rem 1.6rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(244,114,182,0.06));
  border: 1px solid rgba(99,102,241,0.32);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.newsletter-cta-text {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-soft, #a8aabd);
  font-size: 0.92rem;
  flex: 1 1 280px;
}
.newsletter-cta-text svg {
  color: var(--primary, #818cf8);
  flex-shrink: 0;
}
.newsletter-cta-text strong {
  display: block;
  color: var(--text, #f5f6fc);
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}
.newsletter-cta-text span {
  display: block;
  font-size: 0.85rem;
}
.newsletter-cta-form {
  display: flex;
  gap: 0.5rem;
  flex: 1 1 320px;
  min-width: 240px;
  max-width: 460px;
}
.newsletter-cta-form input[type="email"] {
  flex: 1;
  padding: 0.7rem 0.95rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: var(--text, #f5f6fc);
  font-size: 0.95rem;
}
.newsletter-cta-form input:focus {
  outline: none;
  border-color: var(--primary, #6366f1);
  background: rgba(255,255,255,0.07);
}

/* ───── Admin · Vista previa en redes sociales ───────────────────────── */
.og-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.og-modal[hidden] { display: none; }

.og-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.og-modal-box {
  position: relative;
  background: var(--bg-1, #0b1024);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.7);
}
.og-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.og-modal-header h3 { margin: 0; font-size: 1.15rem; }
.og-modal-close {
  background: transparent;
  border: none;
  color: var(--text-soft, #a8aabd);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.3rem;
}
.og-modal-close:hover { color: var(--text, #f5f6fc); }
.og-modal-help {
  color: var(--text-soft, #a8aabd);
  font-size: 0.88rem;
  margin: 0 0 1.2rem;
}

.og-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}
.og-card-label {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.og-card-preview {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.og-card-preview .og-img {
  width: 100%;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}
.og-card-preview .og-card-body { padding: 0.7rem 0.85rem; }
.og-card-preview .og-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.og-card-preview .og-card-desc {
  color: #555;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.og-card-preview .og-card-domain {
  color: #888;
  font-size: 0.72rem;
  text-transform: lowercase;
}

/* WhatsApp: card más compacta, fondo verde claro */
.og-card-preview.wa { border: none; box-shadow: 0 1px 2px rgba(0,0,0,0.1); background: #fff; }

/* Twitter: dominio arriba, sin indicador grande */
.og-card-preview.tw .og-card-domain { margin-bottom: 0.3rem; }

/* LinkedIn: dominio en mayúsculas, debajo del título */
.og-card-preview.li .og-card-domain { text-transform: uppercase; font-weight: 600; color: #666; }

@media (max-width: 600px) {
  .og-modal-box { padding: 1rem; }
  .og-cards { grid-template-columns: 1fr; }
}

/* ───── Admin · Bulk actions ─────────────────────────────────────────── */
/* Checkboxes en cada item: pequeños, alineados, no estorban el click */
.bulk-cb {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary, #6366f1);
  flex-shrink: 0;
  margin: 0;
}
.msg-list[data-bulk-list] .bulk-cb {
  margin-right: 0.4rem;
}

/* Barra flotante en la parte inferior */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(15, 14, 46, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 14px;
  box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
  justify-content: center;
  animation: bulkBarSlide 0.18s ease-out;
}
@keyframes bulkBarSlide {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.bulk-bar[hidden] { display: none; }

.bulk-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text, #f5f6fc);
  font-size: 0.92rem;
  padding-right: 0.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
.bulk-bar-info strong { color: var(--primary, #818cf8); font-size: 1.05rem; }
.bulk-clear {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-soft, #a8aabd);
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bulk-clear:hover {
  border-color: rgba(244, 63, 94, 0.5);
  color: #fda4af;
}

.bulk-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.bulk-actions-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.bulk-actions-group[hidden] { display: none; }

@media (max-width: 600px) {
  .bulk-bar {
    bottom: 12px;
    padding: 0.6rem 0.8rem;
    gap: 0.5rem;
  }
  .bulk-bar-info { font-size: 0.85rem; padding-right: 0.3rem; }
  .bulk-bar-actions .btn-sm { font-size: 0.78rem; padding: 0.35rem 0.6rem; }
}

/* ───── Admin · Dashboard de inicio ──────────────────────────────────── */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.dash-kpi {
  display: block;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: background .15s, border-color .15s, transform .15s;
}
.dash-kpi:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}
.dash-kpi.is-warn {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.32);
}
.dash-kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft, #a8aabd);
}
.dash-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.2rem 0 0.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--text, #f5f6fc);
}
.dash-kpi.is-warn .dash-kpi-value { color: #fda4af; }
.dash-kpi-sub {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
}

/* ─────── @media print: estilos para imprimir ───────
   Cuando alguien imprime una noticia, normativa o cualquier página,
   queremos un resultado limpio: solo título + contenido, sin menús,
   sidebars, botones de compartir, comentarios, etc. */
@media print {
  /* Fondo blanco, texto negro siempre */
  *, *::before, *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  body { font-size: 12pt; line-height: 1.5; }

  /* Ocultar: blobs decorativos, navegación, footer, búsqueda, botones de
     compartir, comentarios, banners de cookies, sidebars... */
  .blob, nav.topnav, .topnav, footer, .hero-search, .search-bar,
  .share-bar, .news-lecturas-tag, .comentarios-bloque, .breadcrumb,
  .admin-sidebar, .dash-actions, .pagination, .alert,
  .no-print, [aria-hidden="true"] { display: none !important; }

  /* Enlaces: que se vea la URL al imprimir (excepto si es relativo o anchor) */
  a[href]:not([href^="#"]):not([href^="/"])::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555 !important;
  }

  /* Imágenes: no rebanar y no más anchas que el papel */
  img, figure { page-break-inside: avoid; max-width: 100% !important; height: auto !important; }

  /* Tablas: que no se corten entre filas */
  tr, td, th { page-break-inside: avoid; }

  /* Títulos: no quedar huérfanos al final de página */
  h1, h2, h3, h4 { page-break-after: avoid; }

  /* Quitar bordes redondeados (papel = ángulos rectos) */
  .card, .article-card, .normativa-item, .form-card {
    border-radius: 0 !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  /* Asegurar que el contenido principal use el ancho completo */
  main, article, .news-article { max-width: 100% !important; }
}

/* ─────── Typeahead autocomplete para la búsqueda global ───────
   Activado por assets/js/search-autocomplete.js sobre cualquier
   <form action="buscar.php"> con un <input name="q">. */
.sac-wrap {
  position: relative;
  display: contents;  /* el wrap es transparente para el layout del padre */
}
.sac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.3rem 0 0;
  padding: 0.25rem;
  list-style: none;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  box-shadow: 0 24px 48px -16px rgba(0,0,0,0.6);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 1000;
}
.sac-item { margin: 0; padding: 0; }
.sac-item a {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "tipo titulo" "tipo meta";
  align-items: center;
  gap: 0.25rem 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  color: var(--text, #f5f6fc);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.3;
}
.sac-item:hover a,
.sac-item.sac-highlight a { background: rgba(99,102,241,0.18); }
.sac-tipo {
  grid-area: tipo;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: rgba(99,102,241,0.18);
  color: #c7d2fe;
  white-space: nowrap;
}
.sac-tipo-noticia     { background: rgba(99,102,241,0.18);  color: #c7d2fe; }
.sac-tipo-normativa   { background: rgba(20,184,166,0.18);  color: #5eead4; }
.sac-tipo-evento      { background: rgba(245,158,11,0.18);  color: #fcd34d; }
.sac-tipo-glosario    { background: rgba(168,85,247,0.18);  color: #e9d5ff; }
.sac-tipo-certificado { background: rgba(244,114,182,0.18); color: #fbcfe8; }
.sac-titulo { grid-area: titulo; font-weight: 500; }
.sac-titulo mark { background: rgba(252,211,77,0.3); color: #fef3c7; padding: 0 2px; border-radius: 3px; }
.sac-meta {
  grid-area: meta;
  font-size: 0.75rem;
  color: var(--text-soft, #a8aabd);
}
.sac-empty {
  padding: 0.8rem 0.9rem;
  color: var(--text-soft, #a8aabd);
  font-size: 0.88rem;
  text-align: center;
}

.dash-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.dash-actions svg { vertical-align: -2px; margin-right: 0.15rem; }

/* Botones "crear" (los 4 primeros): tono índigo para diferenciarlos
   visualmente de los 2 botones "ver" (.btn-ghost), manteniendo el
   mismo tamaño. */
.dash-actions .btn-sm:not(.btn-ghost) {
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
}
.dash-actions .btn-sm:not(.btn-ghost):hover {
  color: #e0e7ff;
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.22);
}
.dash-actions .btn-sm:not(.btn-ghost) svg { color: #a5b4fc; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.dash-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.5rem;
}
.dash-card-head h3 {
  font-size: 0.95rem;
  margin: 0;
  font-weight: 600;
  color: var(--text, #f5f6fc);
}
.dash-card-more {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  text-decoration: none;
}
.dash-card-more:hover { color: var(--text, #f5f6fc); }
.dash-empty {
  margin: 0.6rem 0;
  color: var(--text-soft, #a8aabd);
  font-size: 0.88rem;
}
.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.dash-list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.6rem;
  align-items: start;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.86rem;
}
.dash-list li:hover { background: rgba(255, 255, 255, 0.03); }
.dash-list li.is-unread { background: rgba(99, 102, 241, 0.08); }
.dash-list-date {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}
.dash-list-body { min-width: 0; }
.dash-list-title {
  display: block;
  color: var(--text, #f5f6fc);
  line-height: 1.35;
  word-break: break-word;
}
.dash-list-meta {
  display: block;
  font-size: 0.76rem;
  color: var(--text-soft, #a8aabd);
  margin-top: 0.15rem;
  text-decoration: none;
}
.dash-list-meta:hover { color: var(--primary, #818cf8); }
.dash-list-edit {
  font-size: 0.95rem;
  color: var(--text-soft, #a8aabd);
  text-decoration: none;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.dash-list-edit:hover {
  color: var(--text, #f5f6fc);
  background: rgba(255, 255, 255, 0.06);
}

/* ───── Editor de noticias: barra extra (plantillas, separador, stats) ─── */
.editor-extra-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}
.editor-extra-bar .btn-sm svg {
  width: 14px !important;
  height: 14px !important;
  vertical-align: -2px;
  margin-right: 0.2rem;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
 *   Quill 2.x — fix MÍNIMO.
 *
 *   El reset universal `* { padding: 0 }` (línea 28 de este fichero) anula
 *   el padding que Quill aplica a sus botones y picker-labels, y se quedan
 *   del tamaño del SVG → enormes. Lo único que hacemos aquí es restaurar
 *   ese padding y el ancho del botón. NO tocamos pickers, ni dropdowns, ni
 *   estilos de SVG: Quill ya los gestiona y cualquier override los rompe.
 * ───────────────────────────────────────────────────────────────────────── */
.ql-toolbar button,
.ql-toolbar.ql-snow button {
  padding: 3px 5px !important;
  width: 28px !important;
  height: 24px !important;
}
.ql-toolbar .ql-picker-label,
.ql-toolbar.ql-snow .ql-picker-label {
  padding: 2px 4px !important;
}
.ql-toolbar .ql-picker-item,
.ql-toolbar.ql-snow .ql-picker-item {
  padding: 2px 6px !important;
}

/* Área de edición — altura sensata, no múltiples páginas. */
.ql-editor {
  min-height: 320px !important;
  max-height: 65vh !important;
  overflow-y: auto !important;
  padding: 14px 18px !important;
  line-height: 1.55 !important;
}

/* Estado activo (B/I/U cuando la selección está en formato) — ajuste sutil
   en lugar del azul fuerte default que choca con el tema oscuro alrededor. */
.ql-toolbar .ql-active,
.ql-toolbar.ql-snow .ql-active {
  background: rgba(99, 102, 241, 0.15) !important;
  border-radius: 4px !important;
}

/* El menú de plantillas usa display:flex en su estado abierto.
   Cuando tiene el atributo `hidden`, debe ocultarse SIEMPRE. */
.editor-template-menu[hidden] { display: none !important; }

.editor-template-wrap { position: relative; }
.editor-template-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  background: rgba(15, 14, 46, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.6);
}
.editor-template-menu button {
  text-align: left;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: none;
  color: var(--text, #f5f6fc);
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}
.editor-template-menu button:hover {
  background: rgba(99, 102, 241, 0.18);
}

.editor-stats {
  margin-left: auto;
  color: var(--text-soft, #a8aabd);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.editor-stats strong { color: var(--text, #f5f6fc); font-weight: 600; }

/* ───── Cuadro de búsqueda en el hero del index ────────────────────────── */
.hero-search {
  display: flex;
  gap: 0.4rem;
  max-width: 520px;
  margin: 1.6rem auto 0;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  transition: border-color .15s, background .15s;
}
.hero-search:focus-within {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(255, 255, 255, 0.08);
}
.hero-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text, #f5f6fc);
  font-size: 0.95rem;
  padding: 0.55rem 0;
}
.hero-search input::placeholder { color: rgba(255, 255, 255, 0.4); }
.hero-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary, #6366f1), var(--accent-pink, #ec4899));
  color: white;
  cursor: pointer;
  transition: transform .15s;
}
.hero-search button:hover { transform: scale(1.05); }

/* ───── Buscador global (/buscar.php) ──────────────────────────────────── */
.search-form {
  display: flex;
  gap: 0.6rem;
  margin: 0 auto 1.4rem;
  max-width: 720px;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #f5f6fc);
}
.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--primary, #6366f1);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}
.search-summary {
  margin: 0 auto 1.5rem;
  padding: 0.6rem 0;
  color: var(--text-soft, #a8aabd);
  font-size: 0.92rem;
}
.search-counts {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: 0.6rem;
}
.search-count {
  font-size: 0.82rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-soft, #a8aabd);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.search-count:hover { color: var(--text, #f5f6fc); border-color: rgba(255,255,255,0.28); }
.search-count.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}

.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.search-result {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: background .15s, border-color .15s, transform .15s;
}
.search-result:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}
.search-result-link {
  display: flex;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  text-decoration: none;
  color: inherit;
  align-items: flex-start;
}
.search-result-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.12);
}
.search-result-icon svg { width: 18px; height: 18px; color: var(--primary, #818cf8); }
.search-result-noticia .search-result-icon  { background: rgba(99, 102, 241, 0.12); }
.search-result-normativa .search-result-icon{ background: rgba(245, 158, 11, 0.14); }
.search-result-normativa .search-result-icon svg { color: #fcd34d; }
.search-result-evento .search-result-icon   { background: rgba(20, 184, 166, 0.14); }
.search-result-evento .search-result-icon svg { color: #5eead4; }
.search-result-glosario .search-result-icon { background: rgba(244, 114, 182, 0.14); }
.search-result-glosario .search-result-icon svg { color: #f9a8d4; }

.search-result-body { flex: 1; min-width: 0; }
.search-result-meta {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.search-result-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text, #f5f6fc);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.search-result-excerpt {
  font-size: 0.88rem;
  color: var(--text-soft, #a8aabd);
  line-height: 1.5;
}
.search-result mark {
  background: rgba(245, 158, 11, 0.32);
  color: #fde68a;
  padding: 0 2px;
  border-radius: 2px;
}
.search-tips {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  color: var(--text-soft, #a8aabd);
}
.search-tips ul { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.search-tips li { margin: 0.3rem 0; }

/* ───── Calendario · bloque de suscripción .ics ──────────────────────── */
.cal-subscribe {
  max-width: 740px;
  margin: 0 auto 2rem;
  padding: 1rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  font-size: 0.92rem;
}
.cal-subscribe-text {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 320px;
  color: var(--text-soft, #a8aabd);
}
.cal-subscribe-text svg {
  width: 22px; height: 22px;
  color: var(--primary, #6366f1);
  flex-shrink: 0;
}
.cal-subscribe-text strong { color: var(--text, #f5f6fc); }
.cal-subscribe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.cal-subscribe-help summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
  padding: 0.35rem 0.7rem;
  user-select: none;
}
.cal-subscribe-help summary:hover { color: var(--text, #f5f6fc); }
.cal-subscribe-help[open] {
  flex-basis: 100%;
  margin-top: 0.4rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  font-size: 0.85rem;
}
.cal-subscribe-help ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.cal-subscribe-help li { margin: 0.3rem 0; line-height: 1.5; }
.cal-subscribe-help code {
  font-size: 0.78rem;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* ───── Vista de historial de accesos al panel ──────────────────────
   Lista compacta tipo log: cuándo · evento · IP/ubicación · UA. */
.admin-log-list {
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
}
.admin-log-row {
  display: grid;
  grid-template-columns: 130px minmax(150px, 1fr) minmax(180px, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}
.admin-log-row:hover { background: rgba(255, 255, 255, 0.045); }
.admin-log-when {
  font-size: 0.82rem;
  color: var(--text-soft, #a8aabd);
  font-variant-numeric: tabular-nums;
}
.admin-log-evt { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.admin-log-det {
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-soft, #a8aabd);
  padding: 0.1rem 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}
.admin-log-ip code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text, #f5f6fc);
  padding: 0;
}
.admin-log-loc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
}
.admin-log-ua {
  font-size: 0.78rem;
  color: var(--text-soft, #a8aabd);
}
.admin-log-ua summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.admin-log-ua summary::-webkit-details-marker { display: none; }
.admin-log-ua[open] summary { background: rgba(255, 255, 255, 0.1); }
.admin-log-ua code {
  display: block;
  margin-top: 0.4rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  word-break: break-all;
  font-size: 0.74rem;
  line-height: 1.4;
}

/* Pills para los tipos de evento */
.pill.pill-ok   { background: rgba(34,197,94,0.15);  border-color: rgba(34,197,94,0.4);  color: #86efac; }
.pill.pill-bad  { background: rgba(244,63,94,0.18);  border-color: rgba(244,63,94,0.4);  color: #fda4af; }
.pill.pill-warn { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.4); color: #fcd34d; }
.pill.pill-mut  { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: var(--text-soft, #a8aabd); }

@media (max-width: 720px) {
  .admin-log-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .admin-log-when { font-size: 0.78rem; }
}

/* ───── Vista de Seguridad / 2FA en el panel ─────
   Setup wizard (con QR) + gestión (regenerar códigos / desactivar). */
.twofa-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}
.twofa-steps > li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  font-size: 0.92rem;
  line-height: 1.55;
}
.twofa-steps > li strong { color: var(--text, #f5f6fc); }

/* Fila con QR + fallback de secreto manual */
.twofa-qr-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-top: 0.75rem;
}
.twofa-qr {
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem;
  width: 208px;
  height: 208px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px -6px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.twofa-qr img,
.twofa-qr canvas { display: block; }
.twofa-qr-fallback {
  font-size: 0.85rem;
  color: var(--text-soft, #a8aabd);
  min-width: 0;
}
.twofa-qr-fallback p { margin: 0 0 0.5rem; }
.twofa-secret {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  padding: 0.55rem 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  color: var(--text, #f5f6fc);
  user-select: all;
  word-break: break-all;
  line-height: 1.4;
}

/* Input + botón en línea para verificar / desactivar */
.twofa-verify-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.twofa-code-input {
  flex: 1 1 200px;
  min-width: 0;
  text-align: center;
  letter-spacing: 0.25em;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Lista de backup codes — grid 2×4 con códigos en monospace */
.twofa-backup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}
.twofa-backup-list li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.85rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  color: #fde68a;
  user-select: all;
  text-align: center;
}
.twofa-backup-list code {
  font: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
}

@media (max-width: 640px) {
  .twofa-qr-row { grid-template-columns: 1fr; }
  .twofa-qr { margin: 0 auto; }
  .twofa-backup-list { grid-template-columns: 1fr; }
}

/* Versión imprimible: si el admin imprime sus códigos de respaldo,
   sólo se ve el bloque de códigos, en negro sobre blanco. */
@media print {
  .twofa-codes,
  .twofa-codes * { color: #000 !important; }
  .twofa-codes { border: 2px solid #000 !important; }
  .twofa-backup-list li {
    background: #fff !important;
    border-color: #000 !important;
    color: #000 !important;
  }
}

/* ───── Versión imprimible — oculta UI, deja sólo contenido ───── */
@media print {
  /* Reset general — fondo blanco, tinta negra, sin sombras ni gradientes */
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.5;
  }
  .blob, .blob-1, .blob-2, .blob-3,
  .topnav, footer,
  .share-bar, .share-btn,
  .cookie-banner,
  .upcoming, .grid,
  .admin-toolbar, .admin-filters, .admin-sections,
  .pager, .news-grid,
  .toc, .norm-banner-img,
  form.search-bar,
  .no-print {
    display: none !important;
  }
  /* Color de marca y enlaces en negro, mostrar URL al lado */
  a, a:visited {
    color: #000 !important;
    text-decoration: underline;
  }
  a[href^="http"]:not(.no-print)::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
  /* Tooltips del glosario sin estilo extra al imprimir */
  abbr.gloss { text-decoration: none !important; cursor: default !important; }
  abbr.gloss::before, abbr.gloss::after { display: none !important; }

  /* Saltos de página inteligentes */
  h1, h2, h3 { page-break-after: avoid; break-after: avoid; }
  .news-article, .norm-section, article { page-break-inside: avoid; break-inside: avoid; }
  img { max-width: 100% !important; height: auto !important; page-break-inside: avoid; }

  /* Cabecera de imprimible: añadimos URL del sitio en el footer del navegador
     vía el propio sistema, no aquí. Aquí solo aseguramos que el body es legible. */
  main { max-width: 100% !important; padding: 0 !important; }
  .page, .page-header { max-width: 100% !important; padding: 0 !important; }

  /* Asegurar que las cards de normativa salen completas */
  .norm, .norm-section[open] { page-break-inside: avoid; break-inside: avoid; }
  details.norm-section { display: block; }
  details.norm-section:not([open]) { display: block; }
  details.norm-section:not([open]) > *:not(summary) { display: block; }

  /* Hero en noticias: foto de portada se imprime aunque sea grande */
  .news-hero-image img { max-height: 12cm; object-fit: cover; }

  /* Pequeños retoques tipográficos */
  .news-content p, .norm-desc, .news-summary { color: #222 !important; }
  .news-content h2 { font-size: 14pt; margin-top: 1.5em; }
  .news-content h3 { font-size: 12pt; margin-top: 1.2em; }
  code, pre { background: #f5f5f5 !important; color: #333 !important; border: 1px solid #ddd; }
}

/* ───── Glosario: tooltips automáticos en cualquier texto ─────
   Los términos del diccionario se envuelven en <abbr class="gloss" title="…">.
   Un pequeño JS en main.js convierte `title` → `data-tooltip` al cargar la
   página, así sólo se muestra NUESTRO tooltip estilizado (no el nativo del
   navegador, que es lento y feo). */
abbr.gloss {
  position: relative;
  text-decoration: underline dotted;
  text-decoration-color: rgba(99, 102, 241, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
  border-bottom: none;
}
abbr.gloss:hover,
abbr.gloss:focus {
  text-decoration-color: var(--primary, #6366f1);
  background: rgba(99, 102, 241, 0.08);
  border-radius: 3px;
  outline: none;
}

/* Tooltip propio (CSS-only, instantáneo, estilizado a la marca). */
abbr.gloss[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);

  /* Anchura razonable */
  width: max-content;
  max-width: 320px;
  padding: 0.7rem 0.9rem;

  /* Aspecto de tarjeta oscura con acento violeta */
  background: rgba(15, 14, 46, 0.97);
  color: var(--text, #f5f6fc);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 10px;
  box-shadow: 0 14px 32px -10px rgba(0, 0, 0, 0.6);

  /* Texto legible */
  font-size: 0.82rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: break-word;

  /* Aparece y desaparece de forma instantánea (sin animación) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100;
}

/* Flechita debajo del tooltip apuntando al término. */
abbr.gloss[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(99, 102, 241, 0.45);

  opacity: 0;
  visibility: hidden;
  z-index: 100;
}

abbr.gloss[data-tooltip]:hover::after,
abbr.gloss[data-tooltip]:hover::before,
abbr.gloss[data-tooltip]:focus::after,
abbr.gloss[data-tooltip]:focus::before {
  opacity: 1;
  visibility: visible;
}

/* Si el término está cerca del borde derecho, ajusta el origen del tooltip
   para que no se salga de la página. */
@media (max-width: 600px) {
  abbr.gloss[data-tooltip]::after { max-width: 240px; }
}

/* ───── Página pública /glosario.php ───── */
.gloss-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin: 1.5rem 0 2.5rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.gloss-index a {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.gloss-index a:hover {
  background: rgba(99, 102, 241, 0.14);
  color: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.5);
}

/* ───── Certificados de profesionalidad ─────────────────────────────── */
.cert-familias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.cert-familia-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  padding-right: 4.25rem; /* hueco para el icono superior derecho */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.cert-familia-card:hover {
  border-color: var(--primary-light);
  background: rgba(99, 102, 241, 0.05);
  transform: translateY(-2px);
}

/* Icono de familia: color y fondo personalizados por código (data-fam) */
.cert-familia-icono {
  --fc: var(--primary-light);
  --fb: rgba(99, 102, 241, 0.13);
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fc);
  background: var(--fb);
  border-radius: 12px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.cert-familia-icono svg {
  width: 28px;
  height: 28px;
}
.cert-familia-card:hover .cert-familia-icono {
  background: var(--fc);
  color: #0f172a;
  transform: scale(1.05);
}

/* Paleta de colores por familia profesional */
.cert-familia-card[data-fam="AFD"] .cert-familia-icono { --fc: #fb7185; --fb: rgba(251,113,133,0.18); }
.cert-familia-card[data-fam="ADG"] .cert-familia-icono { --fc: #60a5fa; --fb: rgba(96,165,250,0.18); }
.cert-familia-card[data-fam="AGA"] .cert-familia-icono { --fc: #4ade80; --fb: rgba(74,222,128,0.18); }
.cert-familia-card[data-fam="ARG"] .cert-familia-icono { --fc: #e879f9; --fb: rgba(232,121,249,0.18); }
.cert-familia-card[data-fam="ART"] .cert-familia-icono { --fc: #fbbf24; --fb: rgba(251,191,36,0.20); }
.cert-familia-card[data-fam="COM"] .cert-familia-icono { --fc: #fb923c; --fb: rgba(251,146,60,0.20); }
.cert-familia-card[data-fam="EOC"] .cert-familia-icono { --fc: #fcd34d; --fb: rgba(252,211,77,0.20); }
.cert-familia-card[data-fam="ELE"] .cert-familia-icono { --fc: #facc15; --fb: rgba(250,204,21,0.20); }
.cert-familia-card[data-fam="ENA"] .cert-familia-icono { --fc: #22d3ee; --fb: rgba(34,211,238,0.18); }
.cert-familia-card[data-fam="FME"] .cert-familia-icono { --fc: #94a3b8; --fb: rgba(148,163,184,0.20); }
.cert-familia-card[data-fam="HOT"] .cert-familia-icono { --fc: #f59e0b; --fb: rgba(245,158,11,0.20); }
.cert-familia-card[data-fam="IMP"] .cert-familia-icono { --fc: #f472b6; --fb: rgba(244,114,182,0.20); }
.cert-familia-card[data-fam="IMS"] .cert-familia-icono { --fc: #f87171; --fb: rgba(248,113,113,0.20); }
.cert-familia-card[data-fam="INA"] .cert-familia-icono { --fc: #eab308; --fb: rgba(234,179,8,0.20); }
.cert-familia-card[data-fam="IEX"] .cert-familia-icono { --fc: #d97706; --fb: rgba(217,119,6,0.22); }
.cert-familia-card[data-fam="IFC"] .cert-familia-icono { --fc: #38bdf8; --fb: rgba(56,189,248,0.20); }
.cert-familia-card[data-fam="IMA"] .cert-familia-icono { --fc: #818cf8; --fb: rgba(129,140,248,0.20); }
.cert-familia-card[data-fam="MAM"] .cert-familia-icono { --fc: #22c55e; --fb: rgba(34,197,94,0.20); }
.cert-familia-card[data-fam="MAP"] .cert-familia-icono { --fc: #0ea5e9; --fb: rgba(14,165,233,0.20); }
.cert-familia-card[data-fam="QUI"] .cert-familia-icono { --fc: #84cc16; --fb: rgba(132,204,22,0.22); }
.cert-familia-card[data-fam="SAN"] .cert-familia-icono { --fc: #ef4444; --fb: rgba(239,68,68,0.20); }
.cert-familia-card[data-fam="SEA"] .cert-familia-icono { --fc: #65a30d; --fb: rgba(101,163,13,0.22); }
.cert-familia-card[data-fam="SSC"] .cert-familia-icono { --fc: #a78bfa; --fb: rgba(167,139,250,0.20); }
.cert-familia-card[data-fam="TCP"] .cert-familia-icono { --fc: #c084fc; --fb: rgba(192,132,252,0.20); }
.cert-familia-card[data-fam="TMV"] .cert-familia-icono { --fc: #dc2626; --fb: rgba(220,38,38,0.20); }
.cert-familia-card[data-fam="VIC"] .cert-familia-icono { --fc: #5eead4; --fb: rgba(94,234,212,0.22); }
.cert-familia-card[data-fam="IAD"] .cert-familia-icono { --fc: #06b6d4; --fb: rgba(6,182,212,0.22); }
.cert-familia-card[data-fam="ACT"] .cert-familia-icono { --fc: #14b8a6; --fb: rgba(20,184,166,0.22); }
.cert-familia-codigo {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.13);
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  align-self: flex-start;
}
.cert-familia-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.cert-familia-meta {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.cert-familia-meta strong { color: var(--primary-light); font-weight: 700; }
.cert-familia-meta em { font-style: normal; opacity: 0.7; }

/* Tabla de certificados */
.cert-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  margin: 1.5rem 0 1rem;
}
.cert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.cert-table thead th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}
.cert-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.cert-table tbody tr:last-child { border-bottom: none; }
.cert-table tbody tr:hover { background: rgba(99,102,241,0.04); }
.cert-table td { padding: 0.75rem 1rem; vertical-align: middle; }
.cert-table .col-codigo { white-space: nowrap; width: 1%; }
.cert-table .col-codigo code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c7d2fe;
  background: rgba(99,102,241,0.22);
  padding: 0.22rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(99,102,241,0.35);
}
.cert-table .col-codigo a { text-decoration: none; }
.cert-table .col-codigo a:hover code {
  background: rgba(99,102,241,0.35);
  color: #fff;
}
.cert-table .col-codigo .cert-total-horas {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-align: center;
  opacity: 0.85;
}
.cert-table .col-nombre { line-height: 1.45; color: var(--text); }
.cert-table .col-nivel { width: 1%; text-align: center; }
/* ─── Toolbar admin: filtro + buscador en una sola fila ─── */
/* Usamos box-sizing: border-box y padding consistente para alinear alturas
   reales (el navegador puede ajustar height por contenido en form fields). */
.admin-toolbar-select,
.admin-toolbar-search,
.admin-toolbar-btn {
  box-sizing: border-box;
  height: 44px;
  line-height: 1;
}
.admin-toolbar-select {
  flex: 0 0 220px;
  width: 220px;
  background-color: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 2rem 0 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
.admin-toolbar-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.admin-toolbar-select option { background: #1e1b4b; color: var(--text); }

.admin-toolbar-search {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 0.6rem 0 0.95rem;
}
.admin-toolbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.admin-toolbar-search > svg {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 16px;
  color: var(--text-soft);
}
.admin-toolbar-search input {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.admin-toolbar-search input::-webkit-search-cancel-button { display: none; }
.admin-toolbar-search input::placeholder { color: var(--text-soft); }
.admin-toolbar-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}
.admin-toolbar-clear:hover { background: rgba(255,255,255,0.14); color: var(--text); }

.admin-toolbar-btn {
  flex: 0 0 auto;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 1.3rem;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s;
}
.admin-toolbar-btn:hover { background: #4f46e5; }

/* ─── Tabla cert_prof (admin) ─── */
.cert-prof-table { table-layout: auto; border-collapse: separate; border-spacing: 0; }
.cert-prof-table thead th { padding: 0.85rem 1rem; }
.cert-prof-table tbody td { padding: 1rem; vertical-align: middle; }
.cert-prof-table .col-codigo {
  white-space: nowrap;
  width: 1%;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #c7d2fe;
  letter-spacing: 0.02em;
}
.cert-prof-table .col-familia { white-space: nowrap; width: 1%; }
.cert-prof-table .col-denom { line-height: 1.45; font-size: 0.95rem; }
.cert-prof-table .col-nivel { white-space: nowrap; width: 1%; text-align: center; }
.cert-prof-table .col-acciones { white-space: nowrap; min-width: 220px; text-align: right; }
.cert-prof-table tr.row-hidden { opacity: 0.55; }
.cert-prof-table tr.row-hidden .cert-denom { font-style: italic; }

/* Botones de acción icono — admin */
.cert-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
}
.cert-actions > * { flex: 0 0 auto; }
.cert-actions form {
  display: inline-flex !important;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}
.icon-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent !important;
  background-image: none !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  color: var(--text) !important;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
  flex: 0 0 36px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-shadow: none !important;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}
.icon-btn:hover {
  background: rgba(99,102,241,0.22) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  transform: translateY(-1px);
}
.icon-btn-danger {
  border-color: rgba(239,68,68,0.30) !important;
  color: #fca5a5 !important;
}
.icon-btn-danger:hover {
  background: rgba(239,68,68,0.22) !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

/* ─── Botón "X módulos" + tabla expandible (pública) ─── */
.cert-table .col-mods { width: 1%; white-space: nowrap; text-align: right; }
.mods-actions {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.mods-pdf {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  background: rgba(236,72,153,0.14);
  border: 1px solid rgba(236,72,153,0.45);
  border-radius: 8px;
  color: #f9a8d4;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.mods-pdf:hover {
  background: rgba(236,72,153,0.32);
  border-color: rgba(236,72,153,0.7);
  color: #fff;
}
.mods-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mods-toggle:hover {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.45);
  color: #fff;
}
.mods-toggle .ico-grid { flex: 0 0 16px; }
.mods-toggle .ico-chevron {
  flex: 0 0 14px;
  transition: transform 0.18s ease;
}
.mods-toggle.open .ico-chevron { transform: rotate(180deg); }

.mods-row > td {
  background: rgba(99,102,241,0.08);
  padding: 1rem 1.25rem 1.25rem;
  border-top: 2px solid var(--primary);
  box-shadow: inset 0 6px 12px -8px rgba(0,0,0,0.35);
}
.mods-table-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.35);
  background: rgba(15, 23, 42, 0.45);
}
.mods-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 720px;
}
.mods-table thead th {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  vertical-align: middle;
}
/* Sub-cabeceras (H. Formativas / H. Prácticas) más pequeñas para liberar
   espacio en las columnas de Módulo certificado y Unidades formativas. */
.mods-table thead tr:nth-child(2) th {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.35rem;
  white-space: nowrap;
}
.mods-table thead th.grp-foap { background: rgba(99,102,241,0.16); }
.mods-table thead th.grp-cons { background: rgba(236,72,153,0.16); }
.mods-table tbody td {
  padding: 0.6rem 0.6rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mods-table tbody tr:last-child td { border-bottom: none; }
.mods-table .mod-cell {
  min-width: 220px;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.mods-table .uf-cell { min-width: 220px; }
.mods-table .hrs-cell {
  text-align: center;
  width: 60px;
  min-width: 60px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  border-right: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.mods-table .empty { color: var(--text-soft); opacity: 0.45; }

/* Fila de totales (Duración total) */
.mods-table tbody tr.mods-total-row td {
  background: rgba(236, 72, 153, 0.18);
  color: #fff;
  font-weight: 700;
  border-top: 2px solid rgba(236, 72, 153, 0.55);
  padding: 0.75rem 0.6rem;
}
.mods-table tbody tr.mods-total-row .mods-total-label {
  text-align: center;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}
.mods-table .mod-cell code,
.mods-table .uf-cell code {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #c7d2fe;
  background: rgba(99,102,241,0.13);
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  margin-right: 0.45rem;
}

/* ─── Editor admin de módulos (estilo limpio/profesional) ────────────── */
/* Esta sección sustituye visualmente al bloque que viene a continuación.
   Variables locales para facilitar ajustes. */
.modulos-stack {
  --card-bg:        rgba(255, 255, 255, 0.035);
  --card-bg-hover:  rgba(255, 255, 255, 0.06);
  --card-border:    rgba(255, 255, 255, 0.10);
  --card-border-h:  rgba(99, 102, 241, 0.45);
  --label-color:    #cbd5e1;
  --input-bg:       rgba(255, 255, 255, 0.07);
  --input-bg-focus: rgba(255, 255, 255, 0.11);
  --input-border:   rgba(255, 255, 255, 0.16);
}

/* Cabecera de la página: volver / título / PDF */
.modulos-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.modulos-header .modulos-back { flex: 0 0 auto; }
.modulos-cert-info {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  min-width: 0;
}
.modulos-cert-cod {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(99,102,241,0.18);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(99,102,241,0.3);
  white-space: nowrap;
  flex: 0 0 auto;
}
.modulos-cert-info h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modulos-pdf-btn { flex: 0 0 auto; margin-left: auto; }
.modulos-hint {
  color: var(--text-soft);
  font-size: 0.88rem;
  margin: 0 0 1.25rem;
}

/* Stack de cards */
.modulos-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Tarjeta de módulo */
.modulo-card {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, background 0.15s;
}
.modulo-card:hover { border-color: rgba(99,102,241,0.30); }

/* Cabecera del módulo: prominente, sin gradiente */
.modulo-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.modulo-head-tag {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.modulo-head-tag.tag-mf {
  color: #e0e7ff;
  background: rgba(99,102,241,0.28);
  border: 1px solid rgba(99,102,241,0.45);
}
.modulo-head-tag.tag-mp {
  color: #fef3c7;
  background: rgba(251,191,36,0.22);
  border: 1px solid rgba(251,191,36,0.45);
}
.modulo-head-title {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modulo-head-horas {
  font-size: 0.82rem;
  font-weight: 700;
  color: #86efac;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.35);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.modulo-delete-inline {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  display: inline-flex;
}
.modulo-head-add { background: linear-gradient(180deg, rgba(34,197,94,0.10), rgba(34,197,94,0.04)); }
.modulo-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(34,197,94,0.22);
  color: #86efac;
  font-weight: 800;
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.modulo-head-add h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
}

/* Tabla editable de módulos + UFs (estilo similar a la pública) */
.mod-table-wrap {
  padding: 1rem;
  overflow-x: auto;
}
.mod-table {
  width: 100%;
  border-collapse: collapse !important;
  font-size: 0.9rem;
  min-width: 880px;
  background: rgba(0,0,0,0.20);
  border: 2px solid #4f5670 !important;
  border-radius: 10px;
  overflow: hidden;
}
.mod-table thead th {
  background: rgba(99, 102, 241, 0.20);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.6rem 0.45rem;
  border: 1px solid #4f5670 !important;
  vertical-align: middle;
  white-space: nowrap;
}
.mod-table thead th.grp-foap { background: rgba(99,102,241,0.32); color: #e0e7ff; }
.mod-table thead th.grp-cons { background: rgba(236,72,153,0.30); color: #fce7f3; }
.mod-table thead th.col-cod  { width: 110px; }
.mod-table thead th.col-nom  { width: auto; }
.mod-table thead th.col-h-tot{ width: 78px; }
.mod-table thead th.col-h    { width: 82px; }
.mod-table thead th.col-act  { width: 92px; }

.mod-table tbody td {
  background: rgba(255,255,255,0.025);
  padding: 0.4rem 0.4rem;
  border: 1px solid #4f5670 !important;
  vertical-align: middle;
}
.mod-table tbody tr.row-mf td { background: rgba(99,102,241,0.08); }
.mod-table tbody tr.row-uf td { background: rgba(0,0,0,0.18); }
.mod-table tbody tr.row-add td {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.40);
}
.mod-table tbody tr.row-empty td {
  text-align: center;
  font-style: italic;
  color: var(--text-soft);
  padding: 1rem;
}
.mod-table tbody tr.row-uf td.col-empty {
  text-align: center;
  color: var(--text-soft);
  opacity: 0.5;
  background: rgba(0,0,0,0.30);
  font-size: 1.1rem;
}

/* Inputs dentro de la tabla */
.mod-table tbody td input[type="text"],
.mod-table tbody td input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.6rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}
.mod-table tbody td input.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  text-transform: uppercase;
  font-weight: 600;
  color: #e0e7ff;
  font-size: 0.86rem;
  padding: 0.55rem 0.45rem;
}
.mod-table tbody td input[type="number"] {
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 0.4rem;
}
.mod-table tbody td input::-webkit-outer-spin-button,
.mod-table tbody td input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.mod-table tbody td input:focus {
  outline: none;
  background: rgba(255,255,255,0.10);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.20);
}

/* Tinte sutil para las celdas de horas FOAP/CONS */
.mod-table tbody td.grp-foap input { background: rgba(99,102,241,0.10); border-color: rgba(99,102,241,0.30); }
.mod-table tbody td.grp-cons input { background: rgba(236,72,153,0.10); border-color: rgba(236,72,153,0.30); }

/* Estados de filas: modificada / guardando / guardada / error */
.mod-table tbody tr.row-modified td {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.45);
}
.mod-table tbody tr.row-modified td:first-child {
  border-left: 3px solid #f59e0b;
}
.mod-table tbody tr.row-saving td {
  background: rgba(99, 102, 241, 0.12);
  opacity: 0.8;
}
.mod-table tbody tr.row-saving td:first-child {
  border-left: 3px solid var(--primary);
}
.mod-table tbody tr.row-saved td {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.50);
  transition: background 0.4s ease;
}
.mod-table tbody tr.row-saved td:first-child {
  border-left: 3px solid #22c55e;
}
.mod-table tbody tr.row-error td {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.50);
}
.mod-table tbody tr.row-error td:first-child {
  border-left: 3px solid #ef4444;
}
.mod-table tbody tr.row-removing td {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
}
/* Mensaje flash inline en la celda de acciones */
.cp-flash {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  animation: cpFlashIn 0.2s ease-out;
}
.cp-flash-saving { background: rgba(99,102,241,0.20); color: #c7d2fe; border: 1px solid rgba(99,102,241,0.45); }
.cp-flash-saved  { background: rgba(34,197,94,0.20);  color: #86efac; border: 1px solid rgba(34,197,94,0.45); }
.cp-flash-error  { background: rgba(239,68,68,0.20);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.45); }
@keyframes cpFlashIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Toolbar de colapso */
.modulos-collapse-toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}
.modulos-collapse-toolbar button {
  padding: 0.5rem 0.95rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.modulos-collapse-toolbar button:hover {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.45);
  color: #fff;
}

/* Cabecera clicable: cursor pointer + chevron + animación */
.modulo-card .modulo-head {
  user-select: none;
  position: relative;
}
.modulo-card .modulo-head::after {
  content: '';
  position: absolute;
  right: 1.1rem;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: translateY(-75%) rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}
.modulo-card.is-collapsed .modulo-head::after {
  transform: translateY(-25%) rotate(-45deg);
}
.modulo-card.is-collapsed .modulo-head { border-bottom: none; }
.modulo-card.is-collapsed .mod-table-wrap,
.modulo-card.is-collapsed .ufs-section,
.modulo-card.is-collapsed .modulo-body {
  display: none;
}
.modulo-card .modulo-delete-inline {
  margin-right: 1.2rem; /* hueco para el chevron */
}
.modulo-card.modulo-add-card .modulo-head::after { display: none; }
.modulo-card.modulo-add-card .modulo-head { cursor: default !important; }

/* Acciones */
.mod-table tbody td.col-act {
  text-align: center;
  white-space: nowrap;
}
.mod-table tbody td.col-act .icon-btn { display: inline-flex; }
.icon-btn-save {
  border-color: rgba(34,197,94,0.35) !important;
  color: #86efac !important;
}
.icon-btn-save:hover {
  background: rgba(34,197,94,0.25) !important;
  color: #fff !important;
  border-color: rgba(34,197,94,0.65) !important;
}
.icon-btn-add {
  border-color: rgba(99,102,241,0.45) !important;
  color: var(--primary-light) !important;
}
.icon-btn-add:hover {
  background: rgba(99,102,241,0.25) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Cuerpo del módulo: padding generoso para respirar (legacy fieldset) */
.modulo-body {
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Fieldsets como cuadros separadores entre secciones */
.mod-fieldset {
  margin: 0;
  padding: 1.25rem 1.4rem 1.4rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  position: relative;
}
.mod-fieldset > legend {
  padding: 0 0.7rem;
  margin-left: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-light);
  background: var(--surface);
  border: 1px solid rgba(99,102,241,0.30);
  border-radius: 6px;
  padding-top: 0.18rem;
  padding-bottom: 0.18rem;
}
.mod-fieldset-hours { background: rgba(99,102,241,0.04); border-color: rgba(99,102,241,0.20); }
.mod-fieldset-hours > legend {
  color: #c7d2fe;
  background: rgba(99,102,241,0.20);
  border-color: rgba(99,102,241,0.4);
}

/* Sección UFs como fieldset también */
.ufs-section {
  margin: 0 1.5rem 1.5rem;
  padding: 1.25rem 1.4rem 1.4rem !important;
  background: rgba(34, 197, 94, 0.04) !important;
  border: 1px solid rgba(34, 197, 94, 0.20) !important;
  border-top: 1px solid rgba(34, 197, 94, 0.20) !important;
  border-radius: 12px;
}

/* Campos código + denominación */
.mod-fields,
.uf-card-line {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.mod-fields .field,
.uf-card-line .field,
.uf-add .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 260px;
  min-width: 0;
}
.mod-fields .field-cod,
.uf-card-line .field-cod,
.uf-add .field-cod { flex: 0 0 200px; }
.mod-fields .field-grow,
.uf-card-line .field-grow,
.uf-add .field-grow { flex: 1 1 380px; }
.mod-fields .field label,
.uf-card-line .field label,
.uf-add .field label,
.hrs-cell .hrs-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cbd5e1;
}

/* Inputs grandes y cómodos */
.mod-fields .field input,
.uf-add input[type="text"],
.uf-card-line input,
.hrs-cell input,
.hrs-pair-inputs input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 1.02rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.mod-fields .field input.mono,
.uf-add input.mono,
.uf-card-line input.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1rem;
  color: #e0e7ff;
}
.mod-fields .field input:focus,
.uf-add input:focus,
.uf-card-line input:focus,
.hrs-cell input:focus,
.hrs-pair-inputs input:focus {
  outline: none;
  background: rgba(255,255,255,0.11);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.20);
}
.mod-fields .field input::placeholder,
.uf-add input::placeholder,
.uf-card-line input::placeholder,
.hrs-cell input::placeholder,
.hrs-pair-inputs input::placeholder {
  color: rgba(255,255,255,0.25);
}

/* Grid de horas del módulo (clases prefijadas para evitar colisión) */
.mod-hours-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  gap: 0.85rem !important;
  width: 100%;
}
.mod-hours-cell {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.55rem !important;
  padding: 1rem 1.1rem !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  transition: border-color 0.15s;
  width: auto !important;
  min-width: 0 !important;
}
.mod-hours-cell:hover { border-color: rgba(255,255,255,0.22); }
.mod-hours-label {
  font-size: 0.78rem !important;
  font-weight: 600;
  color: #cbd5e1 !important;
  letter-spacing: 0.02em;
  white-space: normal;
  text-transform: none !important;
}
.mod-hours-cell input {
  width: 100% !important;
  padding: 0.85rem 1rem !important;
  background: rgba(255,255,255,0.10) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  font-family: inherit;
  text-align: center !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}
.mod-hours-cell input::-webkit-outer-spin-button,
.mod-hours-cell input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.mod-hours-cell input:focus {
  outline: none !important;
  background: rgba(255,255,255,0.14) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.22) !important;
}
.mod-hours-cell.mod-hours-foap {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.35);
}
.mod-hours-cell.mod-hours-foap .mod-hours-label { color: #c7d2fe !important; font-weight: 700; }
.mod-hours-cell.mod-hours-cons {
  background: rgba(236,72,153,0.12);
  border-color: rgba(236,72,153,0.35);
}
.mod-hours-cell.mod-hours-cons .mod-hours-label { color: #fbcfe8 !important; font-weight: 700; }

.mod-actions { display: flex; justify-content: flex-end; }

/* Botón primario pequeño */
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 4px 12px -6px rgba(99,102,241,0.5);
}
.btn-primary-sm:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 8px 18px -6px rgba(99,102,241,0.7);
}
.btn-primary-sm:active { transform: translateY(0); }

/* Sección de UFs */
.ufs-section {
  padding: 1.5rem;
  background: rgba(0,0,0,0.18);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.ufs-section-head {
  margin-bottom: 1rem;
}
.ufs-section-head h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
}
.ufs-section-head .ufs-count {
  color: var(--text-soft);
  font-weight: 500;
  margin-left: 0.4rem;
}

/* ─── Lista de UFs (cards individuales) ─── */
.ufs-list-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.uf-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.uf-card:hover {
  border-color: rgba(99,102,241,0.30);
  background: rgba(255,255,255,0.06);
}

/* Línea 1: código + denominación */
.uf-card-line {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.uf-card-line .field { flex: 1 1 260px; }
.uf-card-line .field-cod { flex: 0 0 200px; }
.uf-card-line .field-grow { flex: 1 1 380px; }

/* Línea 2: pares de horas FOAP/CONS + acciones */
.uf-card-hours {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.hrs-pair {
  flex: 1 1 320px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.7rem !important;
  padding: 1rem 1.1rem !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.025);
}
.hrs-pair-foap {
  background: rgba(99,102,241,0.12) !important;
  border-color: rgba(99,102,241,0.35) !important;
}
.hrs-pair-cons {
  background: rgba(236,72,153,0.12) !important;
  border-color: rgba(236,72,153,0.35) !important;
}
.hrs-pair-tag {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}
.hrs-pair-foap .hrs-pair-tag { color: #c7d2fe !important; }
.hrs-pair-cons .hrs-pair-tag { color: #fbcfe8 !important; }
.hrs-pair-inputs {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.7rem !important;
}
.hrs-pair-inputs label {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.4rem !important;
}
.hrs-pair-inputs label > span {
  font-size: 0.78rem !important;
  font-weight: 600;
  color: #cbd5e1 !important;
  letter-spacing: 0.02em;
  text-transform: none;
}
.hrs-pair-inputs input {
  width: 100% !important;
  padding: 0.85rem 1rem !important;
  text-align: center !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  background: rgba(255,255,255,0.10) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}
.hrs-pair-inputs input::-webkit-outer-spin-button,
.hrs-pair-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.hrs-pair-inputs input:focus {
  outline: none !important;
  background: rgba(255,255,255,0.14) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.22) !important;
}

.uf-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Mensaje "sin UFs" */
.ufs-empty {
  margin: 0.5rem 0 1rem;
  padding: 1.5rem;
  background: rgba(255,255,255,0.025);
  border: 1px dashed rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
}

/* Form añadir UF (estilo destacado) */
.uf-add {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1.25rem;
  background: rgba(34,197,94,0.07);
  border: 1px dashed rgba(34,197,94,0.40);
  border-radius: 12px;
}
.uf-add .field { flex: 1 1 260px; }
.uf-add .field-cod { flex: 0 0 200px; }
.uf-add .field-grow { flex: 1 1 360px; }
.uf-add button {
  flex: 0 0 auto;
  height: 52px;
  align-self: flex-end;
  padding: 0 1.4rem;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 700px) {
  .modulo-body { padding: 1rem; }
  .ufs-section { padding: 1rem; }
  .uf-card { padding: 1rem; }
  .uf-card-hours { flex-direction: column; align-items: stretch; gap: 0.85rem; }
  .uf-card-actions { justify-content: flex-end; margin-left: 0; }
}
.modulo-edit-grid {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 0.7rem;
  align-items: end;
}
.modulo-edit-actions { display: flex; gap: 0.4rem; align-items: end; padding-bottom: 0.05rem; }
.modulo-edit-grid .field { margin-bottom: 0; }
.modulo-edit-grid .field label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  display: block;
  margin-bottom: 0.3rem;
}
.modulo-edit-grid .field input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}
.modulo-edit-grid .field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* Bloque de UFs dentro del módulo */
.ufs-block {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}
.ufs-block-head {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 0.55rem;
}
.ufs-list { list-style: none; padding: 0; margin: 0 0 0.7rem; display: flex; flex-direction: column; gap: 0.3rem; }
.ufs-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  font-size: 0.88rem;
}
.ufs-list code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #c7d2fe;
  background: rgba(99,102,241,0.15);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.ufs-empty {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0 0 0.7rem;
}
.ufs-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.ufs-add-form input {
  padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}
.ufs-add-form input[name="nombre"] { flex: 1 1 250px; }
.ufs-add-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.modulo-delete-form {
  align-self: flex-end;
}

/* Horas del módulo (editor) */
.hrs-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.85rem;
  margin-top: 0.4rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hrs-edit-cell {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 0 0 auto;
}
.hrs-edit-cell label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.hrs-edit-cell input {
  width: 80px;
  padding: 0.45rem 0.6rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.hrs-edit-cell input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.hrs-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px dashed transparent;
}
.hrs-group-foap {
  background: rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.25);
}
.hrs-group-cons {
  background: rgba(236,72,153,0.06);
  border-color: rgba(236,72,153,0.25);
}
.hrs-group-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.hrs-group-foap .hrs-group-label { color: var(--primary-light); }
.hrs-group-cons .hrs-group-label { color: #f9a8d4; }
.hrs-group-inputs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* UFs editables (editor) */
.ufs-list .uf-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}
.uf-edit-main {
  flex: 1 1 320px;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  min-width: 0;
}
.uf-edit-main input {
  padding: 0.45rem 0.65rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  min-width: 0;
}
.uf-edit-main input[name="nombre"] { flex: 1 1 auto; }
.uf-edit-main input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.uf-hrs-grid {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.uf-hrs-cell {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.uf-hrs-cell input {
  width: 60px;
  padding: 0.4rem 0.45rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.uf-hrs-cell input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.uf-hrs-tag {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.uf-tag-foap { background: rgba(99,102,241,0.18); color: var(--primary-light); }
.uf-tag-cons { background: rgba(236,72,153,0.18); color: #f9a8d4; }
.uf-edit-actions { display: flex; gap: 0.3rem; margin-left: auto; }

/* ─── Línea de R.D. bajo el nombre del certificado ─── */
.cert-rd-line {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.cert-rd-line .cert-rd { color: var(--text-muted); }
.cert-rd-line .cert-rd-mod { color: #fbbf24; font-weight: 500; }
.cert-rd-line .cert-rd-sep {
  margin: 0 0.35rem;
  color: var(--text-soft);
  opacity: 0.6;
}
.cert-boe-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.42rem;
  margin-right: 0.5rem;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 4px;
  color: #86efac;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  vertical-align: baseline;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cert-boe-btn:hover {
  background: rgba(34, 197, 94, 0.32);
  color: #fff;
  border-color: rgba(34, 197, 94, 0.7);
}

/* ─── Aviso entre buscador y tabla de certificados ─── */
.cert-aviso {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 1100px;
  margin: 1rem auto 0;
  padding: 0.85rem 1.1rem;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}
.cert-aviso > svg {
  flex: 0 0 20px;
  color: #fbbf24;
  margin-top: 0.18rem;
}
.cert-aviso p { margin: 0; }
.cert-aviso a {
  color: var(--primary-light);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 600;
}
.cert-aviso a:hover { color: #fff; }

/* Variante informativa (azul) — usada para avisos no urgentes */
.cert-aviso.cert-aviso-info {
  margin-top: 0.6rem;
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-left: 4px solid #38bdf8;
}
.cert-aviso.cert-aviso-info > svg { color: #7dd3fc; }
.cert-aviso.cert-aviso-info em {
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── Pestañas de filtro por nivel (en detalle de familia) ─── */
.cert-nivel-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 1rem auto 0;
}
.cert-nivel-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cert-nivel-tabs a:hover {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.35);
  color: var(--text);
}
.cert-nivel-tabs a.active {
  background: rgba(99,102,241,0.18);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.cert-nivel-tabs a .cert-nivel {
  width: 22px;
  height: 22px;
  font-size: 0.78rem;
}
.cert-nivel-tabs-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.5rem;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
}
.cert-nivel-tabs a.active .cert-nivel-tabs-count {
  background: rgba(255,255,255,0.20);
  color: #fff;
}
.cert-denom { display: block; }
.cert-table .col-familia { width: 1%; white-space: nowrap; }
.cert-fam-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.18);
  color: #c7d2fe;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(99,102,241,0.3);
  letter-spacing: 0.04em;
}
.cert-fam-pill:hover { background: rgba(99,102,241,0.32); color: #fff; }
.cert-table .col-enlace { width: 1%; text-align: center; }
.cert-table .col-enlace a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--primary-light);
  text-decoration: none;
  background: rgba(99,102,241,0.10);
  font-weight: 700;
}
.cert-table .col-enlace a:hover {
  background: rgba(99,102,241,0.22);
}
.cert-nivel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
}
.cert-nivel-1 { background: rgba(34,197,94,0.18);  color: #86efac; border: 1px solid rgba(34,197,94,0.4); }
.cert-nivel-2 { background: rgba(59,130,246,0.18); color: #93c5fd; border: 1px solid rgba(59,130,246,0.4); }
.cert-nivel-3 { background: rgba(168,85,247,0.18); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.4); }

.cert-table-foot {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ─── Buscador de certificados ─── */
.cert-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 700px;
  margin: 1.25rem auto 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cert-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.18);
}
.cert-search-label {
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
}
.cert-search-label svg { width: 18px; height: 18px; }
.cert-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  padding: 0.55rem 0.25rem;
  font-family: inherit;
}
.cert-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.cert-search input[type="search"]::placeholder { color: var(--text-soft); }
.cert-search-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  color: var(--text-soft);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
}
.cert-search-clear:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.cert-search-btn {
  flex: 0 0 auto;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.cert-search-btn:hover { background: var(--primary-dark, #4f46e5); }
@media (max-width: 600px) {
  .cert-search { padding: 0.35rem 0.4rem 0.35rem 0.85rem; }
  .cert-search-btn { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
@media (max-width: 600px) {
  .cert-table { font-size: 0.85rem; }
  .cert-table thead { display: none; }
  .cert-table tbody tr {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 0.4rem 0.7rem;
    padding: 0.85rem 0.9rem;
  }
  .cert-table td { padding: 0; border: none; }
  .cert-table .col-codigo  { grid-column: 1; grid-row: 1; }
  .cert-table .col-familia { grid-column: 2; grid-row: 1; }
  .cert-table .col-nombre  { grid-column: 1 / -1; grid-row: 2; }
  .cert-table .col-nivel   { grid-column: 4; grid-row: 1; justify-self: end; }
  .cert-rd-line { margin-top: 0.25rem; font-size: 0.74rem; }
}

.gloss-letter { margin-bottom: 1.6rem; scroll-margin-top: 2rem; }
.gloss-letter > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-light);
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid rgba(99, 102, 241, 0.25);
  display: inline-block;
  min-width: 2.5rem;
  text-align: center;
}

/* Acciones globales: expandir/colapsar todo */
.gloss-collapse-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}
.gloss-collapse-actions .btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Sección por letra como <details>/<summary> */
details.gloss-letter {
  border-radius: 12px;
  background: transparent;
  margin-bottom: 1.2rem;
}
details.gloss-letter > summary.gloss-letter-summary {
  list-style: none;        /* quita el triángulo nativo */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  margin-bottom: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
details.gloss-letter > summary.gloss-letter-summary::-webkit-details-marker { display: none; }
details.gloss-letter > summary.gloss-letter-summary:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
}
details.gloss-letter > summary.gloss-letter-summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.gloss-letter-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.04em;
  min-width: 2rem;
  text-align: center;
}
.gloss-letter-count {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.gloss-letter-chevron {
  flex-shrink: 0;
  color: var(--primary-light);
  transition: transform 0.25s ease;
}
details[open].gloss-letter > summary.gloss-letter-summary .gloss-letter-chevron {
  transform: rotate(180deg);
}
@media (prefers-reduced-motion: reduce) {
  .gloss-letter-chevron { transition: none; }
}

.gloss-list { margin: 0; padding: 0; }
.gloss-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.6rem;
  transition: background 0.18s, border-color 0.18s;
}
.gloss-entry:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.gloss-entry > dt {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
}
.gloss-entry > dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}
.gloss-aliases {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 400;
}
.gloss-cat {
  margin-left: auto;          /* empuja la etiqueta al borde derecho del <dt> flex */
  display: inline-block;
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-soft);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.gloss-cat-sistema    { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.4); color: #a5b4fc; }
.gloss-cat-organismo  { background: rgba(20, 184, 166, 0.15); border-color: rgba(20, 184, 166, 0.4); color: #5eead4; }
.gloss-cat-normativa  { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
.gloss-cat-cataluna   { background: rgba(244, 63, 94, 0.15);  border-color: rgba(244, 63, 94, 0.4);  color: #fda4af; }
.gloss-cat-pedagog    { background: rgba(168, 85, 247, 0.15); border-color: rgba(168, 85, 247, 0.4); color: #d8b4fe; }
.gloss-cat-evaluacion { background: rgba(34, 197, 94, 0.15);  border-color: rgba(34, 197, 94, 0.4);  color: #86efac; }
.gloss-cat-modalidad  { background: rgba(14, 165, 233, 0.15); border-color: rgba(14, 165, 233, 0.4); color: #7dd3fc; }
.gloss-cat-estructura { background: rgba(236, 72, 153, 0.15); border-color: rgba(236, 72, 153, 0.4); color: #f9a8d4; }
.gloss-cat-acceso     { background: rgba(251, 146, 60, 0.15); border-color: rgba(251, 146, 60, 0.4); color: #fdba74; }
.gloss-cat-fpe        { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.4); color: #a5b4fc; }
.gloss-cat-tic        { background: rgba(56, 189, 248, 0.15); border-color: rgba(56, 189, 248, 0.4); color: #7dd3fc; }
.gloss-cat-familia    { background: rgba(255,255,255,0.05);   border-color: rgba(255,255,255,0.15);   color: var(--text-soft); }

.gloss-link {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary-light);
  text-decoration: none;
}
.gloss-link:hover { text-decoration: underline; }

/* Banner de privacidad / RGPD */
.cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  background: rgba(15, 14, 46, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.cookie-banner.is-visible { opacity: 1; transform: translateY(0); }
.cookie-banner-body  { flex: 1; min-width: 250px; }
.cookie-banner-body p { margin: 0; }
.cookie-banner-body strong { color: var(--text); }
.cookie-banner-body a { color: var(--primary-light); }
.cookie-banner-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.cookie-banner .btn { padding: 0.55rem 1.1rem; font-size: 0.9rem; }
@media (max-width: 600px) {
  .cookie-banner { padding: 0.9rem 1rem; }
  .cookie-banner-actions { width: 100%; }
  .cookie-banner-actions .btn { flex: 1; text-align: center; justify-content: center; }
}

/* Contador de resultados en el título de cada sección de normativa */
.norm-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 0 0.5rem;
  height: 22px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-left: 0.4rem;
}

.msg-list { display: flex; flex-direction: column; gap: 0.6rem; }
.msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s;
}
.msg:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.msg.unread { border-left: 3px solid var(--accent-pink); }
.msg summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: grid;
  /* col 1 (auto): checkbox bulk · col 2 (1fr): contenido · col 3 (auto): chevron ::after */
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem 1rem;
  align-items: center;
}
.msg summary > .bulk-cb { margin: 0; align-self: center; }
.msg summary::-webkit-details-marker { display: none; }
.msg summary::after {
  content: '';
  width: 10px; height: 10px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  align-self: center;
  margin-right: 0.3rem;
}
.msg[open] summary::after { transform: rotate(-135deg); }

.msg-row1 {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem;
  align-items: baseline;
  font-size: 0.95rem;
}
.msg-name { font-weight: 700; color: var(--text); }
.msg-email { color: var(--text-muted); font-size: 0.88rem; }
.msg-subject { color: var(--text); font-size: 0.92rem; margin-top: 0.3rem; }
.msg-meta-row { display: flex; align-items: center; gap: 0.65rem; color: var(--text-soft); font-size: 0.78rem; margin-top: 0.25rem; }
.msg-meta-row .pill { padding: 0.15rem 0.55rem; background: rgba(236, 72, 153, 0.15); border: 1px solid rgba(236, 72, 153, 0.35); color: #fda4af; border-radius: 999px; font-weight: 700; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }

.msg-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
  padding-top: 1.1rem;
  display: grid;
  gap: 1rem;
}
.msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  font-family: inherit;
}
.msg-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem 1.25rem;
  font-size: 0.82rem;
}
.msg-info dt { color: var(--text-soft); margin-bottom: 0.15rem; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
.msg-info dd { color: var(--text-muted); word-break: break-word; }
.msg-info dd a { color: var(--primary-light); text-decoration: none; }
.msg-info dd a:hover { text-decoration: underline; }

.msg-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Formulario de respuesta inline */
.reply-section {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}
.reply-section summary.reply-toggle {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.reply-section summary.reply-toggle::-webkit-details-marker { display: none; }
.reply-section summary.reply-toggle:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}
.reply-section summary.reply-toggle svg { width: 14px; height: 14px; }
.reply-section[open] summary.reply-toggle {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.55);
}

.reply-form {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 0.85rem;
}
.reply-form .reply-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.7rem 0.95rem;
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.reply-form .reply-meta strong { color: var(--text); font-weight: 600; }
.reply-form .field label { font-size: 0.82rem; }
.reply-form input,
.reply-form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.reply-form textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.reply-form input:focus,
.reply-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state svg { width: 48px; height: 48px; color: var(--text-soft); margin: 0 auto 1rem; display: block; }
.empty-state p { color: var(--text-muted); }

.pager {
  display: flex; gap: 0.4rem; justify-content: center; align-items: center;
  margin-top: 2rem; flex-wrap: wrap;
}
.pager a, .pager span {
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--surface-hover); color: var(--text); }
.pager span.current {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white; border-color: transparent;
}
.pager span.dots { background: transparent; border: none; color: var(--text-soft); }

@media (max-width: 600px) {
  .msg summary { grid-template-columns: auto 1fr; }
  .msg summary::after { display: none; }
  .admin-toolbar form.search { width: 100%; }
}

/* === Blog / Noticias === */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}
.news-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  backdrop-filter: blur(20px);
}

/* Tarjeta destacada — borde con gradiente y resalte */
.news-card-featured {
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25),
              0 18px 50px -16px rgba(236, 72, 153, 0.4);
}
.news-card-featured:hover {
  border-color: rgba(236, 72, 153, 0.7);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4),
              0 22px 60px -16px rgba(236, 72, 153, 0.55);
}
.news-featured-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 6px 18px -4px rgba(236, 72, 153, 0.55);
  pointer-events: none;
}
.news-featured-badge svg { color: #fde68a; }
.news-card:hover {
  transform: translateY(-6px);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.news-cover {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: rgba(99, 102, 241, 0.15);
  border-bottom: 1px solid var(--border);
}
.news-cover-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
}
.news-cover-placeholder svg { width: 48px; height: 48px; }
.news-body {
  padding: 1.4rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.news-date {
  font-size: 0.78rem;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.news-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.news-summary {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  flex: 1;
}
.news-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-top: 0.4rem;
}
.news-cta svg { width: 14px; height: 14px; transition: transform 0.3s ease; }
.news-card:hover .news-cta svg { transform: translateX(4px); }

/* Artículo individual */
.news-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 0 3rem;
}
.news-article-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.news-article-header h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #c7d2fe);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.news-article-header .lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}
.news-hero-image {
  margin: 0 0 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.news-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Contenido del artículo (HTML generado por markdown_to_html) */
.news-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-muted);
}
.news-content > * + * { margin-top: 1.1rem; }
.news-content p { color: var(--text-muted); }

/* Bloque "Fuentes consultadas" al final del cuerpo de la noticia */
.news-sources {
  margin: 2.5rem 0 1.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.news-sources h2 {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0 0.8rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  opacity: 0.85;
}
.news-sources h2 svg { opacity: 0.7; flex-shrink: 0; }
.news-sources ol {
  margin: 0;
  padding-left: 1.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.news-sources li { margin-bottom: 0.35rem; }
.news-sources li:last-child { margin-bottom: 0; }
.news-sources a {
  color: var(--primary-light);
  text-decoration: none;
  word-break: break-word;
}
.news-sources a:hover { text-decoration: underline; }
.news-content h2 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 2.5rem;
}
.news-content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2rem;
}
.news-content h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 1.5rem;
}
.news-content strong { color: var(--text); font-weight: 600; }
.news-content a {
  color: var(--primary-light);
  text-decoration: none;
  border-bottom: 1px dashed rgba(165, 180, 252, 0.4);
}
.news-content a:hover { border-bottom-color: var(--primary-light); }
.news-content ul, .news-content ol {
  padding-left: 1.5rem;
}
.news-content li + li { margin-top: 0.4rem; }
.news-content code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fcd34d;
}
.news-content pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.news-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
}
.news-content blockquote {
  border-left: 3px solid var(--primary);
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 10px 10px 0;
  padding: 0.85rem 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}
.news-content blockquote p { margin: 0; }
.news-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
/* Clases que genera Quill al guardar HTML — alineación, sangrías, code-block */
.news-content .ql-align-center { text-align: center; }
.news-content .ql-align-right  { text-align: right; }
.news-content .ql-align-justify { text-align: justify; }
.news-content .ql-indent-1 { padding-left: 3em; }
.news-content .ql-indent-2 { padding-left: 6em; }
.news-content .ql-indent-3 { padding-left: 9em; }
.news-content .ql-indent-4 { padding-left: 12em; }
.news-content pre.ql-syntax {
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.news-content img {
  max-width: 100%; height: auto; border-radius: 12px;
  display: block; margin: 1.5rem auto;
}

.news-content .md-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.75rem auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
}
.news-content .table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  margin: 1.75rem 0;
}
.news-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.news-content th, .news-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.news-content thead {
  background: rgba(99, 102, 241, 0.12);
}
.news-content th {
  font-weight: 700;
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.news-content tr:last-child td { border-bottom: none; }
.news-content tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }

.news-article-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.news-article-footer p { color: var(--text-soft); font-size: 0.85rem; }

/* Responsive tweaks */
@media (max-width: 640px) {
  main { padding: 1.25rem 1rem; }
  .hero { padding: 2rem 0 1.5rem; }
  .grid { grid-template-columns: 1fr; gap: 1rem; }
  .card { padding: 1.5rem 1.4rem; min-height: 0; }
  .prose, .form-card { padding: 1.75rem 1.25rem; }
  .norm-section h2 { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .reveal { opacity: 1; transform: none; }
  * { transition: none !important; }
}

/* ─── Comentarios públicos en /noticia.php ─────────────────────────── */
.comentarios-section {
  max-width: 760px;
  margin: 3rem auto 1rem;
  padding: 0 1rem;
}
.comentarios-titulo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.comentarios-count {
  display: inline-block;
  background: rgba(99,102,241,0.18);
  color: var(--primary-light);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
}
.comentarios-vacio {
  color: var(--text-muted);
  background: rgba(99,102,241,0.05);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  text-align: center;
  margin: 0 0 2rem;
}
.comentarios-cerrados p {
  text-align: center;
  color: var(--text-soft);
  font-style: italic;
  padding: 1rem 0;
}

.comentarios-lista {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.comentario {
  display: flex;
  gap: 0.9rem;
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.comentario:target {
  border-color: rgba(99,102,241,0.55);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.18);
}
.comentario-avatar {
  flex: 0 0 42px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: 0 6px 18px -8px rgba(236,72,153,0.5);
}
.comentario-cuerpo {
  flex: 1;
  min-width: 0;
}
.comentario-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}
.comentario-autor {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
a.comentario-autor:hover { color: var(--primary-light); }
.comentario-fecha {
  color: var(--text-soft);
  font-size: 0.78rem;
}
.comentario-texto {
  color: var(--text);
  line-height: 1.6;
  font-size: 0.95rem;
  word-break: break-word;
}

/* Formulario de comentario */
.comentarios-form-titulo {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 2rem 0 0.4rem;
  color: var(--text);
}
.comentarios-form-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.2rem;
}
.comentario-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}
.comentario-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.comentario-field { display: flex; flex-direction: column; gap: 0.35rem; }
.comentario-field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}
.comentario-field input,
.comentario-field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s;
}
.comentario-field input:focus,
.comentario-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(99,102,241,0.05);
}
.comentario-field textarea { resize: vertical; min-height: 120px; }

.comentario-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.comentario-check input[type="checkbox"] { margin-top: 0.18rem; }
.comentario-check label { cursor: pointer; line-height: 1.5; }
.comentario-check-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.comentario-check-help a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.comentario-check-help a:hover { color: var(--text); }

.comentario-submit {
  align-self: flex-start;
  padding: 0.7rem 1.6rem;
  font-weight: 700;
}

/* Honeypot oculto (sin display:none para que los bots lo vean) */
.comentario-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important; height: 1px !important;
  overflow: hidden !important;
}

/* Banner de error de comentario (rechazado por IA o validación) */
.comentario-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.2rem;
  margin: 0 0 1.2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(244, 63, 94, 0.10));
  border: 2px solid rgba(244, 63, 94, 0.55);
  color: #fecaca;
  outline: none;
  box-shadow: 0 12px 30px -14px rgba(244, 63, 94, 0.5);
  animation: cmt-err-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.comentario-error-banner svg {
  flex-shrink: 0;
  color: #f87171;
  margin-top: 0.1rem;
}
.comentario-error-banner strong {
  display: block;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.comentario-error-banner p {
  margin: 0;
  color: #fecaca;
  font-size: 0.93rem;
  line-height: 1.5;
}
.comentario-error-banner.shake {
  animation: cmt-err-shake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes cmt-err-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes cmt-err-shake {
  10%, 90%  { transform: translateX(-2px); }
  20%, 80%  { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60%  { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .comentario-error-banner,
  .comentario-error-banner.shake { animation: none; }
}

@media (max-width: 600px) {
  .comentario-row { grid-template-columns: 1fr; }
  .comentario { padding: 1rem 1rem; gap: 0.7rem; }
  .comentario-avatar { flex: 0 0 36px; width: 36px; height: 36px; font-size: 0.92rem; }
}

/* ─── Comentarios admin (panel de moderación) ─────────────────────── */
.cmt-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
}
.cmt-tabs .cmt-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.05rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text);
  text-decoration: none !important;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cmt-tabs .cmt-tab:hover {
  background: rgba(99, 102, 241, 0.10);
  border-color: rgba(99, 102, 241, 0.35);
}
.cmt-tabs .cmt-tab.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
  color: var(--primary-light);
}
.cmt-tabs .cmt-tab-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 1.6rem;
  text-align: center;
}
.cmt-tabs .cmt-tab.active .cmt-tab-count {
  background: rgba(99, 102, 241, 0.32);
  color: #c7d2fe;
}
/* Tab "Pendientes" cuando hay alguno → en rojo, llama la atención */
.cmt-tabs .cmt-tab-pend.active {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.55);
  color: #fda4af;
}
.cmt-tabs .cmt-tab-pend.active .cmt-tab-count {
  background: rgba(244, 63, 94, 0.32);
  color: #fecdd3;
}
.cmt-admin-list {
  display: flex; flex-direction: column;
  gap: 1rem;
}
.cmt-admin-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}
.cmt-admin-item.is-pending {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.04);
}
.cmt-admin-head {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.86rem;
}
.cmt-admin-author strong { color: var(--text); margin-right: 0.5rem; }
.cmt-admin-email, .cmt-admin-web {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.84rem;
  margin-right: 0.6rem;
}
.cmt-admin-email:hover, .cmt-admin-web:hover { color: var(--primary-light); }
.cmt-admin-meta {
  display: flex; align-items: center; gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 0.78rem;
}
.cmt-admin-status {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cmt-admin-status.ok   { background: rgba(34,197,94,0.18);  color: #86efac; }
.cmt-admin-status.pend { background: rgba(244,63,94,0.18);  color: #fda4af; }
.cmt-admin-ip {
  background: rgba(255,255,255,0.05);
  padding: 0 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
}
.cmt-admin-noticia {
  margin: 0 0 0.7rem;
  font-size: 0.84rem;
  color: var(--text-soft);
}
.cmt-admin-noticia a { color: var(--primary-light); text-decoration: none; }
.cmt-admin-noticia a:hover { text-decoration: underline; }
.cmt-admin-body {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.cmt-admin-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}

/* ─── Blog: listado de noticias (formato vertical, estilo Medium) ─── */
.blog-page {
  max-width: 820px;
  margin: 0 auto;
}
.blog-search {
  margin: 0 auto 1.4rem;
  max-width: 640px;
}
.blog-search-summary {
  text-align: center;
  color: var(--text-muted);
  margin: -0.4rem auto 1.5rem;
  font-size: 0.95rem;
}
.blog-list {
  display: flex;
  flex-direction: column;
}
.blog-post {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-post:first-child { padding-top: 0.8rem; }
.blog-post:last-child  { border-bottom: 0; }
.blog-post-link {
  display: block;
  text-decoration: none;
  color: var(--text);
}
.blog-post-cover {
  aspect-ratio: 16 / 8.5;
  background-size: contain;           /* muestra toda la imagen, sin recortar */
  background-repeat: no-repeat;
  background-position: center;
  background-color: rgba(99, 102, 241, 0.08);
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-bottom: 1.4rem;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease, border-color 0.3s ease;
  box-shadow: 0 14px 38px -22px rgba(0, 0, 0, 0.55);
}
.blog-post-link:hover .blog-post-cover {
  transform: scale(1.012);
  border-color: var(--border-strong);
  box-shadow: 0 18px 48px -20px rgba(99, 102, 241, 0.45);
}
.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.7rem;
}
.blog-post-meta time { color: var(--primary-light); }
.blog-post-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 16px -6px rgba(236, 72, 153, 0.55);
}
.blog-post-tag svg { color: #fde68a; }
.blog-post-title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
  margin: 0 0 0.7rem;
  color: var(--text);
  transition: color 0.2s ease;
}
.blog-post-link:hover .blog-post-title {
  color: var(--primary-light);
}
.blog-post-summary {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 0 1rem;
}
.blog-post-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-light);
}
.blog-post-cta svg {
  width: 16px; height: 16px;
  transition: transform 0.3s ease;
}
.blog-post-link:hover .blog-post-cta svg {
  transform: translateX(5px);
}

/* Hero (primer post + destacado): tipografía y portada extra grandes */
.blog-post-hero {
  padding-top: 0.4rem;
  padding-bottom: 3rem;
}
.blog-post-hero .blog-post-cover {
  aspect-ratio: 16 / 7.5;
  margin-bottom: 1.8rem;
  border-color: rgba(236, 72, 153, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18),
              0 26px 60px -22px rgba(236, 72, 153, 0.4);
}
.blog-post-hero .blog-post-title {
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  line-height: 1.18;
}
.blog-post-hero .blog-post-summary {
  font-size: 1.1rem;
}

/* Destacado (no-hero): borde rosado en portada */
.blog-post-featured .blog-post-cover {
  border-color: rgba(236, 72, 153, 0.32);
}

/* Sin imagen: el bloque de texto se centra y respira */
.blog-post-noimage .blog-post-text {
  padding: 0;
}

.blog-pager { margin-top: 2rem; }

@media (max-width: 640px) {
  .blog-post { padding: 1.75rem 0; }
  .blog-post-cover { border-radius: 10px; margin-bottom: 1rem; }
  .blog-post-summary { font-size: 0.95rem; }
  .blog-post-hero { padding-bottom: 2rem; }
}

/* ─── Filtro RD 3/2023 en certificados.php ───────────────────────────── */
.cert-filter-rd {
  display: flex;
  gap: 0.6rem;
  margin: 1rem auto 1.75rem;
  max-width: 1100px;
  flex-wrap: wrap;
  padding: 0 1rem;
}
.cert-rd-btn {
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cert-rd-btn:hover {
  background: rgba(99, 102, 241, 0.10);
  border-color: rgba(99, 102, 241, 0.35);
}
.cert-rd-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
  color: var(--primary-light);
}
.cert-rd-btn-new.active {
  background: rgba(20, 184, 166, 0.18);
  border-color: rgba(20, 184, 166, 0.55);
  color: #5eead4;
}
.cert-rd-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cert-rd-btn.active .cert-rd-count {
  background: rgba(99, 102, 241, 0.32);
  color: #c7d2fe;
}
.cert-rd-btn-new.active .cert-rd-count {
  background: rgba(20, 184, 166, 0.32);
  color: #99f6e4;
}

/* ─── Banner "Pendiente de horas" en filas de certificados ─────────── */
.cert-pendiente-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  font-size: 0.88rem;
  line-height: 1.4;
}
.cert-pendiente-banner svg { flex-shrink: 0; opacity: 0.9; }
.cert-pendiente-banner strong { color: #fecaca; font-weight: 700; }

/* Banner pendiente: COMPACTO + CENTRADO (versión final) */
.cert-pendiente-cell {
  text-align: center !important;
  padding: 0 0 0.75rem 0 !important;
  background: transparent !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
}
.cert-pendiente-row .cert-pendiente-banner {
  display: inline-flex !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1.4rem;     /* ~1 cm extra horizontal */
  margin: 0 auto !important;
  width: auto;
  max-width: calc(100% - 2rem);
  font-size: 0.84rem;
}

/* Quitar línea horizontal entre fila cert y banner pendiente
   (la línea base está en .cert-table tbody tr { border-bottom },
    así que hay que anularla en el tr Y en sus celdas) */
.cert-table tbody tr:has(+ .cert-pendiente-row),
.cert-table tbody tr:has(+ tr.cert-pendiente-row),
.cert-table tbody tr:has(+ .cert-pendiente-row) > td,
.cert-table tbody tr:has(+ tr.cert-pendiente-row) > td,
.cert-table tbody tr:has(+ tr.cert-pendiente-row) > th {
  border-bottom: 0 !important;
  box-shadow: none !important;
}
.cert-pendiente-row,
.cert-pendiente-row > td {
  border-top: 0 !important;
  box-shadow: none !important;
}
.cert-pendiente-row > td {
  padding-top: 0.5rem !important;
  padding-bottom: 0.6rem !important;
}
/* Restaurar separador horizontal DESPUÉS de la fila banner
   (entre el banner y el siguiente certificado) */
.cert-table tbody tr.cert-pendiente-row,
.cert-table tbody tr.cert-pendiente-row > td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Columna "Horas según R.D." (cert pendientes) */
.mods-table th.grp-pendiente {
  background: rgba(244, 63, 94, 0.14);
  color: #fecaca;
  border-color: rgba(244, 63, 94, 0.42);
  text-align: center;
  line-height: 1.25;
}
.mods-table th.grp-pendiente small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  margin-top: 0.25rem;
  opacity: 0.88;
  white-space: normal;
  letter-spacing: 0;
  text-transform: none;
}
.mods-table td.grp-pendiente {
  background: rgba(244, 63, 94, 0.06);
  font-weight: 600;
  color: #fda4af;
}
.grp-pendiente-title {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Reparto de columnas en tabla pendiente */
.mods-table-pendiente { table-layout: auto; }
.mods-table-pendiente thead th:nth-child(1) { width: 22%; min-width: 130px; }
.mods-table-pendiente thead th:nth-child(2) { width: 9%;  min-width: 70px; }
.mods-table-pendiente thead th:nth-child(3) { width: 41%; }
.mods-table-pendiente thead th.grp-pendiente { width: 28%; min-width: 240px; }

@media (max-width: 720px) {
  .grp-pendiente-title { white-space: normal; font-size: 0.82rem; }
}

/* ─── Tarjeta Ofertas: badges "Nuevo" / "Próximamente" ───────────────── */
.card-new {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  border: 1px solid rgba(20, 184, 166, 0.42);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card h3 .card-count {
  display: inline-block;
  margin-left: 0.4rem;
  background: rgba(99, 102, 241, 0.20);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.40);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.card-soon {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.40);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-disabled {
  opacity: 0.72;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.15);
}
.card-disabled:hover { transform: none; }
.card-disabled .card-icon { filter: saturate(0.7); }
/* Badge rojo "Desactivado": distinto del amarillo "Próximamente" (.card-soon)
   para diferenciar "apagado conscientemente" vs "viene pronto". */
.card-off {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.45);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-cta-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  font-style: italic;
  font-size: 0.92rem;
  margin-top: 0.4rem;
}
.card-cta-soon svg { opacity: 0.75; flex-shrink: 0; }

/* =========================================================================
 *  Área privada de centros (/centros/*)
 *  Estilos para dashboard, ofertas, candidaturas, perfil y formularios auth.
 * ========================================================================= */

/* Variantes adicionales de .alert reutilizadas por el admin y los centros */
.alert.warning { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); color: #fcd34d; }
.alert.danger  { background: rgba(244, 63, 94,  0.12); border: 1px solid rgba(244, 63, 94, 0.4);  color: #fda4af; }

/* Body del área (más compacto que la home) */
body.centros-area main { padding-top: 1rem; }
body.centros-auth main { max-width: 540px; margin: 0 auto; }

/* Topnav: zona derecha con saludo + botón Salir */
.centros-topnav-info {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.centros-topnav-greeting {
  font-size: 0.92rem;
  color: var(--text-muted);
}
.centros-topnav-greeting strong { color: var(--text); font-weight: 700; }

/* Pestañas de navegación interna */
.centros-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 auto 2rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 960px;
  width: fit-content;
}
.centros-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.centros-tabs a:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.centros-tabs a.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(168,85,247,0.16));
  color: var(--text);
  border-color: rgba(99,102,241,0.45);
}
.centros-tabs svg { flex-shrink: 0; }

/* Grid de estadísticas del dashboard */
.centros-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 0 0 2.5rem;
}
.centros-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}
.centros-stat:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.centros-stat-num {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary-light);
  letter-spacing: -0.01em;
}
.centros-stat-lbl {
  font-size: 0.82rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.centros-stat-muted .centros-stat-num { color: var(--text-soft); }
.centros-stat-active {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(168,85,247,0.12));
  border-color: rgba(99,102,241,0.45);
}

/* Banner de invitación al 2FA */
.tfa-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(168,85,247,0.10));
  border: 1px solid rgba(99,102,241,0.4);
  color: var(--text);
}
.tfa-banner-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.tfa-banner-text { flex: 1; min-width: 240px; }
.tfa-banner-text strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 0.3rem; }
.tfa-banner-text p { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.tfa-banner .btn { flex-shrink: 0; }

/* Auto-dismiss animation (los flashes admin/centros lo usan) */
@keyframes alertFadeOut {
  0%, 80%   { opacity: 1; transform: translateY(0); }
  100%      { opacity: 0; transform: translateY(-6px); }
}
.alert.auto-dismiss { animation: alertFadeOut 6s ease forwards; }

/* Ajuste responsive */
@media (max-width: 640px) {
  .centros-tabs { gap: 0.25rem; padding: 0.3rem; }
  .centros-tabs a { padding: 0.45rem 0.7rem; font-size: 0.82rem; }
  .centros-stat { padding: 0.9rem 1rem; }
  .centros-stat-num { font-size: 1.55rem; }
}

/* Radio buttons en forma de pastilla (oferta-editar: modalidad, método contacto) */
.radio-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.radio-pill:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
/* Ocultar input nativo (radio o checkbox) pero accesible (keyboard + a11y) */
.radio-pill input[type="radio"],
.radio-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
/* Estado seleccionado (funciona con radio y checkbox por igual) */
.radio-pill:has(input:checked) {
  background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(168,85,247,0.18));
  border-color: rgba(99,102,241,0.6);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.25), 0 4px 14px -6px rgba(99,102,241,0.6);
}
/* Focus visible (accesibilidad teclado) */
.radio-pill:has(input:focus-visible) {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
/* Estado deshabilitado */
.radio-pill:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
.radio-pill:has(input:disabled):hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text-muted);
}

/* =========================================================================
 *  Tablón público de ofertas de empleo
 *  /ofertas-empleo.php (listado), /oferta.php (detalle)
 * ========================================================================= */

/* Listado */
.ofertas-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0 0;
}

.oferta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.oferta-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.oferta-card-link {
  display: block;
  padding: 1.1rem 1.25rem;
  color: inherit;
  text-decoration: none;
}
.oferta-card-link:hover { text-decoration: none; }

.oferta-head { display: block; }
.oferta-head-flex {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

/* Logo del centro (mini cuadrado redondeado) */
.oferta-logo {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.oferta-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.oferta-logo-fallback {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.oferta-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.oferta-puesto {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
}

.oferta-centro {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.oferta-centro strong { color: var(--text); font-weight: 600; }

/* Tags + tipo + jornada */
.oferta-meta-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 0.25rem;
}
.oferta-meta-sep { color: var(--text-soft); opacity: 0.5; }

.oferta-tipo-formacion {
  color: var(--text-muted);
  font-weight: 500;
}

/* Pills genéricas para tags de oferta */
.oferta-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Tag de modalidad coloreado por valor data-mod */
.oferta-tag-modalidad[data-mod="presencial"]    { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; border-color: rgba(99,102,241,0.45); }
.oferta-tag-modalidad[data-mod="teleformacion"] { background: rgba(20, 184, 166, 0.18); color: #5eead4; border-color: rgba(20,184,166,0.45); }
.oferta-tag-modalidad[data-mod="aula_virtual"]  { background: rgba(168, 85, 247, 0.18); color: #c4b5fd; border-color: rgba(168,85,247,0.45); }
.oferta-tag-modalidad[data-mod="mixta"]         { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border-color: rgba(245,158,11,0.45); }

.oferta-tag-salario   { background: rgba(34, 197, 94, 0.16);  color: #86efac; border-color: rgba(34,197,94,0.4); }
.oferta-tag-tipo      { background: rgba(99, 102, 241, 0.14); color: var(--primary-light); border-color: rgba(99,102,241,0.35); }
.oferta-tag-deadline  { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(245,158,11,0.35); }

/* Pie de tarjeta (fecha + CTA) */
.oferta-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.oferta-foot-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.oferta-cta {
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ─── Detalle (/oferta.php) ──────────────────────────────────────────────── */
.oferta-detalle-wrap {
  max-width: 820px;
  margin: 0 auto;
}

.oferta-detalle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.oferta-detalle-head {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.6rem 1.8rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.oferta-logo-lg {
  width: 84px;
  height: 84px;
  border-radius: 16px;
}
.oferta-logo-lg .oferta-logo-fallback { font-size: 1.7rem; }

.oferta-detalle-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.oferta-detalle-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.oferta-detalle-centro {
  font-size: 1rem;
  color: var(--text-muted);
}
.oferta-detalle-centro strong { color: var(--text); }

.oferta-detalle-tags {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.oferta-detalle-body {
  padding: 1.6rem 1.8rem;
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.96rem;
}
.oferta-detalle-body h2,
.oferta-detalle-body h3 {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.4rem 0 0.6rem;
}
.oferta-detalle-body h2:first-child,
.oferta-detalle-body h3:first-child { margin-top: 0; }
.oferta-detalle-body p { margin: 0 0 0.9rem; }
.oferta-detalle-body ul,
.oferta-detalle-body ol { margin: 0 0 1rem 1.4rem; }
.oferta-detalle-body li { margin-bottom: 0.3rem; }

.oferta-desc { white-space: pre-wrap; }

.oferta-detalle-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.2rem 1.8rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.oferta-detalle-cta {
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 600px) {
  .oferta-card-link { padding: 0.9rem 1rem; }
  .oferta-head-flex { gap: 0.7rem; }
  .oferta-logo { width: 48px; height: 48px; border-radius: 10px; }
  .oferta-puesto { font-size: 1rem; }
  .oferta-foot { padding: 0.75rem 1rem; }
  .oferta-foot .oferta-cta { width: 100%; text-align: center; }
  .oferta-detalle-head,
  .oferta-detalle-body,
  .oferta-detalle-foot { padding-left: 1.1rem; padding-right: 1.1rem; }
  .oferta-detalle-title { font-size: 1.25rem; }
  .oferta-logo-lg { width: 64px; height: 64px; border-radius: 12px; }
}

/* =========================================================================
 *  Checkbox de consentimiento bonito (.consent-check)
 *  Usado en /aplicar-oferta.php, /alertas-ofertas.php, /centros/registro.php
 * ========================================================================= */
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.consent-check:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.consent-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.consent-check input[type="checkbox"]:hover {
  border-color: var(--primary-light);
}
.consent-check input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary), var(--accent-violet));
  border-color: var(--primary);
}
.consent-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.consent-check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
.consent-check:has(input[type="checkbox"]:checked) {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text);
}
.consent-check > span { flex: 1; }

/* =========================================================================
 *  Dropzone (drag-and-drop de archivos en /aplicar-oferta.php)
 * ========================================================================= */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 1.5rem 1.25rem;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible {
  background: var(--surface-hover);
  border-color: var(--primary-light);
  color: var(--text);
}
.dropzone:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 3px;
}
.dropzone.drag-over {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
  border-style: solid;
  color: var(--text);
  transform: scale(1.005);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}
.dropzone.has-files {
  border-style: solid;
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(255, 255, 255, 0.04);
}

/* El <input type="file"> nativo queda oculto pero accesible */
.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 0.4rem 0;
  pointer-events: none;
}
.dropzone-prompt svg {
  color: var(--primary-light);
  opacity: 0.85;
}
.dropzone-title {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text);
}
.dropzone-title strong { font-weight: 700; color: var(--text); }
.dropzone-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
}

/* Lista de archivos seleccionados */
.dropzone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dropzone.has-files .dropzone-list {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.dropzone-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text);
}
.dropzone-item-icon {
  flex-shrink: 0;
  font-size: 1.05rem;
  opacity: 0.85;
}
.dropzone-item-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropzone-item-size {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.dropzone-item-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.dropzone-item-remove:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

/* =========================================================================
 *  Logo uploader (/centros/perfil.php — campo "Logo del centro")
 * ========================================================================= */
.logo-uploader {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Caja de previsualización fija: 120x120, redondeada, con border */
.logo-uploader-preview {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.logo-uploader-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.logo-uploader-empty {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Columna derecha con controles */
.logo-uploader-controls {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

/* Input file nativo escondido pero accesible */
.logo-uploader-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* "Botón" que en realidad es un <label for="logo"> — al pulsar abre el
 * selector de archivos nativo. Heredea .btn-sm pero ajusta padding. */
.logo-uploader-trigger {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.logo-uploader-trigger:focus-within,
.logo-uploader-input:focus-visible + .logo-uploader-trigger {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Nombre del archivo seleccionado (lo escribe el JS) */
.logo-uploader-filename {
  font-size: 0.85rem;
  color: var(--primary-light);
  font-weight: 500;
  min-height: 1.2em;          /* reserva espacio para que no salte el layout */
  word-break: break-all;
}
.logo-uploader-filename:empty { display: none; }

.logo-uploader-remove {
  margin-top: 0.3rem;
}

@media (max-width: 520px) {
  .logo-uploader { gap: 1rem; }
  .logo-uploader-preview { width: 96px; height: 96px; border-radius: 12px; }
  .logo-uploader-empty { font-size: 1.55rem; }
}
