/*
 * Reporte · Informe Mensual de Prestaciones.
 *
 * Framework `--ipm-*`, acotado a #reporteInformeMensualPrestaciones, copiado del de
 * Clientes sin Visitas cambiando el prefijo (misma paleta institucional y mismas reglas
 * responsive; ver reportes/_DOC_cuentas_por_pagar.md). Todo el estilo vive acá.
 * La tabla de la pestaña Clasificación usa el prefijo `ipc` del componente
 * wvTablaLocal pero las mismas clases `.ipm-tabla`.
 */

#reporteInformeMensualPrestaciones {
    --ipm-paper: #f8f9fa;
    --ipm-surface: #ffffff;
    --ipm-ink: #2d3748;
    --ipm-muted: #6c757d;
    --ipm-faint: #9aa3ad;
    --ipm-line: #e5e7eb;
    --ipm-line-strong: #d1d5db;
    --ipm-primary: #3f51b5;
    --ipm-primary-dark: #2c3a8c;
    --ipm-primary-soft: #eef0fb;
    --ipm-radius: 14px;
}

/* ---------------- Contenedor ---------------- */
#reporteInformeMensualPrestaciones { max-width: 100%; overflow-x: hidden; }
#reporteInformeMensualPrestaciones .ipm-shell { background: var(--ipm-surface); border: 1px solid var(--ipm-line); border-radius: 16px; overflow: hidden; max-width: 100%; }
#reporteInformeMensualPrestaciones .ipm-head { padding: 22px 24px; border-bottom: 1px solid var(--ipm-line); }
#reporteInformeMensualPrestaciones .ipm-head h4 { font-size: clamp(1.05rem, 2.2vw, 1.3rem); font-weight: 700; color: var(--ipm-ink); margin: 0; }
#reporteInformeMensualPrestaciones .ipm-head h4 .bi { color: var(--ipm-primary); }
#reporteInformeMensualPrestaciones .ipm-sub { color: var(--ipm-muted); font-size: 12.5px; margin: 5px 0 0; max-width: 82ch; line-height: 1.55; }
#reporteInformeMensualPrestaciones .ipm-chip-head { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ipm-muted); background: var(--ipm-paper); border: 1px solid var(--ipm-line); padding: 5px 11px; border-radius: 6px; }
#reporteInformeMensualPrestaciones .ipm-body { padding: 18px; background: var(--ipm-paper); }
@media (min-width: 768px) { #reporteInformeMensualPrestaciones .ipm-body { padding: 22px 24px; } }

/* ---------------- Filtros ---------------- */
#reporteInformeMensualPrestaciones .ipm-filter { background: var(--ipm-surface); border: 1px solid var(--ipm-line); border-radius: var(--ipm-radius); padding: 16px; margin-bottom: 16px; }
#reporteInformeMensualPrestaciones .ipm-filter label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ipm-faint); margin: 0 0 6px; display: block; }
#reporteInformeMensualPrestaciones .ipm-filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px 14px; align-items: end; }
@media (min-width: 1600px) {
    #reporteInformeMensualPrestaciones .ipm-filtros { grid-template-columns: repeat(auto-fit, minmax(185px, 280px)); justify-content: start; }
}
#reporteInformeMensualPrestaciones .ipm-campo { min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-campo .form-control { width: 100%; min-width: 0; max-width: 100%; }
#reporteInformeMensualPrestaciones .ipm-campo--boton { display: flex; align-items: flex-end; }
#reporteInformeMensualPrestaciones .ipm-filter .form-control { border-radius: 8px; border: 1px solid var(--ipm-line-strong); height: 40px; font-size: 13.5px; color: var(--ipm-ink); }
#reporteInformeMensualPrestaciones .ipm-filter .form-control:focus { border-color: var(--ipm-primary); box-shadow: 0 0 0 3px rgba(63, 81, 181, .14); }
#reporteInformeMensualPrestaciones .ipm-btn { height: 40px; border-radius: 8px; font-weight: 600; font-size: 13.5px; border: 1px solid var(--ipm-primary); color: #fff; padding: 0 22px; width: 100%; min-width: 0; white-space: nowrap; background: var(--ipm-primary); }
#reporteInformeMensualPrestaciones .ipm-btn:hover { background: var(--ipm-primary-dark); border-color: var(--ipm-primary-dark); }
#reporteInformeMensualPrestaciones .ipm-btn:disabled { opacity: .6; }

/* Buscador con autocompletar: el componente envuelve el input en `.ac-wrap`, que ya
   dibuja el marco. La regla de arriba lleva id y le gana a la neutralización propia
   del componente (0-3-0) ⇒ doble borde si no se anula acá. */
#reporteInformeMensualPrestaciones .ipm-buscar-wrap { position: relative; }
#reporteInformeMensualPrestaciones .ipm-filter .ac-wrap { height: 40px; min-width: 0; padding: 0 10px; border: 1px solid var(--ipm-line-strong); border-radius: 8px; background: var(--ipm-surface); }
#reporteInformeMensualPrestaciones .ipm-filter .ac-wrap:focus-within { border-color: var(--ipm-primary); box-shadow: 0 0 0 3px rgba(63, 81, 181, .14); }
#reporteInformeMensualPrestaciones .ipm-filter .ac-wrap .form-control,
#reporteInformeMensualPrestaciones .ipm-filter .ac-wrap .form-control:focus { height: 38px; padding: 0; border: 0; box-shadow: none; background: transparent; border-radius: 0; }

/* ---------------- KPIs ---------------- */
#reporteInformeMensualPrestaciones .ipm-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 14px; }
#reporteInformeMensualPrestaciones .ipm-metric { background: var(--ipm-surface); border: 1px solid var(--ipm-line); border-radius: 10px; padding: 11px 13px; min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-metric .m-k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ipm-faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#reporteInformeMensualPrestaciones .ipm-metric .m-v { font-size: 1.1rem; font-weight: 700; color: var(--ipm-ink); margin-top: 5px; line-height: 1.15; overflow-wrap: anywhere; }
#reporteInformeMensualPrestaciones .ipm-metric .m-s { font-size: 11px; color: var(--ipm-muted); margin-top: 2px; }
#reporteInformeMensualPrestaciones .ipm-metric.total { border-color: var(--ipm-primary); background: var(--ipm-primary-soft); }
#reporteInformeMensualPrestaciones .ipm-metric.total .m-k { color: var(--ipm-primary-dark); }
#reporteInformeMensualPrestaciones .ipm-metric.total .m-v { color: var(--ipm-primary-dark); font-size: 1.3rem; }

/* ---------------- Selector de vista ---------------- */
#reporteInformeMensualPrestaciones .ipm-vistas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
#reporteInformeMensualPrestaciones .ipm-vista { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--ipm-line-strong); background: var(--ipm-surface); color: var(--ipm-muted); border-radius: 8px; padding: 7px 15px; cursor: pointer; user-select: none; }
#reporteInformeMensualPrestaciones .ipm-vista.activa { color: #fff; background: var(--ipm-primary); border-color: var(--ipm-primary); }

/* ---------------- Tabla ---------------- */
#reporteInformeMensualPrestaciones .ipm-tabla-card { background: var(--ipm-surface); border: 1px solid var(--ipm-line); border-radius: var(--ipm-radius); overflow: hidden; }
#reporteInformeMensualPrestaciones .ipm-tabla-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--ipm-line); }
#reporteInformeMensualPrestaciones .ipm-tabla-top .t-titulo { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--ipm-muted); min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-tabla-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 260px; justify-content: flex-end; min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-tabla-top .form-control { height: 36px; font-size: 13px; border-radius: 8px; border: 1px solid var(--ipm-line-strong); flex: 1 1 170px; width: auto; min-width: 0; max-width: 260px; }
#reporteInformeMensualPrestaciones .ipm-btn-excel { height: 36px; border-radius: 8px; border: 1px solid var(--ipm-line-strong); background: var(--ipm-surface); color: var(--ipm-muted); font-size: 12.5px; font-weight: 600; padding: 0 13px; white-space: nowrap; }
#reporteInformeMensualPrestaciones .ipm-btn-excel:hover { border-color: var(--ipm-primary); color: var(--ipm-primary-dark); background: var(--ipm-primary-soft); }

#reporteInformeMensualPrestaciones .ipm-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
#reporteInformeMensualPrestaciones table.ipm-tabla { width: 100%; min-width: 660px; margin: 0; border-collapse: collapse; font-size: 13px; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th { background: var(--ipm-paper); color: var(--ipm-muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--ipm-line); white-space: nowrap; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th[data-col] { cursor: pointer; user-select: none; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th[data-col]::after { content: "\2195"; margin-left: 6px; opacity: .3; font-size: 11px; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th[aria-sort="ascending"]::after { content: "\2191"; opacity: 1; color: var(--ipm-primary); }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; color: var(--ipm-primary); }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th.col-num { text-align: right; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th.col-fit { width: 1%; }

/* Celdas de varias líneas: que respiren. */
#reporteInformeMensualPrestaciones table.ipm-tabla tbody td { line-height: 1.4; }
#reporteInformeMensualPrestaciones .ipm-sec + .ipm-sec { margin-top: 1px; }
#reporteInformeMensualPrestaciones .ipm-sec .ipm-contacto a { font-size: 11.5px; }
#reporteInformeMensualPrestaciones table.ipm-tabla tbody td { padding: 10px 12px; border-bottom: 1px solid var(--ipm-line); color: var(--ipm-ink); vertical-align: middle; overflow-wrap: anywhere; }
#reporteInformeMensualPrestaciones table.ipm-tabla tbody tr:hover { background: var(--ipm-paper); }
#reporteInformeMensualPrestaciones table.ipm-tabla tbody tr:last-child td { border-bottom: 0; }

#reporteInformeMensualPrestaciones .ipm-fuerte { font-weight: 700; color: var(--ipm-ink); }
#reporteInformeMensualPrestaciones .ipm-sec { font-size: 11.5px; color: var(--ipm-muted); margin-top: 2px; }
#reporteInformeMensualPrestaciones .ipm-etiqueta { display: inline-block; margin-right: 5px; vertical-align: 1px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ipm-muted); background: var(--ipm-paper); border: 1px solid var(--ipm-line-strong); border-radius: 5px; padding: 2px 8px; white-space: nowrap; }
#reporteInformeMensualPrestaciones .ipm-ficha { font-size: 10.5px; font-weight: 700; color: var(--ipm-primary-dark); background: var(--ipm-primary-soft); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
#reporteInformeMensualPrestaciones .ipm-num { text-align: right; white-space: nowrap; }
#reporteInformeMensualPrestaciones .ipm-num.fuerte { font-weight: 700; }
#reporteInformeMensualPrestaciones .ipm-accion { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--ipm-primary-dark); background: var(--ipm-primary-soft); border: 1px solid var(--ipm-primary); border-radius: 7px; padding: 5px 9px; white-space: nowrap; text-decoration: none; }
#reporteInformeMensualPrestaciones .ipm-accion:hover { background: var(--ipm-primary); color: #fff; text-decoration: none; }
#reporteInformeMensualPrestaciones .ipm-sin-doc { font-size: 11px; color: var(--ipm-faint); }

#reporteInformeMensualPrestaciones .ipm-vacio { text-align: center; padding: 40px 16px; color: var(--ipm-muted); font-size: 14px; }
#reporteInformeMensualPrestaciones .ipm-vacio .bi { display: block; font-size: 2rem; color: var(--ipm-faint); margin-bottom: 8px; }

/* Paginación */
#reporteInformeMensualPrestaciones .ipm-pag { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--ipm-line); font-size: 12.5px; color: var(--ipm-muted); }
#reporteInformeMensualPrestaciones .ipm-pag-btns { display: flex; gap: 6px; flex-wrap: wrap; }
#reporteInformeMensualPrestaciones .ipm-pag-btn { min-width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--ipm-line-strong); background: var(--ipm-surface); color: var(--ipm-ink); font-size: 12.5px; font-weight: 600; padding: 0 9px; }
#reporteInformeMensualPrestaciones .ipm-pag-btn.activo { background: var(--ipm-primary); border-color: var(--ipm-primary); color: #fff; }
#reporteInformeMensualPrestaciones .ipm-pag-btn:disabled { opacity: .45; }

#reporteInformeMensualPrestaciones .ipm-nota { font-size: 11px; color: var(--ipm-faint); margin-top: 8px; }
#reporteInformeMensualPrestaciones .ipm-aviso { font-size: 11.5px; color: var(--ipm-primary-dark); background: var(--ipm-primary-soft); border: 1px solid var(--ipm-primary); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; display: none; }

/* ---------------- Responsive: la tabla pasa a tarjetas ---------------- */
@media (max-width: 991.98px) {
    #reporteInformeMensualPrestaciones table.ipm-tabla { min-width: 0; }
    #reporteInformeMensualPrestaciones table.ipm-tabla thead { display: none; }
    #reporteInformeMensualPrestaciones table.ipm-tabla,
    #reporteInformeMensualPrestaciones table.ipm-tabla tbody,
    #reporteInformeMensualPrestaciones table.ipm-tabla tr,
    #reporteInformeMensualPrestaciones table.ipm-tabla td { display: block; width: 100%; }
    #reporteInformeMensualPrestaciones table.ipm-tabla tr { border: 1px solid var(--ipm-line); border-radius: 10px; margin-bottom: 10px; padding: 4px 0; }
    /* ⚠️ El rótulo va ENCIMA del valor, no al lado. Con `justify-content:
       space-between` en una sola fila, una celda de varias líneas (nombre + fecha +
       RUT) se repartía en horizontal contra el rótulo y quedaba ilegible. En columna
       cada línea queda una bajo la otra, que es como se lee una tarjeta. */
    #reporteInformeMensualPrestaciones table.ipm-tabla tbody td { border-bottom: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 12px; }
    #reporteInformeMensualPrestaciones table.ipm-tabla tbody td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ipm-faint); }
    #reporteInformeMensualPrestaciones .ipm-num { text-align: left; }
}

/* Acciones de la cabecera: el chip arriba y el botón "¿Cómo se hace?" en la línea de abajo
   (anclado con data-ayuda-anclaje, ver ayuda/_DOC_boton_ayuda_pantalla.md). */
#reporteInformeMensualPrestaciones .ipm-header-acciones { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
#reporteInformeMensualPrestaciones .ipm-header-acciones .wv-ayuda-pantalla--anclada { margin-left: 0; }

/* ---------------- Propio del Informe Mensual ---------------- */
#reporteInformeMensualPrestaciones #ipm_resultado { display: none; }
#reporteInformeMensualPrestaciones #ipm_panel_informe,
#reporteInformeMensualPrestaciones #ipm_panel_config { display: none; }

/* Contador de cada informe dentro de su pestaña */
#reporteInformeMensualPrestaciones .ipm-vista-n { font-weight: 700; font-size: 11px; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--ipm-paper); color: var(--ipm-muted); border: 1px solid var(--ipm-line); line-height: 17px; text-align: center; }
#reporteInformeMensualPrestaciones .ipm-vista-n:empty { display: none; }
#reporteInformeMensualPrestaciones .ipm-vista.activa .ipm-vista-n { background: #fff; color: var(--ipm-primary-dark); border-color: #fff; }
#reporteInformeMensualPrestaciones .ipm-vista--config { margin-left: auto; }

/* Resumen */
#reporteInformeMensualPrestaciones .ipm-tabla--resumen { min-width: 720px; }
#reporteInformeMensualPrestaciones .ipm-fila-informe td { font-weight: 700; background: var(--ipm-paper); }
#reporteInformeMensualPrestaciones .ipm-fila-informe td .ipm-link { color: var(--ipm-primary-dark); cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
#reporteInformeMensualPrestaciones .ipm-fila-sub td:first-child { padding-left: 28px; color: var(--ipm-muted); }
#reporteInformeMensualPrestaciones .ipm-fila-total td { font-weight: 700; border-top: 2px solid var(--ipm-line-strong); }
#reporteInformeMensualPrestaciones .ipm-cero { color: var(--ipm-faint); }

/* Marcas de la fila: "Sin clasificar" es un ESTADO que pide acción (color ámbar). */
#reporteInformeMensualPrestaciones .ipm-codigo { display: inline-block; font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; font-weight: 700; color: var(--ipm-ink); background: var(--ipm-paper); border: 1px solid var(--ipm-line-strong); border-radius: 5px; padding: 1px 7px; margin-right: 4px; }
#reporteInformeMensualPrestaciones .ipm-estado { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 5px; padding: 2px 8px; white-space: nowrap; }
#reporteInformeMensualPrestaciones .ipm-estado--pendiente { color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; }
#reporteInformeMensualPrestaciones .ipm-estado--ok { color: #15803d; background: #ecfdf5; border: 1px solid #86efac; }
#reporteInformeMensualPrestaciones .ipm-estado--neutro { color: var(--ipm-muted); background: var(--ipm-paper); border: 1px solid var(--ipm-line-strong); }

/* Clasificación */
#reporteInformeMensualPrestaciones .ipm-config-intro { font-size: 12.5px; color: var(--ipm-primary-dark); background: var(--ipm-primary-soft); border: 1px solid var(--ipm-primary); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.5; }
#reporteInformeMensualPrestaciones .ipm-config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; margin-top: 14px; }
@media (max-width: 575.98px) { #reporteInformeMensualPrestaciones .ipm-config-grid { grid-template-columns: 1fr; } }
#reporteInformeMensualPrestaciones .ipm-config-ayuda { font-size: 11.5px; color: var(--ipm-muted); padding: 10px 16px 0; line-height: 1.5; }
#reporteInformeMensualPrestaciones .ipm-config-pie { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
#reporteInformeMensualPrestaciones .ipm-config-estado { font-size: 12px; color: var(--ipm-muted); }
#reporteInformeMensualPrestaciones .ipm-config-estado.sucio { color: #92400e; font-weight: 600; }
#reporteInformeMensualPrestaciones .ipm-btn--auto { width: auto; }
#reporteInformeMensualPrestaciones .ipm-select-sm { height: 36px; font-size: 13px; border-radius: 8px; border: 1px solid var(--ipm-line-strong); flex: 0 1 230px; min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-buscar-catalogo { display: none; padding: 12px 16px; border-bottom: 1px solid var(--ipm-line); }
#reporteInformeMensualPrestaciones .ipm-buscar-catalogo .form-control { height: 38px; font-size: 13px; border-radius: 8px; border: 1px solid var(--ipm-line-strong); }
#reporteInformeMensualPrestaciones table.ipm-tabla select.form-control,
#reporteInformeMensualPrestaciones table.ipm-tabla input.form-control { height: 34px; font-size: 12.5px; border-radius: 7px; border: 1px solid var(--ipm-line-strong); min-width: 0; width: 100%; }
#reporteInformeMensualPrestaciones table.ipm-tabla .ipc-cambiado { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .18); }
#reporteInformeMensualPrestaciones table.ipm-tabla.ipm-tabla--simple { min-width: 0; }
#reporteInformeMensualPrestaciones .ipm-tabla--simple td:nth-child(2) { width: 110px; }
#reporteInformeMensualPrestaciones table.ipm-tabla thead th.col-atencion { width: 190px; min-width: 170px; }
#reporteInformeMensualPrestaciones #ipm_tabla { min-width: 980px; }
@media (max-width: 991.98px) { #reporteInformeMensualPrestaciones #ipm_tabla { min-width: 0; } }
