/* Page /gestion/materiaux — compléments à la mise en page commune des listes (body.list-modern,
   list.css) : largeur limitée comme /gestion/stock, indicateurs, pastilles de statut. */
body.mat-page {
    --lm-max: 1200px;
    --lm-color: var(--materiels-color);
}

/* ─ INDICATEURS ─ */
.mat-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.mat-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(38, 50, 56, .12), 0 4px 14px rgba(38, 50, 56, .08);
    text-align: left;
    font: inherit;
}

.mat-kpi-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 24px;
    line-height: 44px;
    text-align: center;
}

.mat-kpi-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    color: #607d8b;
}

.mat-kpi-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    color: #263238;
    font-variant-numeric: tabular-nums;
}

button.mat-kpi,
a.mat-kpi {
    cursor: pointer;
    transition: box-shadow 150ms, transform 150ms;
}

button.mat-kpi:hover,
button.mat-kpi:focus-visible,
a.mat-kpi:hover,
a.mat-kpi:focus-visible {
    background: #fff;
    box-shadow: 0 2px 6px rgba(38, 50, 56, .16), 0 8px 22px rgba(38, 50, 56, .14);
    transform: translateY(-1px);
}

button.mat-kpi:focus {
    background: #fff;
}

.mat-kpi-alert.has-alert .mat-kpi-icon {
    background: #ffebee;
    color: #c62828;
}

.mat-kpi-alert.has-alert .mat-kpi-value {
    color: #c62828;
}

.mat-kpi-alert.active,
.mat-kpi-alert.active:hover {
    box-shadow: 0 0 0 2px #c62828, 0 4px 14px rgba(38, 50, 56, .08);
}

body.mat-page:not(.list-card-view) table#list-elements>tbody>tr>td[field="nom"] {
    min-width: 200px;
    font-weight: 600;
}

body.mat-page:not(.list-card-view) table#list-elements>tbody>tr>td[field="notes"] {
    min-width: 220px;
}

body.mat-page:not(.list-card-view) table#list-elements>tbody>tr>td[field="seuilAlerte"] {
    font-variant-numeric: tabular-nums;
}

/* Statut : pastille de couleur (les deux vues) */
body.mat-page td[field="statut"][value]>ul.collapsible>li>.collapsible-header>.header-text>div {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
}

body.mat-page td[field="statut"][value="en stock"]>ul.collapsible>li>.collapsible-header>.header-text>div {
    background: #e8f5e9;
    color: #2e7d32;
}

body.mat-page td[field="statut"][value="commandé"]>ul.collapsible>li>.collapsible-header>.header-text>div {
    background: #fff3e0;
    color: #e65100;
}

body.mat-page td[field="statut"][value="rupture"]>ul.collapsible>li>.collapsible-header>.header-text>div {
    background: #ffebee;
    color: #c62828;
}

/* Module « Gestion de stock » actif (classe posée par materiaux.js) : pas de statut manuel */
body.mat-stock-module table#list-elements th[field="statut"],
body.mat-stock-module table#list-elements td[field="statut"],
body.mat-stock-module #modal-add-table td[field-name="statut"],
body.mat-stock-module #modal-add-table td[field="statut"],
body.mat-stock-module .card-filter-item:has([field="statut"]),
body.mat-stock-module #mat-kpi-rupture-btn {
    display: none !important;
}

@media (max-width: 600px) {
    .mat-kpis {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .mat-kpi {
        gap: 10px;
        padding: 12px;
    }

    .mat-kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
        line-height: 36px;
    }

    .mat-kpi-value {
        font-size: 20px;
    }
}
