/* Red crediticia de una persona (d3.js) */
#grafo-red-crediticia {
    position: relative;
    width: 100%;
    height: 78vh;
    min-height: 520px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: radial-gradient(circle at center, #ffffff 0%, #f6f8fb 100%);
    overflow: hidden;
    user-select: none;
}

#grafo-red-crediticia svg { display: block; }

.rc-vacio {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8899;
    font-size: 15px;
}

/* ---------- Paneles flotantes ---------- */
.rc-panel {
    position: absolute;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cfd6df;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(20, 40, 70, 0.10);
    font-size: 12.5px;
}

.rc-panel-izq { top: 10px; left: 10px; width: 200px; overflow: hidden; }

.rc-titulo {
    font-weight: 700;
    text-align: center;
    padding: 4px 6px;
    background: #1f4e79;
    color: #fff;
}

.rc-opcion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    margin: 0;
    border-bottom: 1px solid #e6eaef;
    cursor: pointer;
}
.rc-opcion:hover { background: #f0f5fb; }
.rc-opcion.rc-deshab { color: #aab3bd; cursor: default; }

.rc-vista { padding: 6px 8px 8px; }
.rc-subtitulo { font-weight: 600; margin-bottom: 3px; color: #3b4a5a; }
.rc-vista select { margin-bottom: 6px; }

.rc-check {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 2px 0;
    cursor: pointer;
}

.rc-herramientas { top: 10px; right: 10px; width: 290px; padding: 6px; }
.rc-buscar { margin-bottom: 5px; }
.rc-botones { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-botones .btn { padding: 1px 7px; font-size: 12px; }

/* ---------- Ficha de la persona seleccionada ---------- */
.rc-ficha {
    top: 86px;
    right: 10px;
    width: 340px;
    max-height: calc(100% - 100px);
    overflow-y: auto;
    padding: 10px 12px;
}
.rc-cerrar { position: absolute; top: 8px; right: 8px; font-size: 10px; }
.rc-ficha-nombre { font-weight: 700; font-size: 14px; padding-right: 22px; color: #1d2b3a; }
.rc-ficha-sub { color: #6b7886; margin-bottom: 6px; }
.rc-ficha-sec { font-weight: 600; margin: 8px 0 3px; color: #1f4e79; border-bottom: 1px solid #e3e8ee; }
.rc-punto { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.rc-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rc-kpi { background: #f3f6f9; border-radius: 4px; padding: 4px 6px; font-size: 11px; color: #5a6878; }
.rc-kpi b { display: block; font-size: 13px; color: #1d2b3a; }
.rc-kpi-mal { background: #fdecec; }
.rc-kpi-mal b { color: #b3261e; }

.rc-ruta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.rc-ruta-paso { border: 2px solid; border-radius: 10px; padding: 0 6px; background: #fff; font-size: 11px; }
.rc-ruta-flecha { color: #8a96a3; font-weight: 700; }

.rc-ficha-ops table, .rc-tt-tabla { width: 100%; border-collapse: collapse; font-size: 11px; }
.rc-ficha-ops th, .rc-tt-tabla th { background: #eef2f6; font-weight: 600; padding: 2px 4px; white-space: nowrap; }
.rc-ficha-ops td, .rc-tt-tabla td { border-top: 1px solid #edf0f3; padding: 2px 4px; white-space: nowrap; }
.rc-num { text-align: right; }
.rc-mal { color: #b3261e; font-weight: 700; }
.rc-nuevo { color: #c48a00; }

/* ---------- Leyenda ---------- */
.rc-leyenda { right: 10px; bottom: 10px; padding: 4px 6px; }
.rc-ley-cab { font-weight: 700; cursor: pointer; color: #1f4e79; }

/* ---------- Aviso ---------- */
.rc-aviso {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    z-index: 15;
    background: #1d2b3a;
    color: #fff;
    border-radius: 14px;
    padding: 4px 14px;
    font-size: 12.5px;
    pointer-events: none;
}

/* ---------- Tooltip ---------- */
.rc-tooltip {
    position: absolute;
    z-index: 20;
    max-width: 560px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #1f4e79;
    border-radius: 5px;
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.rc-tt-tit { font-weight: 700; color: #1f4e79; margin-bottom: 2px; }
.rc-tt-sub { color: #5a6878; margin-bottom: 4px; }
.rc-tt-pie { color: #7a8899; margin-top: 4px; font-size: 11px; }

/* ---------- Elementos del grafo ---------- */
.rc-nodo, .rc-arista, .rc-insignia { transition: opacity 0.2s; }
.rc-arista { cursor: pointer; }
.rc-arista:hover { stroke-opacity: 1 !important; }
.rc-tenue { opacity: 0.1; }
.rc-sel .rc-cuerpo { stroke: #1f6feb !important; stroke-width: 3.5px !important; }
.rc-nueva { filter: drop-shadow(0 0 3px #f5b800); }

.rc-halo { animation: rc-pulso 1.8s ease-out infinite; }
@keyframes rc-pulso {
    0%   { stroke-opacity: 0.85; stroke-width: 2px; }
    100% { stroke-opacity: 0;    stroke-width: 12px; }
}

/* ---------- Indicadores (columna derecha de la página) ---------- */
.rc-indicadores { font-size: 13px; }
.rc-indicadores th[title],
.rc-indicadores td[title] { cursor: help; text-decoration: underline dotted; }
.rc-indicadores .rc-grupo { background: #e7e6e6; vertical-align: middle; }

.rc-resumen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
.rc-tarjeta { background: #fff; border: 1px solid #d8dee6; border-radius: 6px; padding: 4px 8px; }
.rc-tarjeta small { color: #6b7886; display: block; }
.rc-tarjeta b { font-size: 18px; color: #1d2b3a; }
.rc-tarjeta.rc-tarjeta-mal b { color: #b3261e; }

.rc-niveles-barra { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 3px; background: #eef2f6; }
.rc-niveles-barra div { height: 100%; }

.rc-personas { max-height: 34vh; overflow-y: auto; font-size: 12px; }
.rc-personas tr { cursor: pointer; }
.rc-personas tr:hover td { background: #eef4fb; }
.rc-personas td { padding: 2px 4px !important; }

/* =====================================================================
   Ventana emergente de la red en ReporteCrediticio (90% de la pantalla)
   ===================================================================== */
.rc-modal-fondo {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-modal {
    width: 90vw;
    height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rc-modal-cab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #e3e8ee;
}
.rc-modal-cab h5 { margin: 0; font-size: 16px; }
.rc-modal-cab .rc-modal-sub { color: #6b7886; font-size: 12.5px; }
.rc-modal-cab .btn-close { margin-left: auto; }

.rc-modal-cuerpo {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 12px;
    padding: 10px 12px 12px;
}

.rc-modal-grafo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-modal-grafo #grafo-red-crediticia { flex: 1; height: auto; min-height: 0; }

.rc-modal-lateral { width: 330px; flex-shrink: 0; overflow-y: auto; font-size: 12.5px; }
.rc-modal-lateral .rc-personas { max-height: none; }

.rc-modal-estado {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8899;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 991px) {
    .rc-modal { width: 96vw; height: 94vh; }
    .rc-modal-cuerpo { flex-direction: column; }
    .rc-modal-lateral { width: 100%; max-height: 30%; }
}
