/* ==========================================================================
   TOPIC VIEWER - LECTURA Y ESTUDIO PROFUNDO DE CÉDULAS
   ========================================================================== */

.topic-viewer-container {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Columna Central de Lectura */
.topic-reading-col {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 24px 36px 80px 36px;
  max-width: 940px;
  margin: 0 auto;
  overscroll-behavior: contain;
}

/* Tarjeta Encabezado de la Cédula */
.topic-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.topic-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.topic-actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-subject-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topic-subject-badge.civil {
  background: var(--civil-bg);
  color: var(--civil-color);
  border: 1px solid var(--civil-border);
}

.topic-subject-badge.procesal {
  background: var(--procesal-bg);
  color: var(--procesal-color);
  border: 1px solid var(--procesal-border);
}

.topic-subject-badge.constitucional {
  background: var(--constitucional-bg);
  color: var(--constitucional-color);
  border: 1px solid var(--constitucional-border);
}

/* Título de la Cédula (Principal) */
.topic-h1-title {
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 2.2vw, 1.62rem);
  font-weight: 700;
  line-height: var(--lh-title, 1.28);
  color: var(--text-main);
  letter-spacing: 0.02em;
  margin: 8px 0 12px 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.topic-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.concept-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.concept-tag:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

/* Breadcrumbs Oficiales */
.topic-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.bc-discipline {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bc-discipline.civil { color: var(--civil-color); }
.bc-discipline.procesal { color: var(--procesal-color); }
.bc-discipline.constitucional { color: var(--constitucional-color); }

.bc-sep {
  width: 12px;
  height: 12px;
  color: var(--text-subtle);
}

.bc-chapter {
  color: var(--text-main);
  font-weight: 600;
}

.bc-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-primary);
  background: var(--bg-surface-elevated);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.topic-official-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-period-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.topic-coverage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topic-coverage-badge i {
  width: 12px;
  height: 12px;
}

.topic-coverage-badge.covered {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.topic-coverage-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Caja de Alerta Didáctica para Temas Pendientes */
.pending-topic-alert-box {
  margin: 20px 0;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%), var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.pending-alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pending-alert-header i {
  color: #f59e0b;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.pending-alert-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.pending-alert-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

.pending-required-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f59e0b;
  margin-bottom: 6px;
}

.pending-bullets-list {
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.5;
}

.pending-bullets-list li {
  margin-bottom: 4px;
}

.pending-upload-tip {
  font-size: 0.82rem;
  color: var(--gold-primary);
  background: var(--bg-surface-elevated);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--gold-border);
  margin: 0;
}

/* Quick Pills para Saltar entre Pilares */
.topic-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.quick-pill i {
  width: 13px;
  height: 13px;
}

.quick-pill:hover {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--gold-primary);
  transform: translateY(-1px);
}

/* Tarjeta Oficial del Temario AFG */
.afg-official-card {
  margin: 24px 0 32px 0;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.05) 0%, rgba(217, 119, 6, 0.01) 100%), var(--bg-surface);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.afg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.afg-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.afg-seal-icon {
  width: 28px;
  height: 28px;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.afg-box-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.afg-box-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.afg-code-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--gold-glow);
  color: var(--gold-primary);
  border: 1px solid var(--gold-border);
}

.afg-bullets-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px 16px;
}

.official-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.45;
}

.bullet-icon {
  width: 14px;
  height: 14px;
  color: var(--gold-primary);
  margin-top: 3px;
  flex-shrink: 0;
}

/* Cuerpo de Lectura Markdown */
.topic-markdown-body {
  font-size: 1rem;
  line-height: var(--lh-body, 1.7);
  color: var(--text-main);
}

.topic-markdown-body h2 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  color: var(--gold-primary);
  margin-top: 22px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  line-height: var(--lh-title, 1.28);
}

.topic-markdown-body h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 18px;
  margin-bottom: 8px;
  line-height: var(--lh-heading, 1.35);
}

.topic-markdown-body p {
  margin-bottom: 16px;
  line-height: var(--lh-body, 1.7);
}

.topic-markdown-body ul, 
.topic-markdown-body ol {
  margin-bottom: 18px;
  padding-left: 24px;
}

.topic-markdown-body li {
  margin-bottom: 6px;
  line-height: var(--lh-body, 1.7);
}

.topic-markdown-body blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  background: var(--bg-surface-elevated);
  border-left: 4px solid var(--gold-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
  line-height: var(--lh-body, 1.7);
}

.topic-markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-surface-elevated);
  color: var(--gold-primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* Enlaces Internos tipo [[Wikilink]] */
.wikilink {
  color: var(--gold-primary);
  background: var(--gold-glow);
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px dashed var(--gold-primary);
}

.wikilink:hover {
  background: var(--gold-primary);
  color: #0f172a;
}

/* Panel Lateral Derecho: Instituciones Relacionadas y Casos Vinculados */
.topic-aside-col {
  width: 360px;
  min-width: 360px;
  max-width: 380px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: transform var(--transition-normal);
}

.topic-aside-col.collapsed {
  display: none !important;
}

/* Encabezado del Panel Lateral con Botón de Cierre / Supresión */
.aside-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.aside-panel-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.aside-panel-header-title i {
  width: 16px;
  height: 16px;
}

.btn-close-aside {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-close-aside:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--gold-primary);
}

.btn-close-aside i {
  width: 14px;
  height: 14px;
}

.aside-block-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aside-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-primary);
  margin-bottom: 2px;
}

.aside-section-title i {
  width: 16px;
  height: 16px;
}

.aside-count-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.aside-section-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.35;
}

.linked-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tarjeta Enriquecida de Conexión Dogmática */
.linked-connection-card {
  padding: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 0 120px;
}

.linked-connection-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-subtle);
  transition: var(--transition-fast);
}

.linked-connection-card.civil::before {
  background: var(--civil-color);
}

.linked-connection-card.procesal::before {
  background: var(--procesal-color);
}

.linked-connection-card.constitucional::before {
  background: var(--constitucional-color);
}

.linked-connection-card:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  background: var(--bg-surface-hover);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.connection-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.connection-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.connection-crossover-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.connection-subject-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.connection-subject-badge.civil {
  color: var(--civil-color);
  background: var(--civil-bg);
}

.connection-subject-badge.procesal {
  color: var(--procesal-color);
  background: var(--procesal-bg);
}

.connection-subject-badge.constitucional {
  color: var(--constitucional-color);
  background: var(--constitucional-bg);
}

/* Insignias de Dirección de Conexión (PROMPT 059) */
.connection-direction-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.connection-direction-badge.emite,
.badge-emite {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.connection-direction-badge.recibe,
.badge-recibe {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.35);
}

.connection-direction-badge.mutua,
.badge-mutua {
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-primary);
  border-color: rgba(212, 175, 55, 0.40);
}

.connection-direction-badge.vinculada,
.badge-vinculada {
  background: rgba(100, 116, 139, 0.12);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.25);
}

/* Barra de Sentido / Explicación de Dirección (PROMPT 059) */
.connection-direction-bar {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.connection-direction-icon {
  font-weight: 700;
  color: var(--gold-primary);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.connection-direction-desc {
  font-style: italic;
}

/* Bloques de Agrupación por Taxonomía (PROMPT 059) */
.connection-group-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.connection-group-block:last-child {
  margin-bottom: 0;
}

.connection-group-header {
  padding: 6px 10px;
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.connection-group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.connection-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-primary);
}

.connection-group-count {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.20);
  color: var(--gold-primary);
}

.connection-group-glossary {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.connection-group-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connection-target-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0;
}

.connection-content-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Callouts de ¿Por qué se conectan? y Aplicación */
.connection-callout {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connection-callout.reason-box {
  background: rgba(212, 175, 55, 0.07);
  border-left: 2px solid var(--gold-primary);
}

.connection-callout.app-box {
  background: rgba(56, 189, 248, 0.06);
  border-left: 2px solid var(--civil-color);
}

.linked-connection-card.procesal .connection-callout.app-box {
  background: rgba(168, 85, 247, 0.06);
  border-left: 2px solid var(--procesal-color);
}

.linked-connection-card.constitucional .connection-callout.app-box {
  background: rgba(245, 158, 11, 0.06);
  border-left: 2px solid var(--constitucional-color);
}

.connection-callout-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.callout-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.connection-callout.reason-box .callout-icon {
  color: var(--gold-primary);
}

.connection-callout.app-box .callout-icon {
  color: var(--civil-color);
}

.linked-connection-card.procesal .connection-callout.app-box .callout-icon {
  color: var(--procesal-color);
}

.linked-connection-card.constitucional .connection-callout.app-box .callout-icon {
  color: var(--constitucional-color);
}

.connection-callout-text {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.42;
  margin: 0;
}

.connection-action-footer {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-primary);
  opacity: 0.85;
  transition: var(--transition-fast);
}

.linked-connection-card:hover .connection-action-footer {
  opacity: 1;
  transform: translateX(2px);
}

.footer-arrow-icon {
  width: 12px;
  height: 12px;
}

/* Meta información del destino en cabecera */
.connection-target-meta {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: auto;
}

/* Caja de cita textual verbatim del apunte */
.connection-quote-box {
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--gold-primary);
  font-size: 0.75rem;
  line-height: 1.45;
  color: #e2e8f0;
}

.connection-quote-glyph {
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.connection-quote-ref {
  color: var(--text-muted);
  font-size: 0.70rem;
  font-weight: 500;
}

.connection-quote-box mark.vault-highlight {
  background: rgba(212, 175, 55, 0.25);
  color: var(--gold-primary);
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 600;
}

/* Botón interactivo de salto con snippet en el pie */
.btn-jump-connection {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--gold-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-jump-connection:hover {
  color: #fbbf24;
  text-decoration: underline;
}

.btn-jump-connection:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

/* Estado vacío honesto para cruces dogmáticos */
.connections-empty-state {
  padding: 20px 14px;
  text-align: center;
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.connections-empty-icon {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.connections-empty-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.connections-empty-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.connections-unvalidated-suggestions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.unvalidated-suggestion-card {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  transition: var(--transition-fast);
}

.unvalidated-suggestion-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface-hover);
}

.unvalidated-badge {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.unvalidated-suggestion-card .suggestion-title {
  font-size: 0.78rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Tarjeta Clásica (Compatibilidad) */
.linked-topic-card {
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.linked-topic-card:hover {
  border-color: var(--gold-primary);
  transform: translateX(3px);
  background: var(--bg-surface-hover);
}

.linked-topic-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}

.linked-topic-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Casos Prácticos Vinculados en el Panel Lateral */
.linked-case-card {
  padding: 12px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.linked-case-card:hover {
  border-color: var(--gold-primary);
  background: var(--bg-surface-hover);
}

.linked-case-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.linked-case-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.linked-case-cta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

/* ==========================================================================
   BADGES DE COBERTURA DE APUNTES & ALERTA DE PENDIENTES
   ========================================================================== */

.topic-coverage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: var(--transition-fast);
}

.topic-coverage-badge i {
  width: 14px;
  height: 14px;
}

.topic-coverage-badge.covered {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.1);
}

.topic-coverage-badge.pending {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

.quick-pill.apunte-highlight {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.quick-pill.apunte-highlight:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: #34d399;
  color: #6ee7b7;
}

/* Caja Didáctica de Cédula Pendiente de Apuntes */
.pending-topic-alert-box {
  margin: 20px 0 24px 0;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(217, 119, 6, 0.03) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-md);
  display: flex;
  gap: 18px;
  align-items: flex-start;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.alert-icon-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  flex-shrink: 0;
}

.alert-icon-area i {
  width: 24px;
  height: 24px;
}

.alert-content-area {
  flex: 1;
}

.alert-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f59e0b;
  margin-bottom: 6px;
}

.alert-content-area h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.alert-content-area p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.alert-content-area code {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: monospace;
}

.alert-requirements-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-requirements-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}

.alert-requirements-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-main);
}

.alert-requirements-list li i {
  width: 14px;
  height: 14px;
  color: #f59e0b;
  flex-shrink: 0;
}

/* ==========================================================================
   TIPOGRAFÍA Y ELEMENTOS DE APUNTES JURÍDICOS (LECTURA PURA)
   ========================================================================== */

.topic-rendered-content {
  margin-top: 24px;
  font-size: 1.05rem;
  line-height: var(--lh-body, 1.7);
  color: var(--text-main);
}

.reading-h1 {
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 700;
  color: var(--gold-primary);
  margin: 22px 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-subtle);
  line-height: var(--lh-title, 1.28);
  word-break: break-word;
}

.reading-h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-primary);
  margin: 18px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  line-height: var(--lh-title, 1.28);
  word-break: break-word;
}

.reading-h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 15px 0 6px 0;
  border-left: 3px solid var(--gold-primary);
  padding-left: 10px;
  line-height: var(--lh-heading, 1.35);
  word-break: break-word;
}

.reading-h4 {
  font-size: 1.0rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 12px 0 4px 0;
  line-height: var(--lh-heading, 1.35);
}

.reading-h5 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #cbd5e1;
  margin: 10px 0 4px 0;
  text-decoration: underline;
  text-decoration-color: rgba(234, 179, 8, 0.4);
  text-underline-offset: 4px;
  line-height: var(--lh-heading, 1.35);
}

.reading-h6 {
  font-size: 0.86rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 10px 0 4px 0;
  line-height: var(--lh-heading, 1.35);
}

.reading-p {
  margin-bottom: 18px;
  text-align: justify;
  line-height: var(--lh-body, 1.7);
}

/* Listas estilizadas */
.ol-item, .ul-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding-left: 12px;
  line-height: var(--lh-body, 1.7);
}

.ul-item-nested {
  padding-left: 28px;
  margin-top: 3px;
  margin-bottom: 5px;
}

.ul-item-nested .ul-bullet {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ol-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-primary);
  min-width: 20px;
}

.ul-bullet {
  color: var(--gold-primary);
  font-size: 0.8rem;
  min-width: 14px;
}

.ol-content, .ul-content {
  flex: 1;
}

/* Tablas comparativas jurídicas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  position: relative;
}

.table-responsive:focus-visible {
  outline: 2px solid var(--gold-primary, #d4af37);
  outline-offset: 2px;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-subtle, rgba(212, 175, 55, 0.25));
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary, #d4af37);
}

.reading-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: var(--lh-table, 1.6);
  text-align: left;
}

.reading-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--gold-primary);
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-subtle);
  letter-spacing: 0.02em;
  min-width: 140px;
  white-space: normal;
  line-height: var(--lh-table, 1.6);
}

.reading-table th:first-child,
.reading-table td:first-child {
  min-width: 150px;
  font-weight: 600;
}

.reading-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: top;
  min-width: 180px;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  line-height: var(--lh-table, 1.6);
}

.reading-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.reading-table tr:last-child td {
  border-bottom: none;
}

.reading-table tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

/* Cajas de Mapas Conceptuales y Red Flags */
.callout-card {
  margin: 28px 0;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  line-height: var(--lh-dense, 1.5);
}

.callout-card .callout-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: var(--lh-heading, 1.35);
}

.callout-warning {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(185, 28, 28, 0.04) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 5px solid #ef4444;
}

.callout-warning .callout-title {
  color: #f87171;
}

.callout-concept {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-left: 5px solid #3b82f6;
}

.callout-concept .callout-title {
  color: #60a5fa;
}

/* ==========================================================================
   ACORDEÓN INLINE: INSTITUCIONES RELACIONADAS (DENTRO DEL APUNTE)
   ========================================================================== */
.inline-connections-box {
  margin: 32px 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-toggle-inline {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-surface-elevated);
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.btn-toggle-inline:hover {
  background: var(--bg-surface-hover);
}

.btn-toggle-inline-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-toggle-inline-left i {
  width: 18px;
  height: 18px;
}

.inline-toggle-state-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.inline-toggle-state-text i {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.btn-toggle-inline.expanded .inline-toggle-state-text i {
  transform: rotate(180deg);
}

.inline-connections-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--border-subtle);
}

.inline-connections-body.collapsed {
  display: none;
}

/* Quick pill destacada para abrir panel de cruces */
.quick-pill-crossover {
  background: rgba(212, 175, 55, 0.12) !important;
  border-color: var(--gold-primary) !important;
  color: var(--gold-primary) !important;
  cursor: pointer;
}

.quick-pill-crossover:hover {
  background: rgba(212, 175, 55, 0.22) !important;
}

/* ==========================================================================
   RESPONSIVO: NOTEBOOKS Y LAPTOPS (1025px a 1366px)
   ========================================================================== */
@media (min-width: 1025px) and (max-width: 1366px) {
  .topic-reading-col {
    padding: 20px 24px 70px 24px;
    max-width: 100%;
  }

  .topic-header-card {
    padding: 16px 20px;
    margin-bottom: 18px;
  }

  .topic-h1-title {
    font-size: 1.35rem;
    line-height: var(--lh-title, 1.28);
    margin: 6px 0 10px 0;
  }

  .reading-h1 {
    font-size: 1.32rem;
    margin: 18px 0 8px 0;
    padding-bottom: 6px;
    line-height: var(--lh-title, 1.28);
  }

  .reading-h2 {
    font-size: 1.16rem;
    margin: 14px 0 6px 0;
    padding-bottom: 4px;
    line-height: var(--lh-title, 1.28);
  }

  .reading-h3 {
    font-size: 1.04rem;
    margin: 12px 0 4px 0;
    line-height: var(--lh-heading, 1.35);
  }

  .reading-p {
    font-size: 0.98rem;
    line-height: var(--lh-body, 1.7);
    margin-bottom: 14px;
  }

  .topic-aside-col {
    width: 290px;
    min-width: 290px;
    max-width: 300px;
    padding: 18px 14px;
    gap: 18px;
  }

  .afg-official-card {
    padding: 16px 18px;
    margin: 18px 0 22px 0;
  }

  .afg-box-title {
    font-size: 1.05rem;
  }

  .afg-bullets-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 6px 12px;
  }
}

/* ==========================================================================
   RESPONSIVO: TOPIC VIEWER EN MÓVIL Y TABLET (Hasta 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .topic-viewer-container {
    position: relative;
  }

  .topic-reading-col {
    padding: 14px 14px 70px 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow-x: clip;
  }

  .topic-header-card {
    padding: 14px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-md);
  }

  .topic-breadcrumbs {
    font-size: 0.72rem;
    gap: 4px;
    margin-bottom: 8px;
    line-height: var(--lh-dense, 1.5);
  }

  .topic-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    line-height: var(--lh-dense, 1.5);
  }

  .topic-official-tags {
    width: 100%;
    justify-content: flex-start;
  }

  .topic-actions-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .topic-actions-group .btn {
    flex: 1;
    min-height: 36px;
    justify-content: center;
    font-size: 0.74rem;
    padding: 6px 8px;
    line-height: var(--lh-dense, 1.5);
  }

  .topic-h1-title {
    font-size: clamp(1.1rem, 4.2vw, 1.28rem);
    line-height: var(--lh-title, 1.28);
    margin: 6px 0 10px 0;
  }

  .reading-h1 {
    font-size: 1.22rem;
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    line-height: var(--lh-title, 1.28);
  }

  .reading-h2 {
    font-size: 1.12rem;
    margin: 14px 0 6px 0;
    padding-bottom: 4px;
    line-height: var(--lh-title, 1.28);
  }

  .reading-h3 {
    font-size: 1.02rem;
    margin: 12px 0 4px 0;
    padding-left: 8px;
    line-height: var(--lh-heading, 1.35);
  }

  .reading-h4 {
    font-size: 0.94rem;
    margin: 10px 0 4px 0;
    line-height: var(--lh-heading, 1.35);
  }

  .reading-h5 {
    font-size: 0.88rem;
    margin: 8px 0 4px 0;
    line-height: var(--lh-heading, 1.35);
  }

  .reading-p {
    text-align: left;
    font-size: 0.94rem;
    line-height: var(--lh-body, 1.7);
    margin-bottom: 14px;
  }

  .topic-rendered-content {
    font-size: 0.94rem;
    line-height: var(--lh-body, 1.7);
  }

  /* Prevenir desbordes horizontales de código y citas (las tablas usan .table-responsive) */
  .topic-rendered-content pre,
  .topic-rendered-content blockquote {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
  }

  .table-responsive {
    margin: 18px 0;
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  .reading-table {
    min-width: 520px;
  }

  .reading-table th,
  .reading-table td {
    padding: 10px 12px;
    font-size: 0.86rem;
  }

  .afg-official-card {
    padding: 12px 14px;
    margin: 14px 0 18px 0;
    border-radius: var(--radius-md);
  }

  .afg-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .afg-box-title {
    font-size: 1rem;
  }

  .afg-bullets-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pending-topic-alert-box {
    flex-direction: column;
    padding: 14px;
    gap: 10px;
  }

  .alert-requirements-list {
    grid-template-columns: 1fr;
  }

  /* Panel lateral se convierte en Drawer flotante suprimible */
  .topic-aside-col {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 88vw;
    height: 100%;
    height: 100dvh;
    z-index: 100;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .topic-aside-col:not(.open) {
    transform: translateX(100%);
    pointer-events: none;
    display: none;
  }

  .topic-aside-col.open {
    transform: translateX(0);
    pointer-events: auto;
    display: flex !important;
  }
}

