/* ═══ گزارش ماتریس موجودی سالن-هفته — نمایش + چاپ ═══ */

.swm-inventory-page {
    direction: rtl;
}

.swm-shell {
    background: linear-gradient(
        180deg,
        var(--mud-palette-surface) 0%,
        color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-primary) 8%) 100%
    );
    border-radius: 18px;
}

.swm-shell.no-shadow {
    box-shadow: none !important;
}

/* ─── هدر ─── */
.swm-inventory-page .swm-header {
    padding: 18px 22px;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--mud-palette-primary) 72%, #000) 0%,
        var(--mud-palette-primary, #00897b) 45%,
        color-mix(in srgb, var(--mud-palette-primary) 75%, var(--mud-palette-surface)) 100%
    );
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.swm-inventory-page .swm-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 70% 100% at 0% 0%,
        color-mix(in srgb, #fff 14%, transparent),
        transparent 50%
    );
    pointer-events: none;
    border-radius: 16px;
}

.swm-inventory-page .swm-header .title-section {
    position: relative;
    z-index: 1;
}

.swm-inventory-page .swm-header-title,
.swm-inventory-page .swm-header .page-title {
    color: #fff !important;
    font-weight: 800 !important;
    margin: 0 !important;
    text-shadow: 0 1px 2px color-mix(in srgb, #000 25%, transparent);
}

.swm-inventory-page .swm-header-sub {
    color: color-mix(in srgb, #fff 88%, transparent) !important;
    position: relative;
    z-index: 1;
}

.swm-inventory-page .swm-header-icon {
    color: #fff !important;
    position: relative;
    z-index: 1;
}

.swm-inventory-page .swm-header-chip {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    position: relative;
    z-index: 1;
}

/* ─── فیلتر ─── */
.swm-inventory-page .swm-filter {
    border-radius: 14px;
    background: color-mix(in srgb, var(--mud-palette-primary, #00897b) 8%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary, #00897b) 16%, var(--mud-palette-lines-default));
}

.swm-inventory-page .swm-selection-box {
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-primary, #00897b) 10%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary, #00897b) 12%, var(--mud-palette-lines-default));
    height: 100%;
}

.swm-inventory-page .swm-selection-label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.swm-inventory-page .swm-selection-value {
    font-weight: 700;
    color: var(--mud-palette-primary, #00897b);
}

.swm-inventory-page .swm-loading {
    background: var(--mud-palette-surface);
    border-radius: 12px;
}

/* ─── جدول ─── */
.swm-inventory-page .swm-grid-paper {
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary, #00897b) 14%, var(--mud-palette-lines-default));
    overflow: hidden;
    background: var(--mud-palette-surface);
}

.swm-inventory-page .swm-table-toolbar {
    padding: 0.5rem 0.75rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-primary, #00897b) 12%, var(--mud-palette-lines-default));
}

.swm-inventory-page .swm-table-toolbar-title {
    font-weight: 700 !important;
    color: var(--mud-palette-primary, #00897b) !important;
}

.swm-inventory-page .swm-grid-wrap {
    width: 100%;
    height: min(72dvh, calc(100dvh - 320px));
    min-height: 320px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.swm-inventory-page .swm-col-salon,
.swm-inventory-page .swm-col-salon.mud-table-cell {
    width: 1% !important;
    white-space: nowrap !important;
    max-width: 11rem;
}

.swm-inventory-page .swm-col-week,
.swm-inventory-page .swm-col-week.mud-table-cell {
    width: 46px !important;
    min-width: 42px !important;
    max-width: 54px !important;
    padding: 2px 3px !important;
}

.swm-inventory-page .swm-week-head {
    min-height: 0 !important;
    padding: 2px 1px !important;
}

.swm-inventory-page .swm-week-head .swm-th-sub {
    font-size: 0.72rem;
    font-weight: 700;
}

.swm-inventory-page .swm-cell-val {
    display: inline-block;
    min-width: 0;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums;
    font-size: 1rem !important;
    line-height: 1.25;
    text-align: center;
    background: color-mix(in srgb, var(--mud-palette-primary, #00897b) 14%, var(--mud-palette-surface));
    color: color-mix(in srgb, var(--mud-palette-primary, #00897b) 85%, #000);
}

.swm-inventory-page .swm-cell-empty {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-disabled);
}

.swm-inventory-page .swm-datagrid .swm-footer-num,
.swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-num {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums;
}

.swm-inventory-page .swm-kpi-value {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
}

@media screen {
    html[data-theme="dark"] .swm-inventory-page .swm-cell-val,
    .mud-theme-dark .swm-inventory-page .swm-cell-val {
        color: #80cbc4;
        background: color-mix(in srgb, var(--mud-palette-primary, #00897b) 35%, var(--mud-palette-surface));
    }

    html[data-theme="dark"] .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer td,
    .mud-theme-dark .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer td {
        background: color-mix(in srgb, var(--mud-palette-primary, #00897b) 10%, var(--mud-palette-surface)) !important;
    }

    html[data-theme="dark"] .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-num,
    html[data-theme="dark"] .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-week,
    .mud-theme-dark .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-num,
    .mud-theme-dark .swm-inventory-page .salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-week {
        color: rgba(255, 255, 255, 0.95) !important;
        -webkit-text-fill-color: rgba(255, 255, 255, 0.95) !important;
    }
}

/* بنر چاپ */
.swm-print-banner {
    display: none;
}

.swm-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 12px;
    font-size: 9pt;
    margin-top: 6px;
}

/* ═══ چاپ A4 افقی ═══ */
@media print {
    @page {
        size: A4 landscape;
        margin: 5mm 6mm;
    }

    html,
    html[data-theme="dark"],
    body,
    .ps-app,
    html[data-theme="dark"] .ps-app,
    .mud-theme-dark.ps-app {
        background: #fff !important;
        background-color: #fff !important;
        color: #000 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .no-print,
    .swm-inventory-page .swm-filter,
    .swm-inventory-page .swm-table-toolbar,
    .swm-kpi-grid,
    .mud-drawer,
    .mud-appbar,
    nav,
    footer,
    #custom-loading {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .swm-print-banner {
        display: block !important;
        padding: 0 0 4px !important;
        margin: 0 0 5px !important;
        border-bottom: 2px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .swm-print-banner h1 {
        font-size: 13pt !important;
        margin: 0 0 4px !important;
        color: #000 !important;
    }

    .swm-print-banner .swm-print-grid,
    .swm-print-banner .swm-print-grid div {
        color: #000 !important;
    }

    .mud-layout,
    .mud-main-content,
    .swm-inventory-page,
    .swm-shell,
    .swm-grid-paper,
    .swm-grid-wrap {
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
        color: #000 !important;
    }

    html[data-theme="dark"] .swm-inventory-page .swm-datagrid,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-table,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-table-root,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-table-container,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-table-wrapper,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-data-grid-root,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-table-head,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-data-grid-footer,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid .mud-data-grid-footer tr,
    .mud-theme-dark .swm-inventory-page .swm-datagrid,
    .mud-theme-dark .swm-inventory-page .swm-datagrid .mud-table,
    .mud-theme-dark .swm-inventory-page .swm-datagrid .mud-data-grid-footer {
        background: #fff !important;
        background-color: #fff !important;
        background-image: none !important;
        box-shadow: none !important;
    }

    html[data-theme="dark"] .swm-inventory-page .mud-table-body .mud-table-cell,
    html[data-theme="dark"] .swm-inventory-page .mud-table-body td,
    .mud-theme-dark .swm-inventory-page .mud-table-body .mud-table-cell {
        background: #fff !important;
        color: #000 !important;
    }

    .swm-inventory-page .swm-datagrid .mud-table-body .mud-table-cell,
    .swm-inventory-page .swm-datagrid .swmm-cell-val,
    .swm-inventory-page .swm-datagrid .swm-cell-val,
    .swm-inventory-page .swm-datagrid .swm-salon-name {
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
        background: #fff !important;
        background-color: #fff !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .swm-inventory-page .swm-datagrid .mud-table-body .swm-cell-empty {
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
        background: #fff !important;
        background-color: #fff !important;
    }

    .swm-inventory-page .swm-datagrid .mud-data-grid-footer .swm-cell-empty,
    .swm-inventory-page .swm-datagrid .mud-data-grid-footer .swm-footer-num {
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    html .swm-inventory-page .swm-datagrid.swm-grid-lined .mud-table-head th,
    html .swm-inventory-page .swm-datagrid.swm-grid-lined .mud-table-body .mud-table-cell,
    html .swm-inventory-page .swm-datagrid.swm-grid-lined .mud-data-grid-footer .mud-table-cell {
        border: 1px solid #000 !important;
        padding: 1px 2px !important;
        line-height: 1.15 !important;
    }

    /* فوتر چاپ — پررنگ؛ لایه mud-table-cell داخلی هم رنگ سلول */
    html body.print-report .swm-inventory-page .mud-data-grid-footer td.swm-col-salon,
    html body.print-report .swm-inventory-page .mud-data-grid-footer td.swm-col-salon .mud-table-cell,
    html body.print-report .swm-inventory-page .mud-data-grid-footer td.swm-col-salon *,
    html body.print-report .swm-inventory-page .swm-footer-salon,
    html body.print-report .swm-inventory-page .swm-footer-salon * {
        background: #263238 !important;
        background-color: #263238 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer td.swm-col-week,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer td.swm-col-week .mud-table-cell,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer .mud-table-cell.swm-col-week,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer td.swm-col-week *,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer .swm-footer-num,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-female .mud-data-grid-footer .swm-footer-week {
        background: #004d40 !important;
        background-color: #004d40 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer td.swm-col-week,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer td.swm-col-week .mud-table-cell,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer .mud-table-cell.swm-col-week,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer td.swm-col-week *,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer .swm-footer-num,
    html body.print-report .swm-inventory-page .swm-datagrid.swm-sex-male .mud-data-grid-footer .swm-footer-week {
        background: #0d47a1 !important;
        background-color: #0d47a1 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-week,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-week .mud-table-cell,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-week *,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-num,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer .swm-footer-week {
        background: #004d40 !important;
        background-color: #004d40 !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head th,
    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head .mud-table-cell,
    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head th .mud-table-cell,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored .mud-table-head th,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored .mud-table-head .mud-table-cell,
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored .mud-table-head th .mud-table-cell,
    .mud-theme-dark .swm-inventory-page .swm-datagrid-colored .mud-table-head th,
    .mud-theme-dark .swm-inventory-page .swm-datagrid-colored .mud-table-head .mud-table-cell {
        background-image: none !important;
        box-shadow: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored .mud-table-head th:has(.swm-th-sub--salon),
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored .mud-table-head .mud-table-cell:has(.swm-th-sub--salon) {
        background-color: #455a64 !important;
    }

    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored.swm-sex-female .mud-table-head th:has(.swm-th-sub--week),
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored.swm-sex-female .mud-table-head .mud-table-cell:has(.swm-th-sub--week) {
        background-color: #00695c !important;
    }

    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored.swm-sex-male .mud-table-head th:has(.swm-th-sub--week),
    html[data-theme="dark"] .swm-inventory-page .swm-datagrid-colored.swm-sex-male .mud-table-head .mud-table-cell:has(.swm-th-sub--week) {
        background-color: #1565c0 !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head th:has(.swm-th-sub--salon),
    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head .mud-table-cell:has(.swm-th-sub--salon),
    html body.print-report .swm-inventory-page .swm-datagrid-colored .mud-table-head th:has(.swm-th-sub--salon) .mud-table-cell {
        background-color: #455a64 !important;
        background: #455a64 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid-colored.swm-sex-female .mud-table-head th:has(.swm-th-sub--week),
    html body.print-report .swm-inventory-page .swm-datagrid-colored.swm-sex-female .mud-table-head .mud-table-cell:has(.swm-th-sub--week) {
        background-color: #00695c !important;
        background: #00695c !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .swm-datagrid-colored.swm-sex-male .mud-table-head th:has(.swm-th-sub--week),
    html body.print-report .swm-inventory-page .swm-datagrid-colored.swm-sex-male .mud-table-head .mud-table-cell:has(.swm-th-sub--week) {
        background-color: #1565c0 !important;
        background: #1565c0 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* غلبه نهایی چاپ — بدون لایه مشکی تم تاریک */
@media print {
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-salon,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-salon .mud-table-cell,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-salon *,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-salon,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid .mud-data-grid-footer td.swm-col-salon * {
        background: #263238 !important;
        background-color: #263238 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer td.swm-col-week,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer td.swm-col-week .mud-table-cell,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer .swm-footer-num,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer .swm-footer-week,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer td.swm-col-week,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer td.swm-col-week *,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-female .mud-data-grid-footer .swm-footer-num {
        background: #004d40 !important;
        background-color: #004d40 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer td.swm-col-week,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer td.swm-col-week .mud-table-cell,
    html body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer .swm-footer-num,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer td.swm-col-week,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer td.swm-col-week *,
    html[data-theme="dark"] body.print-report .swm-inventory-page .general-datagrid-class.salon-week-inventory-matrix-grid.swm-sex-male .mud-data-grid-footer .swm-footer-num {
        background: #0d47a1 !important;
        background-color: #0d47a1 !important;
        background-image: none !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html[data-theme="dark"] body.print-report .swm-inventory-page .swm-datagrid .mud-data-grid-footer .swm-footer-num,
    html[data-theme="dark"] body.print-report .swm-inventory-page .swm-datagrid .mud-data-grid-footer .swm-footer-week,
    .mud-theme-dark body.print-report .swm-inventory-page .swm-datagrid .mud-data-grid-footer .swm-footer-num {
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
    }
}
