﻿/* ═══════════════════════════════════════════════════════════════════════════
   SALES ANALYTICS — sa-responsive.css
   General media queries. MUST load LAST in the bundle.

   Owns:
     - Page-wide breakpoints affecting Day, Index, modals together
     - Cross-cutting overrides at 1536 / 1400 / 1200 / 1024 / 900 / 640px

   Does NOT own:
     - Component-scoped media queries that only affect one component's
       internal layout — those live with their component (e.g. Vendor
       Detail's grid-width overrides at 1024/640 are in
       sa-modal-vendor-detail.css)

   Why a single file: most of these rules touch selectors from multiple
   other files (Day movers + Index filters + modal padding), so splitting
   them per-component would mean a single breakpoint change requires
   editing several files. Keeping them centralized makes "what happens at
   900px?" answerable with one open file.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 1536px) {
    .sa-metrics-strip {
        grid-template-columns: repeat(4, minmax(192px, 1fr));
    }
}

@media (max-width: 1400px) {
    .sa-headline-compact {
        gap: .75rem;
    }

    .sa-kpi-pills {
        gap: .35rem;
    }

    .sa-kpi-pill {
        padding: .25rem .6rem;
        font-size: .78rem;
    }
}

@media (max-width: 1200px) {
    .sa-metrics-strip {
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }

    .sa-kpi-row.sa-kpi-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .sa-month-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sa-filter-panel-group-row {
        grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
    }

    .sa-history-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .sa-divisions-legend,
    .sa-acc-header {
        gap: .3rem;
        font-size: .72rem;
    }

    .sa-acc-daily {
        font-size: .78rem;
    }

    .sa-acc-weektotal {
        font-size: .85rem;
    }

    .sa-divisions-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

        .sa-divisions-toolbar .sa-search-wrap {
            max-width: none;
            margin-left: 0;
        }

    .sa-search-results {
        right: 1.15rem;
        left: 1.15rem;
        width: auto;
    }

    .sa-headline-compact {
        row-gap: .5rem;
    }
}

@media (max-width: 900px) {
    .sa-headline-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .sa-headline-compact .sa-headline-actions {
        margin-left: 0;
    }

    .sa-filter-panel-group-row {
        grid-template-columns: 1fr 1fr;
    }

    .sa-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .sa-movers-row {
        grid-template-columns: 1fr;
    }

    .sa-movers-row-compact {
        flex-direction: column;
    }

    .sa-mover-card-hd-inline {
        gap: .35rem;
    }

    .sa-week-nav {
        gap: .6rem;
    }

    .sa-tbl-pills {
        display: none;
    }

    .sa-month-nav {
        gap: .75rem;
    }

    .sa-month-name {
        font-size: .95rem;
    }

    .sa-acc-daily {
        font-size: .75rem;
    }

    .sa-metrics-strip {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
    }

    .sa-partial-banner {
        padding: 1rem 1.1rem;
    }
}

@media (max-width: 640px) {
    .sa-wrapper {
        padding-inline: .65rem;
    }

    .sa-headline-title {
        font-size: 1.15rem;
    }

    .sa-headline-compact .sa-headline-title {
        font-size: 1.05rem;
    }

    .sa-kpi-pill {
        font-size: .75rem;
        padding: .22rem .55rem;
    }

    .sa-metrics-strip {
        grid-template-columns: 1fr;
    }

    .sa-kpi-row.sa-kpi-4,
    .sa-kpi-row.sa-kpi-2 {
        grid-template-columns: 1fr 1fr;
        gap: .85rem;
    }

    .sa-metric-main {
        font-size: 1rem;
    }

    .sa-tbl {
        font-size: .82rem;
    }

        .sa-tbl td {
            padding: .4rem .55rem;
        }

    .sa-filter-panel-group-row {
        grid-template-columns: 1fr;
    }

    .sa-btn {
        width: 100%;
        justify-content: center;
    }

        .sa-btn.sa-btn-sm {
            width: auto;
        }

    .sa-partial-banner {
        flex-direction: column;
        gap: .75rem;
    }

    .sa-partial-banner-icon {
        width: 40px;
        height: 40px;
    }

    .sa-modal {
        padding: 0;
    }

    .sa-modal-dialog {
        max-width: none;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .sa-modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

        .sa-modal-footer .sa-btn,
        .sa-modal-footer .sa-btn.ghost-warn {
            width: 100%;
            justify-content: center;
        }

    .sa-history-summary {
        grid-template-columns: 1fr;
    }

    .sa-history-table {
        font-size: .78rem;
    }

        .sa-history-table thead th,
        .sa-history-table tbody td {
            padding: .4rem .45rem;
        }

    .sa-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .sa-toast {
        max-width: none;
    }
}
