@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}

#verContrasena, [data-ver-contrasena] { border-color: var(--bs-border-color); }

.recibo {
    position: relative;
    isolation: isolate;
    max-width: 720px;
    min-height: 960px;
    margin: 0 auto;
    background: #fff;
    padding-top: 16px;
    font: 16px/1.1 Calibri, Arial, sans-serif;
    color: #000;
}

.recibo:not(.recibo-reverso)::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: url('../images/no-copiar.png') center / 76.3% auto no-repeat;
    pointer-events: none;
}
.recibo-reverso { break-before: page; }

@media screen {
    main:has(.recibo) {
        display: grid;
        grid-template-columns: repeat(2, 720px);
        column-gap: 24px;
        justify-content: safe center;
        overflow-x: auto;
    }
    main:has(.recibo) > .no-print { grid-column: 1 / -1; }
    .recibo { width: 720px; }
}

.recibo-parte { min-height: 592px; break-inside: avoid; }
.recibo-copia { min-height: 0; }
.recibo-encabezado { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.recibo-encabezado img { flex-shrink: 0; }
.recibo-encabezado h3 { margin: 0; font-size: 32px; font-weight: 700; text-align: right; }
.recibo-folio { display: inline-block; min-width: 80px; border-bottom: 2px solid #000; font-size: 14px; text-align: center; }
.recibo-mensaje { margin: 4px 0; font-size: 16px; font-weight: 700; color: #c00; text-align: right; }
.recibo-condiciones { margin: 0; padding-left: 48px; font-size: 13.333px; line-height: 1.15; text-align: justify; }
.recibo-condiciones li { margin-bottom: 4px; }
.recibo-condiciones ul { margin-top: 4px; padding-left: 48px; list-style-type: disc; }
.recibo-aviso { margin: 18px 0 16px; font-style: italic; line-height: 1.2; }
.recibo mark { padding: 0; background: #ff0; color: #000; }
.recibo-datos { width: 100%; border-collapse: collapse; table-layout: fixed; background: #f0f0f0; }
.recibo-datos th, .recibo-datos td { border: 1px solid #777; padding: 2px 4px; overflow-wrap: anywhere; }
.recibo-datos th { width: 22%; }
.recibo-copia .recibo-datos { margin-top: 36px; }
.recibo-copia:has(.recibo-mensaje) .recibo-datos { margin-top: 24px; }
.recibo-leyendas { margin-top: 4px; font-weight: 700; }
.recibo-pie { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 48px; font-weight: 700; }
.recibo-copia .recibo-pie { margin-top: 56px; }
.recibo-cancelado { margin: 8px 0; border: 1px solid #b02a37; color: #b02a37; font-weight: 700; text-align: center; }

@page recibo {
    size: letter;
    margin: .5in;
    @top-left { content: ""; }
    @top-center { content: ""; }
    @bottom-left { content: ""; }
    @bottom-right { content: counter(page) "/" counter(pages); font: 8px Arial, sans-serif; }
}
@media print {
    main:has(.recibo) { padding: 0 !important; }
    .recibo { page: recibo; max-width: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@page pagos {
    size: letter;
    margin: .4in;
    @top-left { content: ""; }
    @top-center { content: ""; }
    @top-right { content: ""; }
    @bottom-left { content: ""; }
    @bottom-center { content: ""; }
    @bottom-right { content: counter(page) "/" counter(pages); font: 8px Arial, sans-serif; }
}
@media print {
    main:has(.reporte-pagos) { padding: 0 !important; }
    .reporte-pagos { page: pagos; color: #000; }
    .reporte-pagos .table-responsive { overflow: visible; }
    .reporte-pagos table { table-layout: fixed; font-size: 11px; line-height: 1.2; }
    .reporte-pagos col:nth-child(1) { width: 9%; }
    .reporte-pagos col:nth-child(2) { width: 11%; }
    .reporte-pagos col:nth-child(3) { width: 6%; }
    .reporte-pagos col:nth-child(4) { width: 16%; }
    .reporte-pagos col:nth-child(5) { width: 17%; }
    .reporte-pagos col:nth-child(6) { width: 11%; }
    .reporte-pagos col:nth-child(7) { width: 11%; }
    .reporte-pagos col:nth-child(8) { width: 7%; }
    .reporte-pagos col:nth-child(9) { width: 12%; }
    .reporte-pagos thead { display: table-header-group; }
    .reporte-pagos-total { border-bottom: 0 !important; font-size: 13px; }
    .reporte-pagos th, .reporte-pagos td { white-space: nowrap; }
    .reporte-pagos :is(th, td):nth-child(4), .reporte-pagos :is(th, td):nth-child(5),
    .reporte-pagos [colspan] { white-space: normal; overflow-wrap: anywhere; }
    .reporte-pagos tr { break-inside: avoid; }
}

.audit-info {
    font-size: .8rem;
    color: #6c757d;
}

/* ---------- Tableros ---------- */
.donut {
    max-width: 220px;
    width: 100%;
    transform: none;
}
.donut circle { transition: opacity .15s; }
.donut circle:hover { opacity: .8; }
.donut-numero { font-size: 8px; font-weight: 700; fill: #212529; }
.donut-texto { font-size: 2.6px; fill: #6c757d; }

.barras { width: 100%; max-height: 300px; }
.barras .rejilla { stroke: #dee2e6; stroke-width: 1; }
.barras .eje { font-size: 11px; fill: #6c757d; }
.barras .valor-barra { font-size: 15px; font-weight: 700; fill: #212529; }
.barras .etiqueta-barra { font-size: 12px; fill: #212529; }
.barras .monto-barra { font-size: 11px; fill: #6c757d; }

.grafica-pagos { display: block; width: 100%; min-width: 760px; max-height: 380px; }
.grafica-pagos .rejilla { stroke: #dee2e6; stroke-width: 1; }
.grafica-pagos .eje { font-size: 12px; fill: #6c757d; }
.area-pagos { fill: #a0522d; opacity: .7; }
.linea-pagos { fill: none; stroke: #8b4513; stroke-width: 2; }
.punto-pago { fill: #8b4513; stroke: #fff; stroke-width: 1; }
.dia-pago { cursor: pointer; outline: none; }
.ayuda-pago { visibility: hidden; pointer-events: none; }
.ayuda-pago line { stroke: #8b4513; stroke-dasharray: 4 3; }
.ayuda-pago rect { fill: #fff; stroke: #8b4513; }
.ayuda-pago text { font-size: 12px; fill: #212529; }
.dia-pago:hover .ayuda-pago, .dia-pago:focus .ayuda-pago { visibility: visible; }
.grafica-pagos:focus-within .dia-pago:not(:focus) .ayuda-pago { visibility: hidden; }

.leyenda-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: .5rem;
    vertical-align: middle;
}

.mapa-piso { margin-bottom: .9rem; }
.mapa-piso-titulo { font-weight: 600; font-size: .85rem; color: #6c757d; margin-bottom: .25rem; }
.mapa-fila {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: .4rem;
}

.cuarto-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    padding: .25rem;
    border: 2px solid transparent;
    border-radius: .4rem;
    color: #fff;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
    transition: transform .1s;
}
.cuarto-tile small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .65rem;
    font-weight: 400;
}
.cuarto-tile:hover { transform: scale(1.06); border-color: #212529; color: #fff; }
.cuarto-tile:focus-visible { outline: 3px solid #0d6efd; outline-offset: 2px; }

.estado-verde { background: #198754; }
.estado-amarillo { background: #ffc107; color: #212529; }
.estado-amarillo:hover { color: #212529; }
.estado-rojo { background: #dc3545; }
.estado-gris { background: #adb5bd; color: #212529; }
.estado-gris:hover { color: #212529; }
.estado-mantenimiento {
    background: repeating-linear-gradient(45deg, #adb5bd, #adb5bd 6px, #ced4da 6px, #ced4da 12px);
    color: #212529;
}
.estado-mantenimiento:hover { color: #212529; }
