/* // cod- 10-08-2026: jerarquía visual profesional del Reporte de Ventas en pantalla e impresión A4. */
.sales-report-page {
    --report-blue: #123453;
    --report-red: #c92d3e;
    --report-ink: #1c3147;
    --report-muted: #6f7d8e;
    --report-line: #dce3e9;
    max-width: 1500px;
    margin: auto;
    color: var(--report-ink);
}

.sales-report-page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sales-report-page-header p {
    margin: 0;
    color: var(--report-red);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sales-report-page-header h1 { margin: .08rem 0; color: #0d2948; font-size: 2.15rem; }
.sales-report-page-header span { color: #748095; }
.sales-report-page-header button,
.sales-report-filter-grid button {
    padding: .7rem 1rem;
    border: 0;
    border-radius: 8px;
    background: #0d3153;
    color: #fff;
    font-weight: 800;
}

.sales-report-filters { padding: 1rem; border: 1px solid #dfe5eb; border-radius: 13px; background: #fff; }
.sales-report-quick { display: flex; flex-wrap: wrap; gap: .35rem; }
.sales-report-quick button {
    padding: .55rem .8rem;
    border: 0;
    border-radius: 7px;
    background: #edf1f5;
    color: #405369;
    font-weight: 750;
}
.sales-report-quick button.active { background: var(--report-red); color: #fff; }

.sales-report-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    align-items: end;
    gap: .65rem;
    margin-top: .75rem;
}
.sales-report-filter-grid label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .25rem;
    color: #657387;
    font-size: .67rem;
    font-weight: 850;
    text-transform: uppercase;
}
.sales-report-filter-grid input,
.sales-report-filter-grid select {
    width: 100%;
    min-height: 40px;
    padding: .45rem;
    border: 1px solid #d5dde5;
    border-radius: 7px;
    background: #fff;
    color: #21364d;
}

.sales-report-error,
.sales-report-state {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #e2e7ec;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}
.sales-report-error,
.sales-report-state.denied { color: #b42036; background: #fff1f3; }

.sales-report-print {
    margin-top: 1rem;
    padding: 1.25rem 1.4rem;
    border: 1px solid #dde4ea;
    border-radius: 13px;
    background: #fff;
}

.sales-report-print-header {
    display: grid;
    grid-template-columns: minmax(230px, .8fr) minmax(0, 2.2fr);
    align-items: end;
    gap: .8rem 1.5rem;
    padding-bottom: .85rem;
    border-bottom: 2px solid var(--report-blue);
}
.sales-report-brand strong { color: var(--report-red); font-size: .72rem; letter-spacing: .14em; }
.sales-report-brand h1 { margin: .18rem 0 0; color: var(--report-blue); font-size: 1.42rem; line-height: 1.1; }
.sales-report-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: .35rem 1rem;
    margin: 0;
}
.sales-report-meta div { min-width: 0; }
.sales-report-meta dt {
    color: var(--report-muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.sales-report-meta dd {
    margin: .08rem 0 0;
    overflow: hidden;
    font-size: .72rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sales-report-print-header > small { grid-column: 1 / -1; color: var(--report-muted); font-size: .66rem; }

.sales-report-print h2 {
    margin: 1.15rem 0 .45rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid #cfd7df;
    color: var(--report-blue);
    font-size: .78rem;
    letter-spacing: .08em;
}

.sales-report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.sales-report-summary > div {
    display: flex;
    min-width: 0;
    min-height: 74px;
    flex-direction: column;
    justify-content: space-between;
    gap: .25rem;
    padding: .72rem .78rem;
    border: 1px solid #dfe5ea;
    border-radius: 8px;
    background: #fafbfc;
}
.sales-report-summary span,
.sales-report-secondary span {
    color: var(--report-muted);
    font-size: .6rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.sales-report-summary b { color: var(--report-blue); font-size: 1.08rem; }
.sales-report-summary .total { border-color: #b8c8d7; background: #edf3f8; }
.sales-report-summary .total b,
.sales-report-summary .count b { font-size: 1.2rem; }
.sales-report-summary .returns b { color: #9f4651; }

.sales-report-print h2.secondary-title { margin-top: .9rem; color: #5f6e80; font-size: .68rem; }
.sales-report-secondary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--report-line);
    border-bottom: 1px solid var(--report-line);
}
.sales-report-secondary > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .14rem;
    padding: .5rem .65rem;
    border-right: 1px solid #e7ebef;
}
.sales-report-secondary > div:last-child { border-right: 0; }
.sales-report-secondary b { font-size: .78rem; }

.sales-report-table-wrap { max-width: 100%; overflow-x: auto; }
.sales-report-print table { width: 100%; border-collapse: collapse; font-size: .72rem; }
.sales-report-print th {
    padding: .5rem .55rem;
    border-top: 1px solid #d8e0e7;
    border-bottom: 1px solid #cbd5de;
    background: #f5f7f9;
    color: #627186;
    font-size: .59rem;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.sales-report-print td { padding: .52rem .55rem; border-bottom: 1px solid #e5e9ed; vertical-align: top; }
.sales-report-print tbody tr:hover { background: #fafbfd; }
.sales-report-print td small { display: block; margin-top: .15rem; color: #768397; }
.sales-report-print .money,
.sales-report-print .number { text-align: right; white-space: nowrap; }
.sales-report-print .key-value { color: #113b62; }
.sales-report-print .balance-value { color: #6e3d24; }
.sales-report-print .muted-money,
.sales-report-print .audit-value,
.sales-report-main .audit-column { color: #788596; }
.operation-table td:first-child,
.payment-table td:first-child { border-left: 3px solid transparent; }
.operation-table tr:hover td:first-child,
.payment-table tr:hover td:first-child { border-left-color: #b6c8d8; }
.payment-table th:last-child,
.payment-table td:last-child,
.operation-table th:nth-child(5),
.operation-table td:nth-child(5),
.operation-table th:nth-child(7),
.operation-table td:nth-child(7) { background: #f7fafc; }

.sales-report-products,
.sales-report-main { min-width: 1080px; }
.sales-report-customers { min-width: 760px; }
.sales-report-products .product-code { color: #4f6073; font-family: Consolas, monospace; font-size: .67rem; }
.sales-report-main tr.cancelled { color: #8994a2; background: #fbfbfc; }
.sales-report-status {
    display: inline-block;
    padding: .18rem .4rem;
    border: 1px solid #dbe3e9;
    border-radius: 999px;
    background: #f5f7f9;
    font-weight: 800;
}
.cancellation-audit { display: block; max-width: 210px; margin-top: .25rem; padding-top: .22rem; border-top: 1px solid #e2e6ea; }
.sales-report-actions > div { display: flex; flex-wrap: wrap; gap: .25rem; }
.sales-report-actions a,
.sales-report-actions button {
    padding: .3rem .45rem;
    border: 1px solid #d1dae3;
    border-radius: 5px;
    background: #fff;
    color: #173b60;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
}
.sales-report-empty { padding: .65rem; color: #778497; text-align: center; }
/* cod- 27-08-2026: notas temporales visibles también en impresión. */
.sales-report-scope-note { margin: .45rem 0 .75rem; color: #627186; font-size: .72rem; line-height: 1.45; overflow-wrap: anywhere; }
.sales-report-limit { display: block; margin-top: .65rem; color: #768397; }

@media (max-width: 1050px) {
    .sales-report-filter-grid { grid-template-columns: repeat(3, 1fr); }
    .sales-report-print-header { grid-template-columns: 1fr; }
    .sales-report-meta { grid-template-columns: repeat(3, 1fr); }
    .sales-report-summary { grid-template-columns: repeat(2, 1fr); }
    .sales-report-secondary { grid-template-columns: repeat(3, 1fr); }
    .sales-report-secondary > div { border-bottom: 1px solid #e7ebef; }
}

@media (max-width: 600px) {
    .sales-report-page-header { align-items: flex-start; flex-direction: column; }
    .sales-report-page-header h1 { font-size: 1.8rem; }
    .sales-report-page-header button { width: 100%; }
    .sales-report-filters,
    .sales-report-print { padding: .7rem; }
    .sales-report-filter-grid { grid-template-columns: 1fr 1fr; }
    .sales-report-filter-grid button { grid-column: 1 / -1; }
    .sales-report-print-header { gap: .55rem; }
    .sales-report-meta { grid-template-columns: 1fr 1fr; gap: .4rem .7rem; }
    .sales-report-meta dd { white-space: normal; }
    .sales-report-summary { grid-template-columns: 1fr; gap: .4rem; }
    .sales-report-summary > div { min-height: 62px; }
    .sales-report-secondary { grid-template-columns: 1fr 1fr; }
    .sales-report-secondary > div:nth-child(even) { border-right: 0; }
    .sales-report-compact { min-width: 720px; }
    .sales-report-main { min-width: 1080px; }
}

@media print {
    @page sales-report { size: A4 portrait; margin: 9mm; }
    html,
    body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }
    body:has(.sales-report-print) *:not(.sales-report-print):not(.sales-report-print *):not(:has(.sales-report-print)) { display: none !important; }
    body:has(.sales-report-print) *:has(.sales-report-print) {
        display: contents !important;
        position: static !important;
        inset: auto !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .sales-report-print {
        page: sales-report;
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        overflow: visible !important;
        box-shadow: none !important;
        font-size: 8pt !important;
    }
    .sales-report-print-header {
        display: grid !important;
        grid-template-columns: 1fr 2.4fr !important;
        gap: .35rem 1rem !important;
        padding-bottom: 4mm !important;
    }
    .sales-report-brand h1 { font-size: 13pt !important; }
    .sales-report-meta { grid-template-columns: repeat(3, 1fr) !important; gap: 2mm 5mm !important; }
    .sales-report-meta dt { font-size: 5.5pt !important; }
    .sales-report-meta dd { font-size: 7pt !important; }
    .sales-report-print h2 {
        margin: 5mm 0 1.5mm !important;
        padding-bottom: 1mm !important;
        font-size: 7pt !important;
        break-after: avoid;
        page-break-after: avoid;
    }
    .sales-report-summary {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0 !important;
        border-top: 1px solid #aab5bf !important;
    }
    .sales-report-summary > div {
        min-height: 0 !important;
        padding: 2mm 2.5mm !important;
        border: 0 !important;
        border-bottom: 1px solid #d8dee3 !important;
        border-radius: 0 !important;
        background: #fff !important;
    }
    .sales-report-summary span,
    .sales-report-secondary span { font-size: 5.2pt !important; }
    .sales-report-summary b { font-size: 8.5pt !important; }
    .sales-report-summary .total b { font-size: 9pt !important; }
    .sales-report-secondary {
        grid-template-columns: repeat(5, 1fr) !important;
        border-color: #b7c0c8 !important;
    }
    .sales-report-secondary > div { padding: 1.6mm 2mm !important; border-right: 0 !important; border-bottom: 0 !important; }
    .sales-report-secondary b { font-size: 7pt !important; }
    .sales-report-print-header,
    .sales-report-summary > div,
    .sales-report-secondary > div,
    .sales-report-print tr { break-inside: avoid; page-break-inside: avoid; }
    .sales-report-table-wrap { overflow: visible !important; }
    .sales-report-print table { min-width: 0 !important; font-size: 6.2pt !important; }
    .sales-report-print thead { display: table-header-group; }
    .sales-report-print th,
    .sales-report-print td { padding: 1.15mm 1.25mm !important; }
    .sales-report-print th {
        border-top: 1px solid #9eabb7 !important;
        border-bottom: 1px solid #9eabb7 !important;
        background: #fff !important;
        font-size: 5.2pt !important;
    }
    .sales-report-main { font-size: 5.3pt !important; }
    /* cod- 27-08-2026: nombres históricos o formas adicionales largas no ensanchan la hoja. */
    .sales-report-print td:not(.money):not(.number) { overflow-wrap: anywhere; }
    .sales-report-main { table-layout: fixed; }
    .sales-report-main th { white-space: normal; overflow-wrap: anywhere; }
    .sales-report-scope-note { font-size: 7pt; }
    .sales-report-main .cancellation-audit { max-width: 30mm !important; }
    .payment-table th:last-child,
    .payment-table td:last-child,
    .operation-table th:nth-child(5),
    .operation-table td:nth-child(5),
    .operation-table th:nth-child(7),
    .operation-table td:nth-child(7) { background: #fff !important; }
    .sales-report-screen-only,
    .sales-report-actions,
    .sales-report-limit { display: none !important; }
    .sales-report-main tbody tr:nth-child(n+101) { display: none !important; }
}
