/*
 * TICKET E IMPRESIÓN — se carga AL FINAL (reset visual).
 *
 * Al imprimir, el armazón y los controles se ocultan y el contenedor de scroll
 * se deshace. Como esta hoja va la última, sus reglas ganan por orden, sin
 * !important. El ticket es papel: blanco y negro a propósito en cualquier
 * tema (únicos colores literales). La vista de impresión de reportes
 * (reports/printView.js) trae su propia hoja.
 */

/* Ticket en pantalla, rollo de 80 mm: lo que se ve es lo que se imprime. */
.ticket {
    width: 80mm;
    max-width: 100%;
    margin: var(--space-4) auto;
    padding: var(--space-4);
    border: 1px solid var(--border);
    background: #fff;
    color: #000;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.4;
}

.ticket__head,
.ticket__foot { text-align: center; }
.ticket__business { margin: 0 0 4px; font-size: 15px; }
.ticket__line { margin: 0; }
.ticket__rule { margin: 6px 0; border: none; border-top: 1px dashed #000; }
.ticket__voided { margin: 4px 0; font-weight: 700; text-align: center; }
.ticket__item { margin-bottom: 4px; }
.ticket__item-name { margin: 0; font-weight: 700; }
.ticket__item-detail,
.ticket__item-total { margin: 0; }
.ticket__item-total { text-align: right; }
.ticket__row { display: flex; justify-content: space-between; margin: 0; }
.ticket__row--strong { font-size: 14px; font-weight: 700; }
.ticket__note { margin-top: 6px; font-size: 10px; }

/* Rollo de 58 mm: misma estructura, letra más pequeña. */
.ticket--58 { width: 58mm; padding: var(--space-3); font-size: 10.5px; }
.ticket--58 .ticket__business { font-size: 13px; }
.ticket--58 .ticket__row--strong { font-size: 12px; }

@media print {
    html,
    body {
        height: auto;
        overflow: visible;
        background: #fff;
    }

    .app-scroll {
        position: static;
        overflow: visible;
    }

    .app-outlet {
        max-width: none;
        padding: 0;
    }

    .app-header {
        position: static;
    }

    /* Armazón, controles y capas no se imprimen: sólo el contenido. */
    .app-sidebar,
    .sidebar-backdrop,
    .app-topbar,
    .skip-link,
    .toast-region,
    .report-filters,
    .no-print,
    .palette,
    :is(.dialog, .drawer, .pay-editor, .palette)[open] {
        display: none;
    }

    .panel {
        padding: 0;
        border: 0;
    }

    .table th,
    .table td {
        white-space: normal;
    }

    /* Ticket: página CSS "ticket" (tamaño medido por receipt.js); sólo el ticket. */
    body.printing-ticket {
        margin: 0;
    }

    body.printing-ticket .app-outlet,
    body.printing-ticket .stack {
        max-width: none;
        margin: 0;
        padding: 0;
        gap: 0;
    }

    .ticket {
        page: ticket;
        width: 100%;
        margin: 0;
        padding: 2mm 3mm;
        border: none;
        background: #fff;
        color: #000;
        font-size: 11px;
    }

    .ticket--58 {
        padding: 1.5mm 2mm;
        font-size: 9.5px;
    }

    /* Una línea de producto no se parte. */
    .ticket__item,
    .ticket__row {
        break-inside: avoid;
    }

    /* Respaldo si el navegador no aplica el tamaño medido: rollo de 80 mm. */
    @page ticket {
        size: 80mm 297mm;
        margin: 0;
    }
}
