/* ===== HERRAMIENTAS / BASE ===== */
.herr-main {
  padding: 116px var(--space-3) var(--space-8);
  background: linear-gradient(135deg, var(--background-light) 0%, var(--gray-50) 100%);
  min-height: 100vh;
}

.herr-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.herr-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  align-items: flex-start;
}

.herr-content {
  width: 100%;
  flex: 1;
  min-width: 0;
}

.herr-sidebar {
  width: 320px;
  flex-shrink: 0;
  position: relative;
  align-self: flex-start;
  display: none;
}

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 1024px) {
  .herr-main {
    padding-top: 136px;
  }

  .herr-layout {
    flex-direction: row;
    gap: var(--space-8);
    align-items: flex-start;
  }

  .herr-content {
    flex: 1;
    min-width: 0;
  }

  .herr-sidebar {
    display: block;
  }

  .herr-sidebar .ec-ads-sidebar {
    position: sticky;
    top: 136px;
  }
}

/* ===== MOBILE AJUSTES ===== */
@media (max-width: 768px) {
  .herr-main {
    padding-top: 110px;
    padding-inline: var(--space-3);
  }

  .herr-container {
    padding: 0;
  }
}

@media (max-width: 480px) {
  .herr-main {
    padding-top: 100px;
    padding-inline: var(--space-2);
  }
}

/* ===== HERO ===== */
.herr-hero-card,
.hero-materiales {
  position: relative;
  margin-bottom: var(--space-6);
  padding: var(--space-6) var(--space-5);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  text-align: center;
}

.herr-hero-card::before,
.hero-materiales::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.herr-title,
.titulo-niveles-principal {
  margin: 0 0 var(--space-3);
  color: var(--dark-text);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
}

.herr-title span,
.titulo-niveles-principal span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.herr-subtitle,
.subtitulo-niveles-principal {
  margin: 0 auto;
  max-width: 820px;
  color: var(--medium-text);
  font-size: var(--text-sm);
  line-height: 1.7;
  text-align: center;
}

/* ===== GRID INTERNO ===== */
.herr-calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 1100px) {
  .herr-calc-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: stretch;
  }

  .herr-detail-card {
    grid-column: 1 / -1;
  }

  .herr-form-card,
  .herr-result-card {
    height: 100%;
  }
}

/* ===== TARJETAS ===== */
.herr-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.18s ease;
}

.herr-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.herr-card-head {
  padding: var(--space-5) var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--gray-200);
}

.herr-card-head h2 {
  margin: 0 0 6px;
  color: #243447;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.25;
}

.herr-card-head p {
  margin: 0;
  color: var(--medium-text);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ===== FORM ===== */
.herr-form-card form {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  height: calc(100% - 88px);
}

.herr-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .herr-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.herr-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.herr-field-full {
  grid-column: 1 / -1;
}

.herr-field label {
  color: var(--dark-text);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.3;
}

.herr-field input,
.herr-field select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  color: var(--dark-text);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.herr-field input::placeholder {
  color: var(--gray-400);
}

.herr-field input:focus,
.herr-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.12);
}

.herr-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: var(--space-6);
  padding-bottom: var(--space-2);
}

/* ===== BOTONES ===== */
.herr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.herr-btn i {
  transition: transform 0.18s ease;
}

.herr-btn:hover i {
  transform: translateX(3px);
}

.herr-btn-primary {
  background: var(--gray-800);
  color: var(--white);
  border: 1px solid var(--gray-800);
}

.herr-btn-primary:hover {
  background: var(--gray-900);
  border-color: var(--gray-900);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}

.herr-btn-primary:hover span,
.herr-btn-primary:hover i {
  color: var(--primary);
}

.herr-btn-secondary {
  background: var(--white);
  color: var(--medium-text);
  border: 1px solid var(--gray-300);
}

.herr-btn-secondary:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.herr-btn-link {
  width: 100%;
}

/* ===== RESULTADOS ===== */
.herr-result-card {
  display: flex;
  flex-direction: column;
}

.herr-result-box {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  height: calc(100% - 88px);
}

.herr-metric-highlight {
  padding: var(--space-4);
  background: #eef6ff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-4);
}

.herr-metric-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .herr-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.herr-metric {
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
}

.herr-metric small {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.herr-metric strong {
  display: block;
  color: #475569;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.herr-metric-highlight strong {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  color: var(--primary-dark);
}

/* ===== DETALLE INFERIOR ===== */
.herr-detail-card {
  overflow: visible;
}

.herr-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  padding: var(--space-5);
  align-items: start;
}

@media (min-width: 900px) {
  .herr-detail-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    column-gap: var(--space-5);
  }
}

.herr-detail-col {
  min-width: 0;
}

.herr-detail-col-left,
.herr-detail-col-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.herr-detail-intro {
  margin-bottom: var(--space-4);
}

.herr-detail-intro h2 {
  margin: 0 0 6px;
  color: var(--dark-text);
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.2;
}

.herr-detail-intro p {
  margin: 0;
  color: var(--medium-text);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ===== TABLA DESGLOSE ===== */
.herr-breakdown {
  padding: 0;
}

.herr-breakdown table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.herr-breakdown tbody tr:not(:last-child) {
  border-bottom: 1px solid var(--gray-200);
}

.herr-breakdown th,
.herr-breakdown td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.herr-breakdown th {
  width: 55%;
  color: var(--medium-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.herr-breakdown td {
  color: var(--dark-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

/* ===== NOTA ===== */
.herr-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-xl);
  color: #9a3412;
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ===== CTA ===== */
.herr-cta-box {
  padding: var(--space-5);
  background: #f8fafc;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-2xl);
}

.herr-cta-title {
  margin: 0 0 8px;
  color: var(--dark-text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.herr-cta-text {
  margin: 0 0 var(--space-4);
  color: var(--medium-text);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ===== UTILIDADES ===== */
.hidden {
  display: none !important;
}

/* ===== AJUSTES MOBILE ===== */
@media (max-width: 768px) {
  .herr-title,
  .titulo-niveles-principal {
    font-size: 1.2rem;
  }

  .herr-hero-card,
  .hero-materiales {
    padding: var(--space-5) var(--space-4);
    margin-bottom: var(--space-5);
  }

  .herr-subtitle,
  .subtitulo-niveles-principal {
    font-size: 0.92rem;
    line-height: 1.65;
  }

  .herr-card-head,
  .herr-form-card form,
  .herr-result-box,
  .herr-detail-grid {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .herr-actions {
    flex-direction: column;
    padding-top: var(--space-5);
    padding-bottom: 0;
  }

  .herr-btn {
    width: 100%;
  }

  .herr-breakdown th,
  .herr-breakdown td {
    padding: 11px 12px;
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .herr-hero-card,
  .hero-materiales,
  .herr-card,
  .tarjeta-material,
  .mensaje-materiales {
    border-radius: var(--radius-xl);
  }

  .herr-card-head h2,
  .herr-detail-intro h2 {
    font-size: 1.05rem;
  }

  .herr-subtitle,
  .subtitulo-niveles-principal,
  .herr-card-head p,
  .herr-detail-intro p,
  .herr-note,
  .herr-cta-text {
    font-size: 0.92rem;
  }

  .herr-metric strong {
    font-size: 1.02rem;
  }

  .herr-metric-highlight strong {
    font-size: 1.45rem;
  }
}

/* ===== MOTION REDUCIDO ===== */
@media (prefers-reduced-motion: reduce) {
  .herr-card,
  .herr-btn,
  .herr-field input,
  .herr-field select,
  .herr-metric,
  .herr-hero-card,
  .hero-materiales,
  .tarjeta-material,
  .btn-material-ver,
  .btn-material-descargar,
  .btn-pagina,
  .buscador-colecciones-box,
  .buscador-colecciones-clear {
    transition: none !important;
    animation: none !important;
  }
}

.herr-doc-card .herr-result-box {
  height: auto;
}

.herr-doc-card .herr-actions {
  margin-top: 0;
}

/* ===== NORMAS: tarjetas parejas ===== */
.herr-doc-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.herr-doc-card .herr-card-head {
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.herr-doc-card .herr-card-head h2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 2;
  min-height: calc(1.2em * 2);
}

.herr-doc-card .herr-card-head p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 3;
  min-height: calc(1.5em * 3);
}

.herr-doc-card .herr-result-box {
  height: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: auto;
}

.herr-doc-card .herr-metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.herr-doc-card .herr-actions {
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.herr-doc-card .herr-btn-link {
  width: 100%;
}

/* =========================================================
   NORMAS / MATERIALES - ALINEADO AL JS REAL
========================================================= */

/* ===== CONTENEDOR PRINCIPAL ===== */
#contenedor-normas {
  width: 100%;
  padding: 0;
  opacity: 0;
  animation: fadeInNormas 0.35s ease forwards;
}

#contenedor-normas.loaded {
  opacity: 1;
}

@keyframes fadeInNormas {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== BUSCADOR ===== */
.buscador-colecciones-wrapper {
  width: 100%;
  max-width: 760px;
  margin: var(--space-5) auto 0;
}

.buscador-colecciones-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.buscador-colecciones-box:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.buscador-colecciones-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(1, 105, 111, 0.10);
}

.buscador-colecciones-box > i {
  position: absolute;
  left: 18px;
  font-size: 0.95rem;
  color: var(--medium-text);
  pointer-events: none;
}

.buscador-colecciones-input {
  width: 100%;
  min-height: 54px;
  padding: 0 52px 0 48px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--dark-text);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-full);
}

.buscador-colecciones-input::placeholder {
  color: var(--medium-text);
  font-weight: 400;
}

.buscador-colecciones-input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

.buscador-colecciones-clear {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--medium-text);
  cursor: pointer;
  transition: all 0.18s ease;
}

.buscador-colecciones-clear:hover {
  background: var(--gray-100);
  color: var(--dark-text);
  border-color: var(--gray-200);
}

.buscador-colecciones-info {
  margin: 10px 4px 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--medium-text);
  text-align: center;
  min-height: 1.2em;
}

/* ===== MENSAJES ===== */
.mensaje-materiales {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  color: var(--medium-text);
}

.mensaje-materiales i {
  display: block;
  margin-bottom: var(--space-3);
  font-size: 2rem;
  color: var(--primary);
}

.mensaje-materiales.error i {
  color: var(--error);
}

.mensaje-materiales p {
  margin: 0;
  font-size: var(--text-sm);
}

/* ===== GRID TARJETAS ===== */
.grid-materiales {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  width: 100%;
}

@media (min-width: 601px) {
  .grid-materiales {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid-materiales {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===== TARJETA DOCUMENTO ===== */
.tarjeta-material {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.18s ease;
  opacity: 0;
  transform: translateY(10px);
}

.tarjeta-material.fade-in {
  animation: cardFadeInMaterial 0.28s ease forwards;
}

@keyframes cardFadeInMaterial {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tarjeta-material:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.tarjeta-material-contenido {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.material-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.material-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #eef6ff;
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.material-badge i {
  color: var(--primary);
  font-size: 11px;
}

.material-titulo {
  margin: 0;
  color: var(--dark-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.coleccion-descripcion {
  margin: 0;
  color: var(--medium-text);
  font-size: var(--text-xs);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.material-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.material-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--background-light);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--medium-text);
  min-width: 0;
}

.material-meta-item i {
  color: var(--primary);
  font-size: 11px;
}

.material-meta-item span {
  min-width: 0;
  word-break: break-word;
}

.tarjeta-material-footer {
  padding: 0 14px 14px;
}

.tarjeta-material-botones {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.btn-material-ver {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 16px;
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-material-ver:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(1, 105, 111, 0.2);
}

.btn-material-ver i {
  transition: transform 0.18s ease;
}

.btn-material-ver:hover i {
  transform: scale(1.15);
}

.btn-material-ver--disabled,
.btn-material-ver[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  border-color: var(--gray-200);
  color: var(--medium-text);
}

.btn-material-descargar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 40px;
  padding: 10px 14px;
  background: var(--gray-800);
  color: var(--white);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-material-descargar:hover {
  background: var(--gray-900);
  border-color: var(--gray-900);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}

.btn-material-descargar i {
  transition: transform 0.18s ease;
}

.btn-material-descargar:hover i {
  transform: translateX(3px);
}

.btn-material-descargar--disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 40px;
  padding: 10px 14px;
  background: var(--gray-200);
  color: var(--medium-text);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: not-allowed;
  opacity: 0.6;
  white-space: nowrap;
}

/* ===== SKELETON ===== */
.skeleton-coleccion {
  padding: var(--space-4);
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-lg);
}

.skeleton-heading {
  height: 20px;
  width: 50%;
  margin-bottom: var(--space-3);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== VISOR MODAL ===== */
.visor-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.visor-modal.activo {
  display: flex;
}

.visor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.visor-modal-contenedor {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(95vw, 1100px);
  height: min(92vh, 860px);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.visor-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--background-light);
  flex-shrink: 0;
}

.visor-modal-titulo {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.visor-modal-acciones {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.visor-modal-btn-descarga {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.visor-modal-btn-descarga:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.visor-modal-btn-cerrar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-300);
  background: transparent;
  color: var(--medium-text);
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.18s ease, color 0.18s ease;
  flex-shrink: 0;
}

.visor-modal-btn-cerrar:hover {
  background: var(--gray-100);
  color: var(--dark-text);
  border-color: var(--gray-400);
}

.visor-modal-cuerpo {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}

.visor-modal-cuerpo iframe,
.visor-modal-cuerpo embed,
.visor-modal-cuerpo object {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  min-height: 400px;
  background: #fff;
}

.visor-imagen-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  flex: 1;
  background: var(--gray-50);
}

.visor-imagen-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.visor-aviso-office {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.78rem;
  background: #fffbec;
  border-bottom: 1px solid #f0e5a0;
  color: #7a6200;
  flex-shrink: 0;
  margin: 0;
}

.visor-aviso-office a {
  color: var(--primary);
  font-weight: 700;
}

.visor-sin-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  height: 100%;
  padding: var(--space-12) var(--space-6);
  color: var(--medium-text);
  text-align: center;
}

.visor-sin-preview i {
  color: var(--gray-400);
  margin-bottom: var(--space-2);
}

.visor-sin-preview p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
}

body.visor-abierto {
  overflow: hidden;
}

/* ===== PAGINACIÓN NORMAS ===== */
#paginacion-normas {
  width: 100%;
}

.paginacion-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-8) 0 var(--space-4);
}

.btn-pagina {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--medium-text);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pagina--nav {
  width: auto;
  min-width: 40px;
  padding: 0 var(--space-4);
}

.btn-pagina:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-pagina--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.btn-pagina--active:hover {
  color: var(--white);
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-pagina:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-pagina:disabled,
.btn-pagina.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* ===== RESPONSIVE NORMAS ===== */
@media (max-width: 768px) {
  .material-meta {
    flex-direction: column;
  }

  .tarjeta-material-botones {
    flex-direction: column;
  }

  .visor-modal-contenedor {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .visor-modal-titulo {
    font-size: 0.8rem;
  }

  .visor-modal-btn-descarga span {
    display: none;
  }

  .btn-material-ver,
  .btn-material-descargar,
  .btn-material-descargar--disabled {
    flex: unset;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .buscador-colecciones-wrapper {
    max-width: 100%;
  }

  .buscador-colecciones-box {
    min-height: 48px;
  }

  .buscador-colecciones-input {
    min-height: 48px;
    font-size: 0.9rem;
    padding-left: 42px;
    padding-right: 46px;
  }

  .buscador-colecciones-box > i {
    left: 14px;
  }

  .buscador-colecciones-clear {
    right: 8px;
    width: 32px;
    height: 32px;
  }

  .tarjeta-material-contenido,
  .tarjeta-material-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .tarjeta-material-footer {
    padding-bottom: 14px;
  }

  .material-titulo {
    font-size: 0.95rem;
  }

  .coleccion-descripcion {
    font-size: var(--text-xs);
  }

  .material-meta-item {
    font-size: 11px;
    padding: 4px 8px;
  }

  .paginacion-wrapper {
    gap: var(--space-2);
    padding-top: var(--space-6);
  }

  .btn-pagina {
    min-width: 38px;
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
  }

  .btn-pagina--nav {
    padding: 0;
    width: 36px;
    min-width: 36px;
    font-size: 0;
    gap: 0;
  }

  .btn-pagina--nav i {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .herr-doc-card .herr-card-head {
    min-height: auto;
  }

  .herr-doc-card .herr-card-head h2,
  .herr-doc-card .herr-card-head p {
    min-height: auto;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
  }
}