html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.bi-nav-button,
.bi-nav-button:link,
.bi-nav-button:visited {
    min-height: 72px !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 0 20px !important;
    border-radius: 10px !important;
    color: #f8fafc !important;
    background: rgba(255,255,255,.08) !important;
    text-decoration: none !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important;
}

    .bi-nav-button:hover,
    .bi-nav-button.active {
        background: linear-gradient(135deg, #0d6efd 0%, #1e63e9 100%) !important;
        color: white !important;
        text-decoration: none !important;
        box-shadow: 0 10px 26px rgba(13,110,253,.32) !important;
    }

.bi-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.70);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.bi-loader-box {
    background: #fff;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    text-align: center;
}

.bi-loader-text {
    margin-top: 15px;
    font-weight: 600;
    color: #0d6efd;
}

/* =========================================================
   REPORT FILTERS
   Desktop invariato, pannello comprimibile su mobile
   ========================================================= */

.report-filters-panel {
    display: block;
    margin: 0;
    border: 0;
}

.report-filters-summary {
    display: none;
}

.report-filters-content {
    display: block;
}

/* Mobile */
@media (hover: none) and (pointer: coarse) and (max-width: 767px),
       (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {

    .report-filters-panel {
        margin: 0 0 6px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        background: #ffffff;
        overflow: visible;
    }

    .report-filters-summary {
        min-height: 42px;
        padding: 8px 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        cursor: pointer;
        user-select: none;
        list-style: none;
        background: #eef3f8;
        color: #071d2e;
        font-weight: 700;
    }

        .report-filters-summary::after {
            content: "▼";
            flex: 0 0 auto;
            font-size: .75rem;
            transition: transform 150ms ease;
        }

    .report-filters-panel[open] > .report-filters-summary::after {
        transform: rotate(180deg);
    }

    .report-filters-title {
        font-size: .95rem;
    }

    /* Periodo visualizzato: sempre leggibile anche a filtri chiusi. */
    .report-filters-period {
        color: #0d6efd;
        font-size: .85rem;
        font-weight: 700;
        white-space: nowrap;
    }

    /* Se la riga non basta (telefoni molto stretti) gli elementi vanno a
       capo invece di sovrapporsi, e sotto i 380px il suggerimento "Tocca
       per aprire o chiudere" sparisce: la freccia gia' lo dice, e resta
       spazio per titolo e periodo. */
    .report-filters-summary {
        flex-wrap: wrap;
    }

    @media (max-width: 380px) {
        .report-filters-hint {
            display: none;
        }
    }

    .report-filters-hint {
        margin-left: auto;
        color: #64748b;
        font-size: .72rem;
        font-weight: 500;
    }

    .report-filters-content {
        padding: 6px;
    }
}
/* =========================================================
   MOBILE REPORT CONTROLS
   Compattezza dei controlli dentro i pannelli filtri
   ========================================================= */

@media (hover: none) and (pointer: coarse) and (max-width: 767px),
       (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {

    .report-filters-content {
        padding: 5px;
    }

        /*
     * Spazi verticali più contenuti tra i campi.
     */
        .report-filters-content .mb-3 {
            margin-bottom: 6px !important;
        }

        .report-filters-content .row {
            --bs-gutter-x: 6px;
            --bs-gutter-y: 5px;
        }

        /*
     * Etichette compatte.
     */
        .report-filters-content label,
        .report-filters-content .form-label {
            margin-bottom: 2px;
            font-size: .76rem;
            font-weight: 600;
            line-height: 1.15;
        }

        /*
     * Campi HTML standard.
     */
        .report-filters-content .form-control,
        .report-filters-content .form-select {
            min-height: 34px;
            padding: 4px 7px;
            font-size: .82rem;
        }

        /*
     * Controlli Radzen.
     */
        .report-filters-content .rz-inputtext,
        .report-filters-content .rz-dropdown,
        .report-filters-content .rz-multiselect,
        .report-filters-content .rz-calendar-button,
        .report-filters-content .rz-numeric {
            min-height: 34px !important;
            font-size: .82rem !important;
        }

        .report-filters-content .rz-dropdown-label,
        .report-filters-content .rz-multiselect-label {
            min-height: 32px !important;
            padding-top: 6px !important;
            padding-bottom: 5px !important;
            font-size: .82rem !important;
            line-height: 1.1 !important;
        }

        /*
     * Pulsanti dentro il pannello filtri.
     */
        .report-filters-content .btn,
        .report-filters-content .rz-button {
            min-height: 34px !important;
            padding: 5px 9px !important;
            font-size: .8rem !important;
            line-height: 1.1 !important;
        }

        /*
     * Titoli e testi accessori più compatti.
     */
        .report-filters-content h4,
        .report-filters-content h5,
        .report-filters-content h6 {
            margin-bottom: 5px;
            font-size: .95rem;
        }
}
/* =========================================================
   REPORT MATRIX — DESKTOP
   ========================================================= */

.report-matrix-shell {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 8px;
}

.report-matrix-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 10px;
    border: 1px solid #d8dee7;
    border-radius: 7px;
    background: #f8fafc;
}

.report-matrix-toolbar-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.matrix-drill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    font-weight: 700;
    white-space: nowrap;
}

.report-matrix-level-indicator {
    color: #475569;
    font-size: .82rem;
    white-space: nowrap;
}

.report-matrix-container {
    height: calc(100vh - 410px);
    max-width: 100%;
    overflow: auto;
    position: relative;
    background: #ffffff;
}

.report-matrix {
    min-width: 100%;
    margin-bottom: 0;
}

    .report-matrix th,
    .report-matrix td {
        vertical-align: middle;
    }

    .report-matrix thead th {
        position: sticky;
        top: 0;
        z-index: 100;
        padding-top: .70rem;
        padding-bottom: .70rem;
        white-space: nowrap;
        background: #212529 !important;
        color: #ffffff !important;
    }

.matrix-hierarchy-header {
    position: sticky !important;
    top: 0;
    left: 0;
    z-index: 200 !important;
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    background: #212529 !important;
    color: #ffffff !important;
}

.matrix-hierarchy-cell {
    position: sticky;
    left: 0;
    z-index: 120;
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    padding-top: .60rem;
    padding-bottom: .60rem;
    background-color: var(--matrix-row-bg, #ffffff) !important;
    background-clip: padding-box;
    border-right: 2px solid #adb5bd !important;
}

.matrix-hierarchy-content {
    display: flex;
    align-items: center;
    min-width: 0;
}

.matrix-hierarchy-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-expand-button,
.matrix-expand-placeholder {
    width: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    margin-right: .5rem;
}

.matrix-value-header,
.matrix-value-cell {
    width: var(--matrix-column-width);
    min-width: var(--matrix-column-width);
}

.matrix-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 100%;
    min-height: 28px;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: inherit;
    cursor: pointer;
}

    .matrix-sort-button:hover,
    .matrix-sort-button:focus-visible {
        color: #ffffff;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .matrix-sort-button:focus-visible {
        outline: 2px solid #8ec5ff;
        outline-offset: 2px;
        border-radius: 3px;
    }

.matrix-sort-button-hierarchy {
    justify-content: flex-start;
}

.matrix-sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 14px;
    min-width: 14px;
    font-size: .72rem;
    opacity: .9;
}

.matrix-value-cell {
    padding-top: .60rem;
    padding-bottom: .60rem;
    text-align: right;
    white-space: nowrap;
}

.matrix-indent-1 {
    padding-left: 0;
}

.matrix-indent-2 {
    padding-left: 25px;
}

.matrix-indent-3 {
    padding-left: 50px;
}

.matrix-indent-4 {
    padding-left: 75px;
}

.matrix-indent-5 {
    padding-left: 100px;
}

.matrix-indent-6 {
    padding-left: 125px;
}

.matrix-indent-7 {
    padding-left: 150px;
}

.matrix-indent-8 {
    padding-left: 175px;
}

.report-matrix tr {
    --matrix-row-bg: #ffffff;
}

    .report-matrix tr:nth-child(even) {
        --matrix-row-bg: #f2f2f2;
    }

    .report-matrix tr.table-primary {
        --matrix-row-bg: #cfe2ff;
    }

    .report-matrix tr.table-light {
        --matrix-row-bg: #f8f9fa;
    }

    .report-matrix tr.matrix-total-row {
        --matrix-row-bg: #163b65;
    }

.report-matrix .matrix-total-row td {
    background: #163b65 !important;
    color: #ffffff !important;
    font-weight: 700;
    border-color: #163b65 !important;
}

.report-matrix .matrix-total-row .text-success,
.report-matrix .matrix-total-row .text-danger {
    color: #ffffff !important;
}

.report-matrix td.text-success,
.report-matrix td.text-danger {
    font-weight: 700;
}

/* =========================================================
   REPORT MATRIX — MOBILE
   ========================================================= */

@media (hover: none) and (pointer: coarse) and (max-width: 767px),
       (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
    .report-matrix-shell {
        gap: 6px;
    }

    .report-matrix-toolbar {
        align-items: stretch;
        padding: 6px;
        gap: 6px;
    }

    .report-matrix-toolbar-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 6px;
    }

    .matrix-drill-button {
        width: 100%;
        min-height: 38px;
        padding: 6px 8px;
        font-size: .76rem;
        touch-action: manipulation;
    }

    .report-matrix-level-indicator {
        width: 100%;
        font-size: .7rem;
        text-align: center;
        white-space: normal;
    }

    .report-matrix-container {
        width: 100%;
        height: calc(100dvh - 220px);
        min-height: 300px;
        max-width: 100%;
        overflow: auto;
        border-radius: 4px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .report-matrix {
        width: max-content;
        min-width: max-content;
        font-size: .62rem;
        line-height: 1;
    }

        .report-matrix th,
        .report-matrix td {
            height: 25px;
            padding: 2px 3px !important;
        }

    .matrix-hierarchy-header,
    .matrix-hierarchy-cell {
        width: 104px;
        min-width: 104px;
        max-width: 104px;
    }

    .matrix-hierarchy-header {
        padding: 3px !important;
        font-size: .58rem;
        line-height: 1;
        white-space: normal !important;
    }

    .matrix-hierarchy-cell {
        padding: 2px 3px !important;
        font-size: .52rem;
        line-height: 1.05;
    }

    .matrix-hierarchy-content {
        align-items: flex-start;
    }

    .matrix-hierarchy-label {
        display: -webkit-box;
        overflow: hidden;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        line-height: 1.05;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .matrix-indent-1 {
        padding-left: 0;
    }

    .matrix-indent-2 {
        padding-left: 3px;
    }

    .matrix-indent-3 {
        padding-left: 6px;
    }

    .matrix-indent-4 {
        padding-left: 9px;
    }

    .matrix-indent-5 {
        padding-left: 12px;
    }

    .matrix-indent-6 {
        padding-left: 15px;
    }

    .matrix-indent-7 {
        padding-left: 18px;
    }

    .matrix-indent-8 {
        padding-left: 21px;
    }

    .matrix-expand-button,
    .matrix-expand-placeholder {
        width: 22px;
        min-width: 22px;
        height: 22px;
        flex: 0 0 22px;
        margin-right: 3px;
        padding: 0 !important;
        font-size: .68rem;
        line-height: 20px;
        touch-action: manipulation;
    }

    .matrix-value-header {
        width: 66px;
        min-width: 66px;
        max-width: 66px;
        padding: 3px 2px !important;
        font-size: .52rem;
        line-height: 1.05;
        text-align: center;
        white-space: normal !important;
        overflow-wrap: normal;
        word-break: keep-all;
    }

    .matrix-sort-button {
        justify-content: center;
        min-height: 30px;
        gap: 2px;
        white-space: normal;
        touch-action: manipulation;
    }

    .matrix-sort-button-hierarchy {
        justify-content: flex-start;
    }

    .matrix-sort-icon {
        flex-basis: 10px;
        min-width: 10px;
        font-size: .52rem;
    }

    .matrix-value-cell {
        width: 66px;
        min-width: 66px;
        max-width: 66px;
        padding: 2px 3px !important;
        font-size: .56rem;
        line-height: 1;
        text-align: right;
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
    }
}

@media (max-width: 520px) {
    .matrix-hierarchy-header,
    .matrix-hierarchy-cell {
        width: 92px;
        min-width: 92px;
        max-width: 92px;
    }

    .matrix-hierarchy-header {
        font-size: .54rem;
    }

    .matrix-hierarchy-cell {
        font-size: .48rem;
    }

    .matrix-value-header,
    .matrix-value-cell {
        width: 62px;
        min-width: 62px;
        max-width: 62px;
    }

    .matrix-value-header {
        font-size: .48rem;
    }

    .matrix-value-cell {
        font-size: .52rem;
    }

    .matrix-drill-button span {
        display: inline;
    }
}


/* =========================================================
   SMARTPHONE LANDSCAPE (es. iPhone 14 Pro Max 932x430)
   ========================================================= */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 599px) {
    .report-filters-panel {
        overflow: visible;
    }

    .report-filters-summary {
        display: flex;
    }

    .report-filters-content {
        padding: 5px;
    }

    .report-matrix-shell {
        min-height: 0;
    }

    .report-matrix-container {
        height: calc(100dvh - 145px);
        min-height: 150px;
        max-height: none;
        overflow: auto;
    }
}

/* =========================================================
   SMARTPHONE LANDSCAPE — 844x390 / 932x430
   Regole basate sulla risoluzione, non sul modello del telefono.
   ========================================================= */
@media (orientation: landscape) and (max-width: 950px) and (max-height: 600px) {
    .report-filters-panel {
        overflow: visible !important;
        position: relative;
        z-index: 6000;
    }

    .report-filters-summary {
        display: flex !important;
        position: sticky;
        top: 0;
        z-index: 7000;
    }

    .report-filters-content {
        overflow: visible !important;
    }

    .report-matrix-shell {
        min-height: 0 !important;
        position: relative;
        z-index: 1;
    }

    .report-matrix-container {
        width: 100% !important;
        height: calc(100dvh - 150px) !important;
        min-height: 180px !important;
        max-height: none !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Il grafico e' l'ultimo elemento della griglia e riempie le posizioni
   rimaste vuote nell'ultima riga quando Vendite Promo e/o Margine % sono
   nascosti per ruolo. Le colonne sono quelle di auto-fit sopra: n colonne
   quando la larghezza della griglia e' almeno n*460 + (n-1)*22 px, cioe'
   2 colonne da 942px, 3 da 1424px, 4 da 1906px. La classe
   dashboard-chart-pos-N indica quanti riquadri precedono il grafico (3, 4 o 5);
   l'estensione e' il numero di colonne meno il resto di N diviso per le
   colonne (colonne intere se N e' un multiplo). Con una sola colonna (o su
   mobile) il grafico resta di una posizione, impilato come gli altri. */
.dashboard-chart-slot {
    display: flex;
    min-width: 0;
}

.dashboard-chart-slot > .dashboard-trend-chart {
    flex: 1 1 auto;
    min-width: 0;
}

/* 2 colonne */
@container (942px <= width < 1424px) {
    .dashboard-chart-pos-4 {
        grid-column: span 2;
    }
}

/* 3 colonne */
@container (1424px <= width < 1906px) {
    .dashboard-chart-pos-3 {
        grid-column: span 3;
    }

    .dashboard-chart-pos-4 {
        grid-column: span 2;
    }
}

/* 4 colonne */
@container (width >= 1906px) {
    .dashboard-chart-pos-4 {
        grid-column: span 4;
    }

    .dashboard-chart-pos-5 {
        grid-column: span 3;
    }
}

/* Intestazioni lunghe delle colonne di valore (es. "Incidenza Incasso AC"):
   carattere ridotto e testo su due righe bilanciate, cosi' la colonna resta
   della larghezza prevista invece di allargarsi al testo. Solo su desktop con
   mouse: su telefono e tablet le intestazioni sono gia' compatte (regole
   sopra). Abilitato per colonna con MatrixColumn.CompactHeader. */
@media (min-width: 768px) and (hover: hover) {
    .report-matrix thead th.matrix-header-compact {
        font-size: .8rem;
        line-height: 1.15;
        white-space: normal;
        max-width: var(--matrix-column-width);
    }

    .report-matrix thead th.matrix-header-compact .matrix-sort-button {
        white-space: normal;
        text-wrap: balance;
    }
}
