/**
 * mod_revision_contratos — estilos propios.
 * Se apoya en unified-legal-calculator.css (base común del ecosistema) y en
 * Bootstrap 5 de la plantilla. Aquí solo va lo específico de la revisión.
 *
 * Sin position:fixed en ningún elemento: el módulo se sirve también en un
 * iframe de sitio ajeno cuya altura puede ajustarse al contenido, y ahí un
 * elemento fijo acaba fuera de la vista.
 */

.ci-rd723 {
    --rd-ok: #146c43;
    --rd-ok-bg: #d1e7dd;
    --rd-ref: #8a6100;
    --rd-ref-bg: #fff3cd;
    --rd-ko: #b02a37;
    --rd-ko-bg: #f8d7da;
    --rd-na: #5c636a;
    --rd-na-bg: #e9ecef;
    --rd-borde: #d8dee6;
    --rd-fondo-suave: #f6f8fa;
    --rd-texto-suave: #5c6670;
    --rd-acento: #0d6efd;
}

/* unified-legal-calculator.css da overflow:hidden a .calc-module, y un ancestro
   con overflow distinto de visible anula el position:sticky de la barra de
   progreso. `clip` recorta igual pero no crea contenedor de desplazamiento. */
.calc-module.ci-rd723 {
    overflow: visible;
    overflow: clip;
}

.ci-rd723 .form-select {
    width: 100%;
}

.ci-rd723 .ci-oculto,
.ci-oculto {
    display: none !important;
}

/* ------------------------------------------------------------- cabecera */

.ci-rd723__cabecera {
    margin-bottom: 1.25rem;
}

.ci-rd723__meta {
    text-align: center;
    font-size: .88rem;
    color: var(--rd-texto-suave);
    margin: .5rem 0 0;
}

/* -------------------------------------------------------- aviso inicial */
/* En línea, no modal: un modal fijo en un iframe de altura ajustada al
   contenido quedaría fuera de la vista. Sin JS la herramienta se ve entera. */

.ci-rd723__aviso-inicial {
    border: 1px solid var(--rd-borde);
    border-top: 4px solid var(--rd-acento);
    border-radius: .5rem;
    background: #fff;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.ci-rd723__aviso-inicial ul {
    padding-left: 1.2rem;
    margin-bottom: 1rem;
}

.ci-rd723__aviso-inicial li {
    margin-bottom: .4rem;
}

.ci-rd723--bloqueado .ci-rd723__herramienta {
    display: none;
}

.ci-rd723--aceptado .ci-rd723__aviso-inicial {
    display: none;
}

/* ---------------------------------------------------------------- panel */

.ci-rd723__panel {
    border: 1px solid var(--rd-borde);
    border-radius: .5rem;
    background: #fff;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.ci-rd723__sub {
    color: var(--rd-texto-suave);
    font-size: .92rem;
    margin-bottom: 1rem;
}

.ci-rd723__condiciones {
    margin-top: 1.1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: .35rem 1.5rem;
}

.ci-rd723__condiciones legend {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-secondary, #4d6178);
    text-align: left;
    margin-bottom: .25rem;
}

.ci-rd723 .form-check-label {
    text-align: left;
}

.ci-rd723__aviso {
    border-left: 3px solid var(--rd-acento);
    background: #e7f1ff;
    padding: .6rem .9rem;
    border-radius: 0 .375rem .375rem 0;
    margin: 1rem 0 0;
    font-size: .92rem;
}

.ci-rd723__aviso--alerta {
    border-color: var(--rd-ko);
    background: var(--rd-ko-bg);
}

.ci-rd723__aviso--grupo {
    margin: .5rem 0 .25rem;
}

.ci-rd723__ambito {
    margin-top: 1rem;
    font-size: .9rem;
    color: var(--rd-texto-suave);
}

.ci-rd723__ambito summary {
    cursor: pointer;
    color: var(--rd-acento);
}

.ci-rd723__ambito p {
    margin: .5rem 0 0;
}

/* ------------------------------------------------------ grupos y puntos */

.ci-rd723__grupo {
    margin-bottom: 1.75rem;
}

.ci-rd723__grupo-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    border-bottom: 2px solid #2c3e50;
    padding-bottom: .35rem;
}

.ci-rd723__grupo-cabecera h2 {
    margin: 0;
}

.ci-rd723__grupo-cuenta {
    font-size: .85rem;
    color: var(--rd-texto-suave);
}

.ci-rd723__punto {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 11rem;
    gap: .25rem 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--rd-borde);
}

.ci-rd723__punto h3 {
    font-weight: 600;
    margin: 0 0 .25rem;
}

.ci-rd723__punto p {
    font-size: .94rem;
    margin: 0 0 .5rem;
}

.ci-rd723__punto .ci-rd723__nota-practica {
    font-size: .88rem;
    color: #6b4a00;
    background: var(--rd-fondo-suave);
    border-left: 3px solid #d4a017;
    padding: .35rem .6rem;
}

.ci-rd723__punto-ref {
    font-size: .88rem;
    color: var(--rd-texto-suave);
    border-left: 1px solid var(--rd-borde);
    padding-left: .75rem;
    line-height: 1.4;
}

.ci-rd723__punto .ci-rd723__ayuda {
    font-size: .86rem;
    color: var(--rd-texto-suave);
    font-style: italic;
}

.ci-rd723__requiere {
    color: var(--rd-texto-suave);
    font-size: .88em;
}

.ci-rd723__remision {
    display: block;
    margin-top: .4rem;
    font-size: .8rem;
}

.ci-rd723__remision--si {
    color: var(--rd-ref);
}

.ci-rd723__remision--no {
    color: var(--rd-ko);
}

/* Botones de estado: clase propia, NO .btn — .calc-module .btn impone un
   ancho mínimo que descoloca una fila de cuatro opciones. */
.ci-rd723__estados {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: .25rem 0 .5rem;
}

.ci-rd723__estado {
    font: inherit;
    font-size: .85rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    border: 1px solid #adb5bd;
    background: #fff;
    color: #212529;
    cursor: pointer;
    line-height: 1.3;
}

.ci-rd723__estado:hover {
    background: var(--rd-fondo-suave);
}

.ci-rd723__estado:focus-visible {
    outline: 2px solid var(--rd-acento);
    outline-offset: 2px;
}

.ci-rd723__estado[aria-pressed="true"] {
    font-weight: 600;
}

.ci-rd723__estado[aria-pressed="true"][data-v="ok"] {
    background: var(--rd-ok-bg);
    border-color: var(--rd-ok);
    color: var(--rd-ok);
}

.ci-rd723__estado[aria-pressed="true"][data-v="ref"] {
    background: var(--rd-ref-bg);
    border-color: var(--rd-ref);
    color: var(--rd-ref);
}

.ci-rd723__estado[aria-pressed="true"][data-v="ko"] {
    background: var(--rd-ko-bg);
    border-color: var(--rd-ko);
    color: var(--rd-ko);
}

.ci-rd723__estado[aria-pressed="true"][data-v="na"] {
    background: var(--rd-na-bg);
    border-color: var(--rd-na);
    color: var(--rd-na);
}

.ci-rd723__nota {
    font-size: .9rem;
    min-height: 2.4rem;
    resize: vertical;
}

/* -------------------------------------------------------------- informe */

.ci-rd723__acciones {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.ci-rd723__mensaje {
    margin-top: .75rem;
    font-size: .92rem;
}

/* .calc-module .form-control lleva overflow:hidden (hoja común): en un textarea
   impediría desplazarse por el texto. */
.ci-rd723 .ci-rd723__resumen,
.ci-rd723 .ci-rd723__nota {
    overflow: auto;
}

.ci-rd723__resumen {
    margin-top: .75rem;
    font-size: .85rem;
    white-space: pre-wrap;
    font-family: inherit;
}

.ci-rd723__criterio {
    font-size: .9rem;
    color: var(--rd-texto-suave);
    margin: 0 0 1rem;
}

.ci-rd723__pendientes {
    font-size: .9rem;
    color: var(--rd-texto-suave);
    margin: 0 0 .75rem;
}

/* «Abrir revisión guardada» arriba de la herramienta: aspecto de enlace,
   pero <button> (acción, no navegación). Sin .btn por el min-width común. */
.ci-rd723__abrir-inicio {
    font-size: .92rem;
    margin: 0 0 .75rem;
    text-align: right;
}

.ci-rd723__enlace {
    font: inherit;
    border: 0;
    background: none;
    padding: 0;
    color: var(--rd-acento);
    text-decoration: underline;
    cursor: pointer;
}

.ci-rd723__enlace:focus-visible,
.ci-rd723__filtro:focus-visible {
    outline: 2px solid var(--rd-acento);
    outline-offset: 2px;
}

/* Filtro «solo sin revisar» en la barra de progreso: a mano en todo momento. */
.ci-rd723__filtro {
    font: inherit;
    font-size: .82rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--rd-acento);
    background: #fff;
    color: var(--rd-acento);
    cursor: pointer;
    white-space: nowrap;
}

.ci-rd723__filtro[aria-pressed="true"] {
    background: var(--rd-acento);
    color: #fff;
}

/* ------------------------------------------------------ barra de progreso */
/* sticky, no fixed: se queda pegada al pie de la ventana mientras el módulo
   está a la vista y nunca se sale de él. */

.ci-rd723__barra {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    background: #fff;
    border: 1px solid var(--rd-borde);
    border-radius: .5rem;
    padding: .6rem 1rem;
    margin-top: 1rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
}

.ci-rd723__medidor {
    flex: 1 1 12rem;
    height: .5rem;
    background: var(--rd-na-bg);
    border-radius: .25rem;
    overflow: hidden;
    display: flex;
}

.ci-rd723__medidor i {
    display: block;
    height: 100%;
}

.ci-rd723__recuento {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .9rem;
    font-size: .86rem;
}

.ci-rd723__recuento .ci-rd723__recuento-ko {
    color: var(--rd-ko);
}

/* ----------------------------------------------------------- disclaimer */

.ci-rd723__disclaimer {
    margin-top: 1.5rem;
    font-size: .82rem;
    color: var(--rd-texto-suave);
    line-height: 1.5;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 680px) {
    .ci-rd723__punto {
        grid-template-columns: minmax(0, 1fr);
    }

    .ci-rd723__punto-ref {
        border-left: 0;
        padding-left: 0;
        border-top: 1px dashed var(--rd-borde);
        padding-top: .4rem;
    }

    .ci-rd723__panel,
    .ci-rd723__aviso-inicial {
        padding: .9rem 1rem;
    }

    /* Barra compacta en móvil (medía 120 px, un 15 % de la pantalla): medidor
       fino arriba y, debajo, recuento y filtro en la misma línea si caben. */
    .ci-rd723__barra {
        padding: .35rem .6rem;
        gap: .25rem .5rem;
        margin-top: .6rem;
    }

    .ci-rd723__medidor {
        flex: 1 1 100%;
        height: .3rem;
    }

    .ci-rd723__recuento {
        flex: 1 1 auto;
        gap: 0 .45rem;
        font-size: .72rem;
        line-height: 1.35;
    }

    .ci-rd723__filtro {
        font-size: .72rem;
        padding: .1rem .5rem;
    }
}

@media print {
    .ci-rd723__barra,
    .ci-rd723__acciones,
    .ci-rd723__aviso-inicial {
        display: none !important;
    }
}
