/* Base Cientifica - Estilos verde claro minimalista */

.bc-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
    background: #FAFCFA;
    color: #1A2A1A;
    padding: 32px 24px;
    border-radius: 12px;
    max-width: 1400px;
    margin: 20px auto;
    border: 1px solid #E5EBE5;
}

.bc-container * {
    box-sizing: border-box;
}

/* Header */
.bc-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #E5EBE5;
}

.bc-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: #1A2A1A;
    letter-spacing: -0.5px;
}

.bc-subtitle {
    font-size: 15px;
    color: #5C6E5C;
    margin: 0;
    font-weight: 400;
}

/* Controles */
.bc-controls {
    margin-bottom: 24px;
}

.bc-search-wrapper {
    margin-bottom: 16px;
}

.bc-search {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1.5px solid #E5EBE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #1A2A1A;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.bc-search:focus {
    outline: none;
    border-color: #7FB069;
    box-shadow: 0 0 0 3px rgba(127, 176, 105, 0.15);
}

.bc-search::placeholder {
    color: #9AAA9A;
}

/* Filtros */
.bc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.bc-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.bc-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #5C6E5C;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bc-filter-select {
    padding: 8px 10px;
    font-size: 14px;
    border: 1.5px solid #E5EBE5;
    border-radius: 6px;
    background: #FFFFFF;
    color: #1A2A1A;
    font-family: inherit;
    cursor: pointer;
}

.bc-filter-select:focus {
    outline: none;
    border-color: #7FB069;
}

.bc-filter-select[multiple] {
    min-height: 80px;
}

.bc-reset-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1.5px solid #7FB069;
    border-radius: 6px;
    color: #5A7F4B;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    height: 38px;
    font-family: inherit;
}

.bc-reset-btn:hover {
    background: #E8F0E5;
}

/* Stats */
.bc-stats {
    margin-bottom: 12px;
    font-size: 13px;
    color: #5C6E5C;
    padding: 8px 12px;
    background: #E8F0E5;
    border-radius: 6px;
    display: inline-block;
}

/* Tabla */
.bc-table-wrapper {
    /* v2.8.21: scroll vertical propio + max-height para que la cabecera sticky
       quede siempre visible al desplazar las filas. overflow ambos ejes. */
    max-height: 75vh;
    overflow: auto;
    border: 1px solid #E5EBE5;
    border-radius: 8px;
    background: #FFFFFF;
}

.bc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.bc-table thead {
    background: #F2F7EE;
}

.bc-table th {
    text-align: center;
    padding: 14px 12px;
    font-weight: 600;
    color: #1A2A1A;
    border-bottom: 2px solid #D5E5C5;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    /* v2.8.21: cabecera fija al hacer scroll. Fondo propio (sin el, las filas
       se transparentan por debajo) y box-shadow para mantener la linea inferior,
       que con border-collapse desaparece al scrollear. */
    position: sticky;
    top: 0;
    z-index: 5;
    background: #F2F7EE;
    box-shadow: inset 0 -2px 0 #D5E5C5;
}

.bc-table tbody tr {
    border-bottom: 1px solid #E5EBE5;
    cursor: pointer;
    transition: background 0.15s;
}

.bc-table tbody tr:hover {
    background: #F7FBF5;
}

.bc-table tbody tr.bc-row-expanded {
    background: #F2F7EE;
}

.bc-table tbody tr.bc-row-detail {
    background: #FAFCFA;
    cursor: default;
}

.bc-table tbody tr.bc-row-detail:hover {
    background: #FAFCFA;
}

.bc-table td {
    padding: 12px;
    vertical-align: top;
    color: #1A2A1A;
}

/* Anchos y alineación de las celdas <td> */
.bc-table td.bc-col-anio,
.bc-col-anio { font-variant-numeric: tabular-nums; }
.bc-table th.bc-col-anio,
.bc-table td.bc-col-anio { width: 70px; }

.bc-table th.bc-col-titulo,
.bc-table td.bc-col-titulo { min-width: 280px; max-width: 400px; }

.bc-table th.bc-col-autores,
.bc-table td.bc-col-autores { min-width: 160px; max-width: 200px; }

.bc-table th.bc-col-jerarquia,
.bc-table td.bc-col-jerarquia { width: 150px; }

.bc-table th.bc-col-modulo,
.bc-table td.bc-col-modulo { width: 70px; }

.bc-table th.bc-col-tematica,
.bc-table td.bc-col-tematica { min-width: 80px; max-width: 120px; }
.bc-table td.bc-col-tematica { cursor: help; }

.bc-table th.bc-col-relevancia,
.bc-table td.bc-col-relevancia { width: 110px; }

.bc-table th.bc-col-descargar,
.bc-table td.bc-col-descargar { width: 70px; }

/* Alineación de DATOS (no headers) - 8 columnas:
   1=Año, 2=Titulo, 3=Autores, 4=Jerarquia, 5=Modulo, 6=Tematica, 7=Relevancia, 8=PDF */
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(1),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(4),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(5),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(6),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(7),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(8) {
    text-align: center;
}
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(2),
.bc-table tbody tr:not(.bc-row-detail) td:nth-child(3) {
    text-align: left;
}

/* Badges de jerarquia */
.bc-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Colores segun gama Marina: verde (mayor evidencia) -> amarillo -> rosa (menor) */
.bc-badge-meta_analisis        { background: #B8D8B8; color: #2F5C2F; }  /* verde 1 */
.bc-badge-revision_sistematica { background: #C7DFB8; color: #3D6B2F; }  /* verde 2 */
.bc-badge-ensayo_clinico       { background: #E0EAB8; color: #5C6B2F; }  /* verde-amarillo */
.bc-badge-estudio_seguimiento  { background: #F0E8B8; color: #6E5C2F; }  /* amarillo 1 */
.bc-badge-caso_control         { background: #F5DCB8; color: #7A5527; }  /* amarillo 2 */
.bc-badge-estudio_transversal  { background: #F5CFB8; color: #804B27; }  /* naranja 1 */
.bc-badge-serie_casos          { background: #F5C0B8; color: #803F2F; }  /* naranja-rojo */
.bc-badge-estudio_preclinico   { background: #F2BCBC; color: #802F2F; }  /* rosa 1 */
.bc-badge-libro                { background: #EDB3B8; color: #80284A; }  /* rosa 2 */
.bc-badge-opinion_experto      { background: #E8B0BE; color: #802352; }  /* rosa 3 (menor) */
.bc-badge-otro                 { background: #E0E0E0; color: #666666; }

/* Relevancia (restaurada en v2.8.5) */
.bc-relevancia {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.bc-relevancia-si {
    background: #DBF0CC;
    color: #2C5C2C;
}

.bc-relevancia-no {
    background: #F0F0F0;
    color: #777777;
}

/* Boton PDF */
.bc-btn-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #7FB069;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    border: none;
    cursor: pointer;
}

.bc-btn-pdf:hover {
    background: #6A9A55;
    transform: translateY(-1px);
}

.bc-btn-pdf-disabled {
    background: #DDDDDD;
    color: #999999;
    cursor: not-allowed;
}

.bc-btn-pdf-disabled:hover {
    background: #DDDDDD;
    transform: none;
}

.bc-btn-pdf svg {
    width: 18px;
    height: 18px;
}

/* Detalle expandido */
.bc-detail-content {
    padding: 20px 24px;
    border-left: 4px solid #7FB069;
    background: #FAFCFA;
}

.bc-detail-section {
    margin-bottom: 16px;
}

.bc-detail-section:last-child {
    margin-bottom: 0;
}

.bc-detail-label {
    font-size: 11px;
    font-weight: 700;
    color: #5C6E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.bc-detail-text {
    font-size: 14px;
    line-height: 1.6;
    color: #1A2A1A;
    margin: 0;
}

/* v2.8: bloque de analisis por modulo en la fila expandida.
   Cada modulo donde el paper fue analizado tiene su propia tarjeta
   con su razon especifica (verde = relevante, gris = no relevante). */
.bc-detail-modulo-block {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    border-left: 3px solid #ccc;
    background: #fafbf9;
}
.bc-detail-modulo-block:last-child {
    margin-bottom: 0;
}
.bc-detail-modulo-rel {
    border-left-color: #5C8C3C;
    background: #f3f8ee;
}
.bc-detail-modulo-norel {
    border-left-color: #B0B0B0;
    background: #f7f7f5;
}
.bc-detail-modulo-block .bc-detail-label {
    margin-bottom: 4px;
}

.bc-detail-hallazgos {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bc-detail-hallazgos li {
    padding: 6px 0 6px 20px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    color: #1A2A1A;
}

.bc-detail-hallazgos li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #7FB069;
    font-weight: bold;
}

.bc-detail-respuesta {
    background: #FFFFFF;
    border: 1px solid #D5E5C5;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 10px;
}

.bc-detail-respuesta-pregunta {
    font-size: 14px;
    font-weight: 600;
    color: #1A2A1A;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5EBE5;
}

.bc-detail-cita-bloque {
    margin-bottom: 12px;
}

.bc-detail-cita-bloque:last-child {
    margin-bottom: 0;
}

.bc-detail-cita-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #5C6E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.bc-detail-respuesta-cita {
    font-style: italic;
    color: #4A5C4A;
    font-size: 13px;
    border-left: 3px solid #D5E5C5;
    padding-left: 12px;
    line-height: 1.5;
}

.bc-detail-respuesta-traducida {
    color: #1A2A1A;
    font-size: 13px;
    border-left: 3px solid #7FB069;
    padding-left: 12px;
    line-height: 1.5;
}

.bc-detail-respuesta-analisis {
    font-size: 13px;
    color: #1A2A1A;
    background: #F2F7EE;
    padding: 10px 12px;
    border-radius: 4px;
    margin: 0;
    line-height: 1.6;
}

.bc-detail-meta {
    font-size: 12px;
    color: #7B8A7B;
    padding-top: 10px;
    border-top: 1px solid #E5EBE5;
    margin-top: 14px;
}

.bc-detail-meta a {
    color: #5A7F4B;
    text-decoration: none;
}

.bc-detail-meta a:hover {
    text-decoration: underline;
}

/* Loading y errores */
.bc-loading,
.bc-empty {
    text-align: center;
    padding: 40px;
    color: #7B8A7B;
    font-size: 14px;
}

.bc-error {
    padding: 16px;
    background: #FDE7E7;
    color: #B82424;
    border-radius: 8px;
    border: 1px solid #F5C5C5;
    font-size: 14px;
}

/* Footer */
.bc-footer {
    margin-top: 20px;
    text-align: center;
    color: #9AAA9A;
}

/* Responsive */

/* LearnDash y layouts con sidebar (contenido entre 700-1000px) */
@media (max-width: 1100px) {
    .bc-container {
        padding: 24px 16px;
    }
    .bc-table {
        font-size: 13px;
    }
    .bc-table th,
    .bc-table td {
        padding: 10px 8px;
    }
    .bc-table td.bc-col-titulo {
        min-width: 200px;
        max-width: 300px;
    }
    /* Ocultar columna autores y tematica en sidebars estrechos */
    .bc-col-autores { display: none; }
}

@media (max-width: 768px) {
    .bc-container {
        padding: 20px 12px;
        border-radius: 0;
    }

    .bc-title { font-size: 22px; }

    .bc-filter-group { min-width: 100%; }

    .bc-table { font-size: 12px; }

    .bc-table th,
    .bc-table td {
        padding: 8px 6px;
    }

    .bc-col-autores,
    .bc-col-tematica,
    .bc-col-revista,
    .bc-col-anio { display: none; }
    
    /* En mobile, jerarquia compacta */
    .bc-jerarquia-cell {
        font-size: 11px;
    }
    
    /* Detail expanded en mobile */
    .bc-detail-section {
        margin-bottom: 12px;
    }
    .bc-detail-respuesta {
        padding: 10px;
    }
}

@media (max-width: 500px) {
    .bc-container { padding: 16px 8px; }
    .bc-title { font-size: 18px; }
    .bc-table { font-size: 11px; }
    .bc-col-doi,
    .bc-col-pmid { display: none; }
}


/* ============================================
   CHAT - estilos v2.0
   ============================================ */

.bc-chat-container {
    max-width: 900px;
}

.bc-chat-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

.bc-chat-input {
    flex: 1;
    padding: 14px 16px;
    font-size: 15px;
    border: 1.5px solid #E5EBE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #1A2A1A;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bc-chat-input:focus {
    outline: none;
    border-color: #7FB069;
    box-shadow: 0 0 0 3px rgba(127, 176, 105, 0.15);
}

.bc-chat-input:disabled {
    background: #F5F5F5;
    color: #999;
    cursor: not-allowed;
}

.bc-chat-send-btn {
    padding: 0 24px;
    background: #7FB069;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    min-width: 130px;
    align-self: stretch;
}

.bc-chat-send-btn:hover:not(:disabled) {
    background: #6A9A55;
}

.bc-chat-send-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.bc-chat-send-btn:disabled {
    background: #BBC9BB;
    cursor: not-allowed;
}

.bc-chat-status {
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    display: none;
}

.bc-chat-status:not(:empty) {
    display: block;
}

.bc-chat-status-loading {
    background: #E8F0E5;
    color: #5A7F4B;
    border: 1px solid #D5E5C5;
}

.bc-chat-status-loading::before {
    content: "⏳ ";
}

.bc-chat-status-error {
    background: #FDE7E7;
    color: #B82424;
    border: 1px solid #F5C5C5;
}

.bc-chat-response {
    background: #FFFFFF;
    border: 1px solid #E5EBE5;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

.bc-chat-answer-section {
    margin-bottom: 28px;
}

.bc-chat-answer {
    font-size: 15px;
    line-height: 1.7;
    color: #1A2A1A;
}

.bc-chat-answer h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1A2A1A;
    margin: 16px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #D5E5C5;
}

.bc-chat-answer h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1A2A1A;
    margin: 14px 0 8px 0;
}

.bc-chat-answer h4 {
    font-size: 15px;
    font-weight: 600;
    color: #5A7F4B;
    margin: 12px 0 6px 0;
}

.bc-chat-answer p {
    margin: 0 0 12px 0;
}

.bc-chat-answer p:last-child {
    margin-bottom: 0;
}

.bc-chat-answer ul {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.bc-chat-answer li {
    margin: 4px 0;
}

.bc-chat-answer strong {
    color: #1A2A1A;
    font-weight: 600;
}

.bc-chat-answer em {
    font-style: italic;
    color: #4A5C4A;
}

.bc-chat-paper-ref {
    display: inline-block;
    background: #E8F0E5;
    color: #5A7F4B;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    margin: 0 2px;
    transition: background 0.15s;
    cursor: pointer;
}

.bc-chat-paper-ref:hover {
    background: #D5E5C5;
    text-decoration: none;
}

.bc-chat-papers-section {
    border-top: 2px solid #E5EBE5;
    padding-top: 20px;
}

.bc-chat-papers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bc-chat-paper-card {
    background: #FAFCFA;
    border: 1px solid #E5EBE5;
    border-radius: 6px;
    padding: 14px 16px;
    transition: background 0.4s, border-color 0.4s;
}

.bc-chat-paper-highlight {
    background: #F2F7EE !important;
    border-color: #7FB069 !important;
}

.bc-chat-paper-header {
    margin-bottom: 6px;
    line-height: 1.4;
}

.bc-chat-paper-id {
    display: inline-block;
    background: #7FB069;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
    letter-spacing: 0.3px;
}

.bc-chat-paper-title {
    font-weight: 600;
    color: #1A2A1A;
    font-size: 14px;
}

.bc-chat-paper-autores {
    font-size: 12px;
    color: #5C6E5C;
    margin-bottom: 4px;
}

.bc-chat-paper-meta {
    font-size: 12px;
    color: #7B8A7B;
    margin-bottom: 4px;
}

.bc-chat-paper-doi {
    font-size: 12px;
    color: #7B8A7B;
    margin-bottom: 8px;
}

.bc-chat-paper-doi a {
    color: #5A7F4B;
    text-decoration: none;
}

.bc-chat-paper-doi a:hover {
    text-decoration: underline;
}

.bc-chat-paper-actions {
    margin-top: 8px;
}

.bc-chat-paper-pdf {
    display: inline-block;
    padding: 6px 14px;
    background: #7FB069;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}

.bc-chat-paper-pdf:hover {
    background: #6A9A55;
    text-decoration: none;
}

.bc-chat-paper-pdf-disabled {
    display: inline-block;
    padding: 6px 14px;
    background: #DDDDDD;
    color: #999;
    border-radius: 5px;
    font-size: 13px;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .bc-chat-input-wrapper {
        flex-direction: column;
    }
    .bc-chat-send-btn {
        min-width: 100%;
    }
}


/* ============================================
   PAGINACION v2.3
   ============================================ */
.bc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.bc-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #FFFFFF;
    border: 1px solid #D5E5C5;
    border-radius: 6px;
    color: #1A2A1A;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bc-page-btn:hover:not(:disabled) {
    background: #F2F7EE;
    border-color: #7FB069;
}

.bc-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bc-page-btn.bc-page-active {
    background: #7FB069;
    border-color: #7FB069;
    color: white;
}

.bc-page-btn.bc-page-active:hover {
    background: #6A9A55;
    border-color: #6A9A55;
}

.bc-page-dots {
    padding: 0 6px;
    color: #5C6E5C;
    font-size: 14px;
}


/* ============================================
   CHAT CONVERSACIONAL v2.4
   ============================================ */

/* Header del chat con boton "Nueva conversacion" a la derecha */
.bc-chat-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.bc-chat-new-btn {
    background: transparent;
    color: #5C6E5C;
    border: 1px solid #D5E5C5;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.bc-chat-new-btn:hover {
    background: #F2F7EE;
    border-color: #7FB069;
    color: #2F5C2F;
}

/* Contenedor de mensajes */
.bc-chat-messages {
    background: #FAFCF7;
    border: 1px solid #E5EFE0;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bc-chat-empty {
    color: #8C9C8C;
    font-style: italic;
    text-align: center;
    padding: 24px 0;
}

/* Burbujas estilo ChatGPT */
.bc-chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
}

.bc-chat-bubble-user {
    background: #7FB069;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bc-chat-bubble-assistant {
    background: #FFFFFF;
    color: #1A2A1A;
    align-self: flex-start;
    border: 1px solid #D5E5C5;
    border-bottom-left-radius: 4px;
}

.bc-chat-bubble-assistant p {
    margin: 0 0 10px 0;
}
.bc-chat-bubble-assistant p:last-child {
    margin-bottom: 0;
}
.bc-chat-bubble-assistant h3,
.bc-chat-bubble-assistant h4 {
    margin: 12px 0 6px 0;
    font-size: 15px;
    color: #2F5C2F;
}
.bc-chat-bubble-assistant ul {
    margin: 6px 0 10px 0;
    padding-left: 22px;
}
.bc-chat-bubble-assistant li {
    margin-bottom: 4px;
}

.bc-chat-bubble-error {
    background: #FDE8E8;
    color: #8B2C2C;
    border-color: #F5C0C0;
}

/* Referencias [ref. N] dentro del chat */
.bc-chat-paper-ref {
    color: #2F5C2F;
    background: #E5EFE0;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: default;
    margin: 0 2px;
}

/* Bloque de papers debajo de cada respuesta */
.bc-chat-papers-block {
    align-self: flex-start;
    max-width: 90%;
    margin: 4px 0 8px 0;
    padding: 8px 0 0 0;
}

.bc-chat-papers-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5C6E5C;
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 4px;
}

/* Tarjetas de papers en chat (modo conversacion) */
.bc-chat-papers-block .bc-chat-paper-card {
    background: #FAFCF7;
    border: 1px solid #E5EFE0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}


/* ============================================
   TITULO BILINGUE v2.5 (v2.8: peso unificado sin negrita)
   ============================================ */
.bc-titulo-original {
    color: #1A2A1A;
    font-weight: 400;
    line-height: 1.4;
}

.bc-titulo-es {
    color: #6B7B6B;
    font-size: 0.9em;
    font-style: italic;
    line-height: 1.3;
    margin-top: 2px;
}

/* ============================================
   MODAL DETALLE PAPER (chat)
   ============================================ */

.bc-paper-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.bc-paper-modal-backdrop.bc-paper-modal-visible {
    display: flex;
}

.bc-paper-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 32px 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.bc-paper-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
}

.bc-paper-modal-close:hover {
    color: #000;
}

.bc-paper-modal-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.bc-paper-modal-card {
    cursor: pointer;
}

.bc-chat-paper-card-clickable {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.bc-chat-paper-card-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Modal: contenido estilizado igual que las filas expandidas de la tabla */
.bc-modal-paper-header h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #2C3E2C;
    line-height: 1.3;
}

.bc-modal-paper-titulo-es {
    color: #6B7B6B;
    font-size: 0.9em;
    font-style: italic;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.bc-modal-paper-autores {
    color: #5C6E5C;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.bc-modal-section {
    margin-bottom: 16px;
}

.bc-modal-section:last-child {
    margin-bottom: 0;
}

.bc-modal-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #5C6E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.bc-modal-section p {
    margin: 0;
    color: #333;
    line-height: 1.5;
    font-size: 14px;
}

.bc-modal-respuesta {
    background: #F8F9F8;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.bc-modal-respuesta:last-child {
    margin-bottom: 0;
}

.bc-modal-respuesta-pregunta {
    font-weight: 600;
    color: #2C3E2C;
    margin-bottom: 10px;
    font-size: 14px;
}

.bc-modal-sub-label {
    font-size: 10px;
    font-weight: 700;
    color: #5C6E5C;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
    margin-bottom: 3px;
}

.bc-modal-respuesta-cita {
    border-left: 3px solid #B764E2;
    padding: 4px 10px;
    color: #555;
    font-style: italic;
    font-size: 13px;
    margin-bottom: 4px;
}

.bc-modal-respuesta-traducida {
    border-left: 3px solid #B764E2;
    padding: 4px 10px;
    color: #555;
    font-size: 13px;
    margin-bottom: 4px;
}

.bc-modal-respuesta-analisis {
    background: #E8F4E8;
    border-radius: 4px;
    padding: 8px 10px;
    color: #2C3E2C;
    font-size: 13px;
    margin: 4px 0 0 0;
}

.bc-modal-meta {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e8e8e8;
    color: #777;
    font-size: 12px;
}

.bc-modal-meta a {
    color: #5C6E5C;
}

/* Responsive modal */
@media (max-width: 600px) {
    .bc-paper-modal {
        padding: 24px 16px 16px;
        max-height: 95vh;
    }
    .bc-paper-modal-close {
        top: 6px;
        right: 8px;
    }
}

/* === v2.7: Badges/pills por módulo (multi-módulo) === */
.bc-col-modulo-cell {
    white-space: nowrap;
    line-height: 1.6;
}

.bc-modulo-pill {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: help;
    white-space: nowrap;
    line-height: 1.4;
    vertical-align: middle;
}

/* Verde: el paper SÍ es relevante para ese módulo */
.bc-modulo-pill.bc-modulo-rel {
    background-color: #DFF1E1;
    color: #2D6A33;
    border-color: #B8DCC0;
}

/* Gris: el paper NO es relevante para ese módulo (pero fue evaluado) */
.bc-modulo-pill.bc-modulo-norel {
    background-color: #EFEFEF;
    color: #707070;
    border-color: #DCDCDC;
}

/* Beige tenue: legacy (paper analizado antes de v0.7.x, sin documento_modulo) */
.bc-modulo-pill.bc-modulo-legacy {
    background-color: #F5F1E6;
    color: #8A7A50;
    border-color: #E5DDCB;
}

/* ============================================
   v2.8.8: bloques (columna Temática) - 3 estados
   ============================================ */

/* Pill base para mostrar bloques en la columna Tematica */
.bc-bloque-pill {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: help;
}

/* Verde: el paper ES relevante para ese bloque/modulo */
.bc-bloque-pill.bc-bloque-rel {
    background-color: #DFF1E1;
    color: #2D6A33;
    border-color: #B8DCC0;
}

/* Gris: paper NO relevante para ese bloque (fue evaluado) */
.bc-bloque-pill.bc-bloque-norel {
    background-color: #EFEFEF;
    color: #707070;
    border-color: #DCDCDC;
}

