/**
 * Modales de detalle de operación (principal, hijo, nieto, comentario).
 * Coherente con informe global (#434343) y modal-mapeo-enhanced.
 */

.modal-operacion-enhanced .modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

#oModalCampania.modal-operacion-enhanced .modal-content,
#oModalOperacion.modal-operacion-enhanced .modal-content {
    min-height: 530px;
}

#oModalOperacion.modal-operacion-enhanced .modal-body {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    max-width: 100%;
}

.modal-operacion-enhanced .modal-header {
    background: #434343;
    color: #fff;
    border-bottom: none;
    padding: 18px 22px 16px;
    position: relative;
    /* BS5 pone display:flex en .modal-header: el título + btn-close
       quedan en fila y la cabecera deja de centrarse a ancho completo. */
    display: block;
}

/* Cerrar: el markup usa .btn-close (BS5); antes era .close con position absolute */
.modal-operacion-enhanced .modal-header .close,
.modal-operacion-enhanced .modal-header .btn-close {
    color: #fff;
    opacity: 0.85;
    font-size: 26px;
    text-shadow: none;
    position: absolute;
    right: 16px;
    top: 14px;
    z-index: 2;
    margin: 0;
    order: unset;
    float: none;
    box-shadow: none;
    /* btn-close de BS5 es oscuro por defecto; invertir sobre cabecera #434343 */
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-operacion-enhanced .modal-header .close:hover,
.modal-operacion-enhanced .modal-header .close:focus,
.modal-operacion-enhanced .modal-header .btn-close:hover,
.modal-operacion-enhanced .modal-header .btn-close:focus {
    color: #fff;
    opacity: 1;
}

.modal-operacion-cabecera-inner {
    text-align: center;
    width: 100%;
    padding: 0 36px;
    box-sizing: border-box;
}

.modal-operacion-enhanced .modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.3;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    order: unset;
    width: 100%;
}

.modal-operacion-enhanced .modal-title i {
    font-size: 24px;
    opacity: 0.9;
}

.modal-operacion-subtitulo {
    margin: 0 0 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.modal-operacion-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.modal-operacion-tipo {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.92);
    max-width: min(520px, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-op-situacion-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-op-badge--ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-op-badge--danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.modal-op-badge--warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.modal-op-badge--info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.modal-op-badge--neutral {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}

.modal-operacion-enhanced .modal-body {
    padding: 0;
    background: #f8f9fa;
    text-align: left;
    overflow-x: hidden;
}

.modal-operacion-enhanced .modal-body > .row {
    margin: 0;
}

.modal-operacion-enhanced .nav-tabs {
    border-bottom: 2px solid #dee2e6;
    background: #fff;
    margin: 0;
    padding: 0 12px;
}

.modal-operacion-enhanced .nav-tabs > li > a {
    border: none;
    border-radius: 0;
    color: #6c757d;
    font-weight: 500;
    padding: 12px 18px;
    margin-bottom: -2px;
}

.modal-operacion-enhanced .nav-tabs > li > a:hover {
    background: #f8f9fa;
    color: #434343;
    border-color: transparent;
}

.modal-operacion-enhanced .nav-tabs > li.active > a,
.modal-operacion-enhanced .nav-tabs > li.active > a:hover,
.modal-operacion-enhanced .nav-tabs > li.active > a:focus,
.modal-operacion-enhanced .nav-tabs > li > a.active,
.modal-operacion-enhanced .nav-tabs > li > a.active:hover,
.modal-operacion-enhanced .nav-tabs > li > a.active:focus {
    color: #434343;
    background: transparent;
    border: none;
    border-bottom: 3px solid #434343;
    font-weight: 600;
}

.modal-operacion-enhanced .tab-content {
    background: #f8f9fa;
    padding: 18px 15px 20px;
    font-size: 15px;
}

/* Títulos de sección en Resumen (no afectar h4.panel-title del acordeón) */
.modal-operacion-enhanced #oDiv_resumen > .row h4,
.modal-operacion-enhanced #oDiv_resumenChild > .row h4,
.modal-operacion-enhanced #oDiv_resumenGrandChild > .row h4 {
    color: #434343;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
}

/* --- Pestaña Documentación: acordeones (markup .card + panel-default) --- */
.modal-operacion-enhanced #oDiv_documento .panel-group,
.modal-operacion-enhanced #oDiv_documentoChild .panel-group,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-group {
    width: 100%;
    margin: 0;
}

.modal-operacion-enhanced #oDiv_documento > .row,
.modal-operacion-enhanced #oDiv_documentoChild > .row,
.modal-operacion-enhanced #oDiv_documentoGrandChild > .row {
    margin-left: 0;
    margin-right: 0;
}

.modal-operacion-enhanced #oDiv_documento .card.panel-default,
.modal-operacion-enhanced #oDiv_documento .panel,
.modal-operacion-enhanced #oDiv_documentoChild .card.panel-default,
.modal-operacion-enhanced #oDiv_documentoChild .panel,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card.panel-default,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 0 15px 10px !important;
    background: #fff;
    overflow: hidden;
}

/* Panel abierto: borde más marcado (como referencia pre-BS5) */
.modal-operacion-enhanced #oDiv_documento .card.panel-default:has(.collapse.show),
.modal-operacion-enhanced #oDiv_documentoChild .card.panel-default:has(.collapse.show),
.modal-operacion-enhanced #oDiv_documentoGrandChild .card.panel-default:has(.collapse.show) {
    border-color: #434343;
}

.modal-operacion-enhanced #oDiv_documento .card.panel-default > .card-header,
.modal-operacion-enhanced #oDiv_documento .panel-default > .panel-heading,
.modal-operacion-enhanced #oDiv_documentoChild .card.panel-default > .card-header,
.modal-operacion-enhanced #oDiv_documentoChild .panel-default > .panel-heading,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card.panel-default > .card-header,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-default > .panel-heading {
    background: #fff !important;
    color: #434343;
    border: none;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0;
    padding: 0 !important;
}

.modal-operacion-enhanced #oDiv_documento .panel-title,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #434343;
}

.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    color: #434343 !important;
    text-decoration: none;
    background: #fff;
    transition: background-color 0.15s ease;
}

.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link:hover,
.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link:focus,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link:hover,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link:focus,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link:hover,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link:focus {
    color: #212529 !important;
    background: #f1f3f5;
    text-decoration: none;
}

.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link span,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link span,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link span {
    flex: 1;
    text-align: left;
    color: inherit;
}

.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link i,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link i,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link i {
    flex-shrink: 0;
    color: #6c757d;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link:not(.collapsed) i,
.modal-operacion-enhanced #oDiv_documento .panel-title > a.sil-decoration-none-link[aria-expanded="true"] i,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link:not(.collapsed) i,
.modal-operacion-enhanced #oDiv_documentoChild .panel-title > a.sil-decoration-none-link[aria-expanded="true"] i,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link:not(.collapsed) i,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-title > a.sil-decoration-none-link[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.modal-operacion-enhanced #oDiv_documento .card-body,
.modal-operacion-enhanced #oDiv_documento .panel-body,
.modal-operacion-enhanced #oDiv_documentoChild .card-body,
.modal-operacion-enhanced #oDiv_documentoChild .panel-body,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card-body,
.modal-operacion-enhanced #oDiv_documentoGrandChild .panel-body {
    padding: 0 !important;
    background: #fff;
}

/* Lista de docs/certificados: separadores horizontales, sin “cajas” sueltas */
.modal-operacion-enhanced #oDiv_documento .card-body > .table,
.modal-operacion-enhanced #oDiv_documentoChild .card-body > .table,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card-body > .table {
    margin: 0;
    border: none !important;
}
.modal-operacion-enhanced #oDiv_documento .card-body > .table > tbody > tr > td,
.modal-operacion-enhanced #oDiv_documentoChild .card-body > .table > tbody > tr > td,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card-body > .table > tbody > tr > td {
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid #e9ecef !important;
    padding: 12px 16px !important;
    vertical-align: middle !important;
    background: #fff !important;
    box-shadow: none !important;
    font-size: 14px !important;
    color: #333333 !important;
}
.modal-operacion-enhanced #oDiv_documento .card-body > .table > tbody > tr:last-child > td,
.modal-operacion-enhanced #oDiv_documentoChild .card-body > .table > tbody > tr:last-child > td,
.modal-operacion-enhanced #oDiv_documentoGrandChild .card-body > .table > tbody > tr:last-child > td {
    border-bottom: none !important;
}

/* Botones de descarga/acción siempre circulares (aunque falte btn-circle en markup) */
.modal-operacion-enhanced #oDiv_documento .oBotonDescargaPDF,
.modal-operacion-enhanced #oDiv_documento .oBotonDescargaOtros,
.modal-operacion-enhanced #oDiv_documento .oGenerarSoporte,
.modal-operacion-enhanced #oDiv_documento .btn-info.btn-circle,
.modal-operacion-enhanced #oDiv_documentoChild .oBotonDescargaPDF,
.modal-operacion-enhanced #oDiv_documentoChild .oBotonDescargaOtros,
.modal-operacion-enhanced #oDiv_documentoChild .oGenerarSoporte,
.modal-operacion-enhanced #oDiv_documentoChild .btn-info.btn-circle,
.modal-operacion-enhanced #oDiv_documentoGrandChild .oBotonDescargaPDF,
.modal-operacion-enhanced #oDiv_documentoGrandChild .oBotonDescargaOtros,
.modal-operacion-enhanced #oDiv_documentoGrandChild .oGenerarSoporte,
.modal-operacion-enhanced #oDiv_documentoGrandChild .btn-info.btn-circle {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    line-height: 32px !important;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-operacion-enhanced .tab-pane .table {
    margin-bottom: 0;
    background: #fff;
}

.modal-operacion-enhanced .tab-pane .table > thead > tr.bg-primary,
.modal-operacion-enhanced .tab-pane .table > thead > tr.bg-primary > th,
.modal-operacion-enhanced .tab-pane .table > thead.thead-fijo > tr > th {
    background: #434343 !important;
    color: #fff !important;
    border-color: #434343;
    text-align: center;
}

/* Trazabilidad: pasteles de fondo + texto #333333; letra algo mayor que el 85% inline */
.modal-operacion-enhanced .tab-pane .table > tbody > tr:hover:not(.bg-info):not(.bg-success):not(.bg-danger):not(.bg-warning) {
    background-color: #f1f3f5;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table {
    font-size: 14px !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > thead > tr > th,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > thead > tr > th,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > thead > tr > th {
    font-size: 14px !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > tbody > tr > td,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > tbody > tr > td,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > tbody > tr > td {
    color: #333333 !important;
    font-size: 14px !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > tbody > tr.bg-info > *,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > tbody > tr.bg-info > *,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > tbody > tr.bg-info > * {
    background-color: #d9edf7 !important;
    color: #333333 !important;
    box-shadow: none !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > tbody > tr.bg-success > *,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > tbody > tr.bg-success > *,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > tbody > tr.bg-success > * {
    background-color: #dff0d8 !important;
    color: #333333 !important;
    box-shadow: none !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > tbody > tr.bg-danger > *,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > tbody > tr.bg-danger > *,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > tbody > tr.bg-danger > * {
    background-color: #f2dede !important;
    color: #333333 !important;
    box-shadow: none !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .table > tbody > tr.bg-warning > *,
.modal-operacion-enhanced #oDiv_trazabilidadChild .table > tbody > tr.bg-warning > *,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .table > tbody > tr.bg-warning > * {
    background-color: #fcf8e3 !important;
    color: #333333 !important;
    box-shadow: none !important;
}
.modal-operacion-enhanced #oDiv_trazabilidad .sil-tabla-scroll-container-full,
.modal-operacion-enhanced #oDiv_trazabilidad .sil-tabla-scroll-container,
.modal-operacion-enhanced #oDiv_trazabilidadChild .sil-tabla-scroll-container-full,
.modal-operacion-enhanced #oDiv_trazabilidadChild .sil-tabla-scroll-container,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .sil-tabla-scroll-container-full,
.modal-operacion-enhanced #oDiv_trazabilidadGrandChild .sil-tabla-scroll-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.modal-operacion-enhanced .tab-pane hr {
    border-color: #dee2e6;
}

.modal-operacion-enhanced #oDiv_resumen .col-md-5 h5,
.modal-operacion-enhanced #oDiv_resumen .col-md-4 h5,
.modal-operacion-enhanced #oDiv_resumen .col-md-3 h5,
.modal-operacion-enhanced #oDiv_resumen .col-md-6 h5,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-5 h5,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-4 h5,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-3 h5,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-6 h5,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-5 h5,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-4 h5,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-3 h5,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-6 h5 {
    font-size: 15px;
    line-height: 1.45;
    color: #333333;
    margin-bottom: 8px;
}
.modal-operacion-enhanced #oDiv_resumen .col-md-5 h5 b,
.modal-operacion-enhanced #oDiv_resumen .col-md-4 h5 b,
.modal-operacion-enhanced #oDiv_resumen .col-md-3 h5 b,
.modal-operacion-enhanced #oDiv_resumen .col-md-6 h5 b,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-5 h5 b,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-4 h5 b,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-3 h5 b,
.modal-operacion-enhanced #oDiv_resumenChild .col-md-6 h5 b,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-5 h5 b,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-4 h5 b,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-3 h5 b,
.modal-operacion-enhanced #oDiv_resumenGrandChild .col-md-6 h5 b {
    font-weight: 700;
    color: #212529;
}
.modal-operacion-enhanced .nav-tabs > li > a,
.modal-operacion-enhanced .nav-tabs > li > a.nav-link {
    font-size: 15px;
}

.modal-operacion-enhanced .btn-info.btn-circle-small,
.modal-operacion-enhanced .btn-info.btn-sm {
    border-radius: 50%;
}

.modal-operacion-enhanced .oVisorPDF {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #fff;
}

.modal-operacion-enhanced.modal.fade .modal-dialog {
    margin-top: 40px;
}

/* Asegurar ancho BS3 (900px) aunque alguna regla intermedia pise --bs-modal-width */
@media (min-width: 992px) {
    .modal-operacion-enhanced .modal-dialog.modal-lg {
        --bs-modal-width: 900px;
        width: 900px;
        max-width: 900px;
    }
}

.modal-operacion-enhanced.modal-operacion-dimmed {
    opacity: 0.15;
    pointer-events: none;
}

#oModalComentario.modal-operacion-enhanced .modal-body {
    padding: 24px;
    text-align: center;
}

#oModalComentario.modal-operacion-enhanced .modal-body p {
    font-size: 15px;
    line-height: 1.6;
    color: #343a40;
    margin: 0;
    word-wrap: break-word;
}
