*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f0f2f5;
    --white: #fff;
    --green: #4CAF50;
    --green-hover: #43a047;
    --dark: #2c3e50;
    --dark-light: #34495e;
    --text: #333;
    --text-light: #666;
    --border: #ddd;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    /* layout admin : voir body.admin plus bas */
    --layout-min: 1100px;
    --layout-max: 1600px;
    --layout-pad: 24px;
}

/* === LAYOUT ADMIN ===
   Scopé à body.admin pour ne PAS impacter le front public (cart, login, catalogue mobile).
   Le viewport=1100 (dans _layout_header.php) + min-width 1100 ici garantissent :
   - desktop : layout fluide entre 1100 et 1600px, centré
   - mobile  : navigateur dezoom auto pour afficher la page entière
*/
body.admin { min-width: var(--layout-min); }
body.admin .header-container,
body.admin .main-content,
body.admin main.cmd-page {
    min-width: var(--layout-min);
    max-width: var(--layout-max);
    margin: 0 auto;
    padding-left: var(--layout-pad);
    padding-right: var(--layout-pad);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    /* Fond pastel unifié front + admin (même radial-gradients que .cmd-page) */
    background:
        radial-gradient(circle at 15% 25%, rgba(168,226,253,0.55), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(255,190,220,0.55), transparent 40%),
        radial-gradient(circle at 65% 80%, rgba(210,205,250,0.50), transparent 50%),
        radial-gradient(circle at 10% 85%, rgba(255,225,175,0.50), transparent 45%),
        #f5f6f8;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* HEADER */
.app-header {
    background: var(--dark);
    color: white;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.admin-header { background: #1a252f; }

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    padding: 6px 0;
}
.logo:hover { text-decoration: none; color: white; }

.admin-tag {
    background: var(--green);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,0.1); text-decoration: none; }

.cart-link { position: relative; }
.cart-badge {
    background: var(--green);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: -4px;
}
.cart-badge.bounce {
    animation: badgeBounce 0.4s ease;
}

@keyframes badgeBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* MAIN */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

h1 { color: var(--dark); margin-bottom: 1rem; font-size: 1.5rem; }
h2 { color: var(--dark); margin-bottom: 0.75rem; font-size: 1.2rem; }

/* ALERTS */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--border);
    color: var(--text);
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-hover); color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); color: white; }

.btn-full { width: 100%; justify-content: center; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.btn-qty {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.btn-google {
    background: #4285F4;
    color: white;
    margin-bottom: 0.5rem;
}
.btn-google:hover { background: #357ae8; color: white; }

.btn-apple {
    background: #000;
    color: white;
}
.btn-apple:hover { background: #333; color: white; }

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* SEARCH */
.search-section { margin-bottom: 1.0rem; }

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 0rem 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--green); }

.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.filter-select {
    padding: 0.5rem 0rem 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
    outline: none;
    min-width: 200px;
}
.filter-select:focus { border-color: var(--green); }
.filter-select::-webkit-calendar-picker-indicator { display: none !important; }
.filter-select { -webkit-appearance: none; }

/* Floating label fields (Material-style) */
.float-field { position: relative; flex: 1; min-width: 0; }
.float-field-2x { flex: 0 0 calc(50% - 0.25rem) !important; }

/* Grid 50/50 strict des filtres : col gauche (cat/supplier empilés) | col droite (prix-row + stock) */
.filter-grid {
    display: grid;
    grid-template-columns: 6fr 7fr;
    gap: 0.5rem;
}
.filter-col {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-width: 0;
}
.filter-prices {
    display: flex;
    gap: 0.5rem;
}
.filter-prices > .float-field { flex: 1; min-width: 0; }
.filter-col > #stockToggle { width: 100%; }

/* Hauteur 32px stricte sur les 4 filtres + bouton stock */
#categoryFilter,
#supplierFilter,
#priceMinFilter,
#priceMaxFilter,
#stockToggle {
    height: 32px;
    box-sizing: border-box;
    line-height: 1;
}
#categoryFilter,
#supplierFilter,
#priceMinFilter,
#priceMaxFilter { font-size: 0.8rem; }
.float-field #categoryFilter,
.float-field #supplierFilter,
.float-field #priceMinFilter,
.float-field #priceMaxFilter {
    padding-top: 0.55rem;
    padding-bottom: 0.15rem;
}
#priceMinFilter,
#priceMaxFilter { text-align: center; padding-left: 0.4rem; padding-right: 0.4rem; }
.float-field > label[for="priceMinFilter"],
.float-field > label[for="priceMaxFilter"] {
    left: 50%;
    transform: translate(-50%, -50%);
}
.float-field #priceMinFilter:focus ~ label,
.float-field #priceMinFilter:not(:placeholder-shown) ~ label,
.float-field #priceMaxFilter:focus ~ label,
.float-field #priceMaxFilter:not(:placeholder-shown) ~ label {
    transform: translate(-50%, -50%);
}
#stockToggle { padding: 0 0.5rem; }

/* Texte des labels filtres réduit (~15%) — pas search */
.float-field > label[for="categoryFilter"],
.float-field > label[for="supplierFilter"],
.float-field > label[for="priceMinFilter"],
.float-field > label[for="priceMaxFilter"] { font-size: 0.75rem; }
.float-field #categoryFilter:focus ~ label,
.float-field #categoryFilter:not(:placeholder-shown) ~ label,
.float-field #supplierFilter:focus ~ label,
.float-field #supplierFilter:not(:placeholder-shown) ~ label,
.float-field #priceMinFilter:focus ~ label,
.float-field #priceMinFilter:not(:placeholder-shown) ~ label,
.float-field #priceMaxFilter:focus ~ label,
.float-field #priceMaxFilter:not(:placeholder-shown) ~ label { font-size: 0.58rem; }
.float-field input.search-input,
.float-field input.filter-select {
    width: 100%;
    padding-top: 0.9rem;
    padding-bottom: 0.35rem;
}
.float-field > label {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: #888;
    pointer-events: none;
    padding: 0 0.2rem;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: top 0.15s ease, font-size 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    max-width: calc(100% - 1.2rem);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.3;
}
/* Float-up état (focus ou rempli) : devient un badge */
.float-field input:focus ~ label,
.float-field input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
}
/* Le contour du badge porte toujours la couleur du filtre, focus ou non */
.float-field #searchInput:focus ~ label,
.float-field #searchInput:not(:placeholder-shown) ~ label { border-color: #1976d2; }
.float-field #categoryFilter:focus ~ label,
.float-field #categoryFilter:not(:placeholder-shown) ~ label { border-color: var(--green); }
.float-field #supplierFilter:focus ~ label,
.float-field #supplierFilter:not(:placeholder-shown) ~ label { border-color: #3f51b5; }
.float-field #priceMinFilter:focus ~ label,
.float-field #priceMinFilter:not(:placeholder-shown) ~ label { border-color: #f9a825; }
.float-field #priceMaxFilter:focus ~ label,
.float-field #priceMaxFilter:not(:placeholder-shown) ~ label { border-color: #c62828; }

/* Tints par filtre :
   - bg input pâle
   - label au repos = teinte moyenne (visible "dans" la case)
   - label flottant + texte tapé = teinte foncée
   - label flottant : fond assorti au champ pour fondre avec le contour */

/* Bleu — Nom Produit */
#searchInput { background: #e3f2fd; color: #0d47a1; }
#searchInput:focus,
#searchInput:not(:placeholder-shown) { border-color: #1976d2; }
.float-field #searchInput ~ label { color: #6c7d99; background: #e3f2fd; }
.float-field #searchInput:focus ~ label,
.float-field #searchInput:not(:placeholder-shown) ~ label { color: #0a3270; }

/* Vert — Catégorie */
#categoryFilter { background: #e8faea; color: #1b5e20; }
#categoryFilter:focus,
#categoryFilter:not(:placeholder-shown) { border-color: var(--green); }
.float-field #categoryFilter ~ label { color: #6c8270; background: #e8faea; }
.float-field #categoryFilter:focus ~ label,
.float-field #categoryFilter:not(:placeholder-shown) ~ label { color: #11401a; }

/* Indigo — Fournisseur */
#supplierFilter { background: #e8eaf6; color: #1a237e; }
#supplierFilter:focus,
#supplierFilter:not(:placeholder-shown) { border-color: #3f51b5; }
.float-field #supplierFilter ~ label { color: #6e7595; background: #e8eaf6; }
.float-field #supplierFilter:focus ~ label,
.float-field #supplierFilter:not(:placeholder-shown) ~ label { color: #11185c; }

/* Jaune — Prix Min */
#priceMinFilter { background: #fffef0; color: #e65100; }
#priceMinFilter:focus,
#priceMinFilter:not(:placeholder-shown) { border-color: #f9a825; }
.float-field #priceMinFilter ~ label { color: #8a7762; background: #fffef0; }
.float-field #priceMinFilter:focus ~ label,
.float-field #priceMinFilter:not(:placeholder-shown) ~ label { color: #803300; }

/* Rouge vif — Prix Max */
#priceMaxFilter { background: #ffe0e3; color: #b71c1c; }
#priceMaxFilter:focus,
#priceMaxFilter:not(:placeholder-shown) { border-color: #c62828; }
.float-field #priceMaxFilter ~ label { color: #8a6868; background: #ffe0e3; }
.float-field #priceMaxFilter:focus ~ label,
.float-field #priceMaxFilter:not(:placeholder-shown) ~ label { color: #701414; }

.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* PRODUCTS GRID */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: box-shadow 0.2s;
    position: relative;
}
.product-card:hover { box-shadow: var(--shadow-hover); }

.product-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
    white-space: normal;
    word-break: break-word;
    width: 100%;
}

.product-card-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.product-card-image {
    flex-shrink: 0;
    width: 49px;
    height: 49px;
}
.product-card-image img {
    width: 49px;
    height: 49px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.product-card-info { flex: 1; min-width: 0; }

.product-card-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.product-card-price {
    font-weight: 700;
    color: var(--green);
    font-size: 0.95rem;
}

.product-card-action {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-add-cart {
    background: var(--green);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}
.btn-add-cart:hover { background: var(--green-hover); transform: scale(1.1); }
.btn-add-cart.added {
    animation: addPulse 0.3s ease;
}

@keyframes addPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); background: #2e7d32; }
    100% { transform: scale(1); }
}

.img-placeholder, .img-placeholder-sm {
    width: 49px;
    height: 49px;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 1.2rem;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.page-btn:hover { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); color: white; border-color: var(--green); }

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 1rem;
}

/* AUTH */
.auth-card {
    max-width: 480px;
    margin: 2rem auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}
.auth-card h1 { text-align: center; margin-bottom: 1.5rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--dark); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-input {
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-input:focus { border-color: var(--green); }

textarea.form-input { resize: vertical; }

.auth-divider {
    text-align: center;
    margin: 1.25rem 0;
    position: relative;
    color: var(--text-light);
    font-size: 0.85rem;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}
.auth-divider span { background: var(--white); padding: 0 1rem; position: relative; }

.social-login { display: flex; flex-direction: column; gap: 0.5rem; }

.auth-link { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; }

/* ACCOUNT / CARDS */
.account-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.account-info p { margin-bottom: 0.5rem; font-size: 0.95rem; }

.empty-message { color: var(--text-light); font-style: italic; padding: 1rem 0; }

.danger-zone { border: 2px solid var(--danger); }
.danger-zone h2 { color: var(--danger); }

/* TABLE */
.table-responsive { overflow-x: auto; max-width: 100%; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    word-break: break-word;            /* empêche l'expansion infinie par contenu long (refs, urls) */
}
.data-table th { background: #f8f9fa; font-weight: 600; color: var(--dark); white-space: nowrap; }
.data-table tr:hover td { background: #f8f9fa; }
.data-table tfoot td { background: #f8f9fa; font-weight: 600; }
.data-table td.cell-nowrap { white-space: nowrap; }       /* opt-in */
.data-table.is-fixed { table-layout: fixed; }             /* opt-in : largeur de colonnes figée */

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* CART */
.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}
.empty-cart i { margin-bottom: 1rem; color: #ccc; }
.empty-cart p { margin-bottom: 1rem; font-size: 1.1rem; }

.cart-items { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }

.cart-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.cart-item-image { flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: 0.9rem; }
.cart-item-ref { font-size: 0.8rem; color: var(--text-light); }
.cart-item-price { font-weight: 600; color: var(--green); font-size: 0.9rem; }
.cart-item-qty-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; flex-shrink: 0; }
.cart-item-qty { display: flex; align-items: center; gap: 0.5rem; }
.qty-value { font-weight: 700; min-width: 24px; text-align: center; }
.cart-item-subtotal { font-weight: 700; font-size: 0.95rem; white-space: nowrap; }

.cart-item-over { border-left: 3px solid var(--danger); }
.qty-value-over { color: var(--danger); font-weight: 800; }

.cart-footer { margin-top: 1rem; }
.cart-total {
    text-align: right;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 0.8rem; color: var(--text-light); margin-top: 0.25rem; }

/* DETAIL */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.quote-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.back-link:hover { color: var(--green); }

/* RESPONSIVE */
@media (max-width: 768px) {
    .header-container { padding: 0; }
    .nav-link span, .nav-link-text { display: none; }
    .nav-link { padding: 0.4rem; }

    .products-grid { grid-template-columns: 1fr; }
    .product-card-body { gap: 0.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .cart-item { flex-wrap: wrap; }
    .cart-item-subtotal { width: 100%; text-align: right; }

    .filter-select { min-width: 100%; }

    h1 { font-size: 1.25rem; }
    .auth-card { margin: 1rem; padding: 1.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .product-card { padding: 0.75rem; gap: 0.5rem; }
}

/* BRAND / MANUFACTURER */
.product-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.product-card-brand {
    display: inline-flex;
    align-self: flex-start;
    width: fit-content;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    color: #3f51b5;
    background: #e8eaf6;
    padding: 0.12rem 0.4rem;
    border-radius: 12px;
    margin: 0.2rem 0;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}
.product-card-brand:hover {
    background: #3f51b5;
    color: white;
    text-decoration: none;
}
.product-card-brand i { font-size: 0.6rem; }

input[type=number].filter-select::-webkit-inner-spin-button,
input[type=number].filter-select::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number].filter-select { -moz-appearance: textfield; appearance: textfield; }

.brand-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 2px;
}

/* CATEGORY TAG */
.product-card-category {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    color: var(--green);
    background: #e8f5e9;
    padding: 0.12rem 0.4rem;
    border-radius: 12px;
    margin: 0.2rem 0;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.product-card-category:hover {
    background: var(--green);
    color: white;
    text-decoration: none;
}

.product-card-category i {
    font-size: 0.6rem;
}

/* Qty controls on product cards */
.qty-control { display:flex; align-items:center; gap:0; border-radius:8px; overflow:visible; border:2px solid #3498db; position:relative; }
.qty-control .btn-qty-minus, .qty-control .btn-qty-plus {
    width:32px; height:32px; border:none; cursor:pointer; font-size:13px;
    display:flex; align-items:center; justify-content:center; transition:background .15s;
}
.qty-control .btn-qty-minus { background:#f5f5f5; color:#e74c3c; border-radius:6px 0 0 6px; }
.qty-control .btn-qty-minus:hover { background:#fce4e4; }
.qty-control .btn-qty-plus { background:#3498db; color:#fff; border-radius:0 6px 6px 0; }
.qty-control .btn-qty-plus:hover { background:#2980b9; }
.qty-control .qty-count {
    min-width:28px; text-align:center; font-weight:700; font-size:14px;
    color:#3498db; background:#fff; padding:0 4px; line-height:32px;
}

/* POS / DETAILS display */
.product-card-pos {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--dark);
    line-height: 1.3;
}
.product-card-details {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.3;
    margin-top: 1px;
}

/* REF / EAN on separate lines */
.product-meta-line {
    font-size: 0.73rem;
    color: var(--text-light);
    line-height: 1.4;
}

.logo-main {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: white;
}
.logo-sub {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
}

/* Clear button inside inputs */
.input-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 50%;
    transition: all 0.15s;
}
.input-clear-btn:hover { color: var(--danger); background: rgba(231,76,60,.1); }

/* Right column: action + category */
.product-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.3rem;
    flex-shrink: 0;
    align-self: stretch;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    padding: 5px 5px 5px 0;
}
.product-card-right .product-card-category {
    margin: 0;
    font-size: 0.55rem;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-card-price { white-space: nowrap; flex-shrink: 0; }

/* Attr badge inline with title */
.attr-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    margin-top: 0;
}

/* Stock toggle button */
.btn-stock {
    background: #e0e0e0;
    color: var(--text-light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    overflow: hidden;
}
.btn-stock.active {
    background: var(--green);
    color: white;
    border-color: var(--green);
}
.btn-stock:hover { filter: brightness(0.92); }

/* Stock badge on product */
.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    white-space: nowrap;
}
.stock-ok { background: #e8f5e9; color: #2e7d32; }
.stock-out { background: #fbe9e7; color: #c62828; }

/* Qty over-stock warning */
.qty-control.qty-over {
    border-color: var(--danger);
    position: relative;
}
.qty-control.qty-over .qty-count {
    color: var(--danger);
    font-weight: 800;
}
.qty-tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    animation: tooltipFade 0.3s ease;
    z-index: 10;
}
.qty-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--danger);
}
@keyframes tooltipFade {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Product modal */
.product-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}
.product-modal-container {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    width: 500px;
    max-width: 95vw;
    height: 88vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
.product-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: var(--dark);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.product-modal-header .btn-close {
    font-size: 1.4rem;
    padding: 0 0.3rem;
}
.product-modal-body {
    flex: 1;
    overflow: hidden;
}
.product-modal-iframe-wrap {
    width: 100%;
    height: 100%;
}
.product-modal-iframe {
    width: 700px;
    height: 100%;
    border: none;
    transform-origin: top left;
}

/* Product name/image links */
.product-name-link {
    color: var(--dark);
    text-decoration: none;
    cursor: pointer;
}
.product-name-link:hover { color: var(--green); text-decoration: none; }
.product-img-link { display: block; cursor: pointer; }

/* Quote validation warning */
.quote-warning {
    background: #fff3e0;
    border: 1px solid #ffcc02;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #e65100;
}
.quote-warning i { margin-right: 0.3rem; }

.quote-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.quote-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    border: 2px solid transparent;
}
.quote-option:hover { background: #f5f5f5; }
.quote-option.selected { border-color: var(--green); background: #f0faf0; }
.quote-option input[type="radio"] { margin-top: 3px; accent-color: var(--green); }
.quote-option-label { flex: 1; min-width: 0; }
.quote-option-title { font-weight: 600; font-size: 0.9rem; line-height: 1.3; overflow: hidden; }
.quote-option-desc { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; line-height: 1.3; overflow: hidden; }

.reservation-duration {
    display: none;
    margin-top: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: #f5f5f5;
    border-radius: var(--radius);
}
.reservation-duration.visible { display: block; }
.duration-options {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.duration-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.duration-btn:hover { border-color: var(--green); }
.duration-btn.selected { border-color: var(--green); background: #f0faf0; font-weight: 600; }
.duration-date { font-size: 0.65rem; color: var(--text-light); }

/* Filter row half-half */
.filter-row-half {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    margin-bottom: 0.5rem;
}
@media (max-width: 480px) {
    .filter-row-half { flex-wrap: nowrap; }
    .filter-row-half > * { flex: 1 !important; min-width: 0 !important; }
}

/* Squeeze text system */
.squeeze {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    vertical-align: middle;
}

/* Cart qty tooltip (static, for cart-view) */
.cart-qty-over-wrap {
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
}
.qty-tooltip-static {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.65rem;
    color: var(--danger);
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
}

/* Cart badge always visible on mobile */
@media (max-width: 768px) {
    .cart-link {
        position: relative;
        padding: 0.5rem !important;
    }
    .cart-badge {
        display: flex !important;
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
        top: 2px;
        right: -2px;
    }
    .cart-link i { font-size: 1.1rem; }
}

/* Color dot for attribute combinations */
.color-dot {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    vertical-align: middle;
    margin-left: 4px;
    position: absolute;
    margin-top: -4px;
}
.color-dot[style*="background-color:#ffffff"],
.color-dot[style*="background-color: #ffffff"] {
    border-color: #bbb;
}
.color-dot.color-texture {
    background-size: cover;
    background-position: center;
}

/* =============================================
   MODULE COMMANDES (admin/commandes.php) — v2
   ============================================= */

/* Layout : flow naturel, page scroll. Le tableau a une hauteur mini ~90vh */
.cmd-page {
    padding: 0.85rem 1.1rem 0 1.1rem;
    min-height: calc(100vh - 56px);
    box-sizing: border-box;
    background:
        radial-gradient(circle at 15% 25%, rgba(168,226,253,0.55), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(255,190,220,0.55), transparent 40%),
        radial-gradient(circle at 65% 80%, rgba(210,205,250,0.50), transparent 50%),
        radial-gradient(circle at 10% 85%, rgba(255,225,175,0.50), transparent 45%),
        #f5f6f8;
    background-attachment: fixed;
}
.cmd-page > .cmd-stats       { margin-bottom: 0.6rem; }
.cmd-page > .cmd-toolbar     { margin-bottom: 0.6rem; }

/* Le tableau = ~90% de l'écran. Quand tu scrolles la page, les stats/toolbar */
/* sortent du champ et le tableau s'étale sur presque tout le viewport. */
.cmd-page > .cmd-table-wrap {
    height: 85vh;
    margin: 0;
}

/* Stats compactes */
.cmd-stats { gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cmd-stat-card { padding: 0.55rem 0.75rem; }
.cmd-stat-value { font-size: 1.15rem; margin-top: 0.1rem; }
.cmd-stat-label { font-size: 0.65rem; }
.cmd-stat-sub   { display: none; }

/* STATS STRIP */
.cmd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.cmd-stat-card {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    border: 1.5px solid rgba(255,255,255,0.85);
    box-shadow: 0 6px 20px rgba(31,38,135,0.10);
    transition: transform .15s, box-shadow .15s, filter .15s;
    text-align: center;
}
.cmd-stat-card:hover { transform: translateY(-1px); filter: brightness(1.03); box-shadow: 0 8px 26px rgba(31,38,135,0.15); }
.cmd-stat-label { font-size: 0.7rem; text-transform: uppercase; color: #8a93a0; font-weight: 600; letter-spacing: 0.05em; }
.cmd-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.cmd-stat-sub   { font-size: 0.75rem; color: #8a93a0; margin-top: 0.15rem; }
.cmd-stat-card.accent-blue   .cmd-stat-value { color: #2980b9; }
.cmd-stat-card.accent-green  .cmd-stat-value { color: #27ae60; }
.cmd-stat-card.accent-orange .cmd-stat-value { color: #e67e22; }
.cmd-stat-card.accent-purple .cmd-stat-value { color: #8e44ad; }

/* TOOLBAR sectionnée — glassmorphism */
.cmd-toolbar {
    position: relative;
    z-index: 50;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 8px 28px rgba(31,38,135,0.1);
}
.cmd-zone {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.25rem;
}
.cmd-zone + .cmd-zone { border-left: 1px solid rgba(0,0,0,0.08); padding-left: 0.75rem; }
.cmd-zone-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #8a93a0;
    font-weight: 700;
    margin-right: 0.25rem;
    letter-spacing: 0.05em;
}

/* TYPEAHEAD fournisseur */
.cmd-typeahead { position: relative; min-width: 240px; }
.cmd-typeahead input {
    width: 100%;
    padding: 0.55rem 2rem 0.55rem 0.85rem;
    border: 1.5px solid rgba(255,255,255,0.8);
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(31,38,135,0.08);
    transition: background .15s, box-shadow .15s;
}
.cmd-typeahead input:focus { outline: none; background: rgba(255,255,255,0.85); box-shadow: 0 0 0 3px rgba(76,175,80,.18), 0 4px 12px rgba(76,175,80,.15); }
.cmd-typeahead::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8a93a0;
    pointer-events: none;
    font-size: 0.75rem;
    transition: opacity 0.15s;
}
.cmd-typeahead.has-value::after { opacity: 0; }
.cmd-typeahead .ta-clear {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.08);
    color: #4a5260;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.12s;
}
.cmd-typeahead .ta-clear:hover {
    background: rgba(231,76,60,0.7);
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}
.cmd-typeahead .ta-clear[hidden] { display: none !important; }
.cmd-typeahead.has-value input { padding-right: 2.2rem; }
.cmd-typeahead .ta-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(31,38,135,0.22);
    z-index: 2000;
}
.cmd-typeahead.open .ta-dropdown { display: block; }
.cmd-typeahead .ta-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f3f5;
}
.cmd-typeahead .ta-item:last-child { border-bottom: none; }
.cmd-typeahead .ta-item:hover, .cmd-typeahead .ta-item.active { background: #eaf7ec; }
.cmd-typeahead .ta-item .count { color: #8a93a0; font-size: 0.75rem; }

/* Preset pills — glass */
.cmd-presets {
    display: inline-flex;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3px;
    border-radius: 11px;
    gap: 2px;
    border: 1.5px solid rgba(255,255,255,0.75);
}
.cmd-preset-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #4a5260;
    font-weight: 700;
    transition: all .15s;
}
.cmd-preset-btn:hover { color: var(--dark); background: rgba(255,255,255,0.4); }
.cmd-preset-btn.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.7));
    color: var(--dark);
    box-shadow: 0 2px 6px rgba(31,38,135,0.15);
}

/* Bouton générique toolbar — glassmorphism */
.cmd-btn {
    padding: 0.55rem 0.9rem;
    border: 1.5px solid rgba(255,255,255,0.8);
    border-radius: 11px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    color: var(--dark);
    transition: transform .12s, box-shadow .15s, filter .15s;
    box-shadow: 0 3px 10px rgba(31,38,135,0.10);
}
.cmd-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(31,38,135,0.16); }
.cmd-btn:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(31,38,135,0.10); }
.cmd-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.cmd-btn.primary   { background: linear-gradient(135deg, rgba(145,230,165,0.6), rgba(76,175,80,0.45)); color: #0d3a15; border-color: rgba(255,255,255,0.8); }
.cmd-btn.info      { background: linear-gradient(135deg, rgba(130,190,240,0.6), rgba(52,152,219,0.45)); color: #0a2a42; border-color: rgba(255,255,255,0.8); }
.cmd-btn.warning   { background: linear-gradient(135deg, rgba(250,200,130,0.6), rgba(243,156,18,0.45)); color: #4a2d05; border-color: rgba(255,255,255,0.8); }
.cmd-btn.purple    { background: linear-gradient(135deg, rgba(210,170,240,0.6), rgba(142,68,173,0.45)); color: #2b0a3c; border-color: rgba(255,255,255,0.8); }
.cmd-btn.danger    { background: linear-gradient(135deg, rgba(245,150,150,0.6), rgba(231,76,60,0.45)); color: #4a0d0d; border-color: rgba(255,255,255,0.8); }
.cmd-btn.ghost     { background: rgba(255,255,255,0.3); }
.cmd-btn.icon-only { padding: 0.5rem 0.65rem; }
.cmd-btn.archive   {
    background: linear-gradient(135deg, rgba(90,78,60,0.85), rgba(60,50,38,0.75));
    color: #f5e9c5;
    border-color: rgba(220,180,110,0.4);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 800;
}
.cmd-btn.archive:hover { filter: brightness(1.15); }
.cmd-btn.archive i     { color: #e8c68a; }

/* .btn variant pour pages customer-facing-style (arrivages.php) */
.btn.btn-archive {
    background: linear-gradient(135deg, rgba(90,78,60,0.95), rgba(60,50,38,0.85));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f5e9c5;
    border: 1.5px solid rgba(220,180,110,0.4);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    transition: filter .15s, transform .12s;
}
.btn.btn-archive:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn.btn-archive i     { color: #e8c68a; margin-right: 5px; }

/* Switch L1-L9 */
.cmd-switch { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; cursor: pointer; color: var(--dark); }
.cmd-switch input { display: none; }
.cmd-switch .track {
    position: relative;
    width: 36px;
    height: 20px;
    background: #dee2e6;
    border-radius: 12px;
    transition: background .2s;
}
.cmd-switch .track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .2s;
}
.cmd-switch input:checked + .track { background: var(--green); }
.cmd-switch input:checked + .track::after { transform: translateX(16px); }

/* Slots dropdown */
.cmd-slots { position: relative; }
.cmd-slots-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    padding: 0.4rem;
    min-width: 200px;
    z-index: 100;
}
.cmd-slots.open .cmd-slots-menu { display: block; }
.cmd-slot-row {
    display: flex;
    gap: 4px;
    padding: 4px 0;
    align-items: center;
}
.cmd-slot-row strong { width: 60px; font-size: 0.8rem; }
.cmd-slot-row button { flex: 1; font-size: 0.75rem; padding: 4px 6px; }

/* TOTAL badge — glass dark */
.cmd-total-badge {
    padding: 0.55rem 1rem;
    background: linear-gradient(135deg, rgba(44,62,80,0.9), rgba(52,73,94,0.75));
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.25);
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    transition: filter .15s, transform .12s;
}
.cmd-total-badge:hover { filter: brightness(1.10); transform: translateY(-1px); }
.cmd-total-badge .refresh-icn { opacity: 0.5; font-size: 0.7rem; }

/* Panel colonnes avancé (caché par défaut) */
.cmd-col-panel {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.75rem;
    display: none;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.82rem;
}
.cmd-col-panel.open { display: flex; }
.cmd-col-panel label { display: inline-flex; align-items: center; gap: 0.25rem; cursor: pointer; user-select: none; }

/* TABLEAU : scroll interne (X + Y) — une seule scroll visible, thead sticky */
.cmd-table-wrap {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    overflow: auto;
    position: relative;
    cursor: grab;
    user-select: text;
}
.cmd-table-wrap.dragging { cursor: grabbing; user-select: none; }
.cmd-table-wrap.dragging * { cursor: grabbing !important; }
.cmd-table thead th { cursor: pointer; }
.cmd-table input.cell-input { cursor: text; }
.cmd-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}
.cmd-table thead th {
    background: #f8f9fa;
    padding: 0.55rem 0.6rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #e6e8ec;
    color: #6b7280;
    position: sticky;
    top: 0;
    z-index: 5;
}
.cmd-table thead th:hover { background: #eef0f3; color: var(--dark); }
.cmd-table thead th.sorted-asc,
.cmd-table thead th.sorted-desc { color: var(--dark); background: #eef0f3; }
.cmd-table thead th.sorted-asc::after  { content: ' \2191'; }
.cmd-table thead th.sorted-desc::after { content: ' \2193'; }

/* Ligne de filtres intégrée au thead, sous les entêtes */
.cmd-table thead tr.cmd-filter-row th {
    position: sticky;
    top: 34px;
    z-index: 4;
    background: #fff;
    padding: 4px 6px;
    cursor: default;
    border-bottom: 1px solid #e6e8ec;
    text-transform: none;
    letter-spacing: 0;
}
.cmd-table thead tr.cmd-filter-row th:hover { background: #fff; }
.cmd-table thead tr.cmd-filter-row th.filter-cell input {
    width: 100%;
    box-sizing: border-box;
    padding: 3px 6px;
    font-size: 0.78rem;
    border: 1px solid #e6e8ec;
    border-radius: 5px;
    font-weight: 400;
    color: var(--text);
    background: #fff;
}
.cmd-table thead tr.cmd-filter-row th.filter-cell input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(76,175,80,.12);
}

.cmd-table tbody td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #f1f3f5;
    white-space: nowrap;
    vertical-align: middle;
}
.cmd-table tbody tr:nth-child(even):not(:hover):not(.dirty) { background: #fafbfc; }
.cmd-table tbody tr:hover { background: #f7fbff; }
.cmd-table tbody tr.dirty { background: #fffbea; }

/* Cellules colorées */
.cmd-table td.cell-num  { text-align: right; font-variant-numeric: tabular-nums; }
.cmd-table td.cell-cmd  { background: rgba(52, 152, 219, 0.08); }
.cmd-table td.cell-auto { background: rgba(142, 68, 173, 0.08); }
.cmd-table td.cell-calc { background: rgba(230, 126, 34, 0.12); font-weight: 600; }
.cmd-table tbody tr:hover td.cell-cmd  { background: rgba(52, 152, 219, 0.15); }
.cmd-table tbody tr:hover td.cell-auto { background: rgba(142, 68, 173, 0.15); }
.cmd-table tbody tr:hover td.cell-calc { background: rgba(230, 126, 34, 0.2); }

/* Drag & drop réordonnancement colonnes */
.cmd-table thead th { cursor: pointer; user-select: none; position: sticky; }
.cmd-table thead th.col-dragging { opacity: 0.4; }
.cmd-table thead th.col-drop-target {
    box-shadow: inset 3px 0 0 #2563eb;
    background: rgba(37,99,235,0.12) !important;
}

/* Alignement à droite des headers de colonnes numériques (match cell-num) */
.cmd-table thead th.th-num { text-align: right; padding-right: 1.1rem; }
.cmd-table thead th.th-num.sorted-asc::after,
.cmd-table thead th.th-num.sorted-desc::after { margin-left: 2px; }

/* Poignée de resize colonnes */
.cmd-table thead th .col-resize {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 6;
}
.cmd-table thead th .col-resize:hover,
.cmd-table thead th .col-resize:active {
    background: rgba(37, 99, 235, 0.35);
}
body.grid-col-resizing,
body.grid-col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* Menu contextuel header (clic-droit) */
.grid-header-menu {
    position: absolute;
    z-index: 2500;
    min-width: 220px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(31,38,135,0.22);
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: gm-pop .12s ease-out;
}
@keyframes gm-pop { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.grid-header-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 0.85rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.12s;
}
.grid-header-menu button:hover { background: rgba(37,99,235,0.10); }
.grid-header-menu button[disabled] { opacity: 0.4; cursor: not-allowed; }
.grid-header-menu button i { width: 14px; text-align: center; opacity: 0.7; }

/* Bouton save/reset view compact */
.cmd-view-tools { display: inline-flex; gap: 4px; margin-left: 6px; }
.cmd-view-tools .cmd-btn { padding: 0.45rem 0.6rem; font-size: 0.75rem; }
.cmd-view-tools .cmd-btn.saved { background: linear-gradient(135deg, rgba(145,230,165,0.75), rgba(76,175,80,0.6)); }
.cmd-view-tools .cmd-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Cellule LOCAL à 2 lignes : POS (fort) + DETAILS (léger) */
.cmd-table td .nom-cell {
    line-height: 1.25;
    padding: 2px 0;
}
.cmd-table td .nom-pos {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cmd-table td .nom-det {
    font-size: 0.76rem;
    color: #6a7380;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* Toggle ACTIF (col ✓) */
.cmd-table td .actif-toggle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.7);
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: filter .12s, transform .1s, box-shadow .15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.cmd-table td .actif-toggle.on {
    background: linear-gradient(135deg, rgba(145,230,165,0.85), rgba(76,175,80,0.7));
    color: #0a3a14;
}
.cmd-table td .actif-toggle.off {
    background: linear-gradient(135deg, rgba(240,180,180,0.85), rgba(190,80,80,0.7));
    color: #4a0a0a;
}
.cmd-table td .actif-toggle:hover { filter: brightness(1.1); transform: scale(1.08); }
.cmd-table td .actif-toggle:disabled { opacity: 0.4; cursor: wait; }

/* Ligne inactive : grisée + italique */
.cmd-table tbody tr.row-inactif td { opacity: 0.55; font-style: italic; }
.cmd-table tbody tr.row-inactif td .actif-toggle { opacity: 1; font-style: normal; }
.cmd-table tbody tr.row-inactif:hover td { opacity: 0.85; }

/* Heatmap columns — intensité via --heat (0..1) set par datagrid.js */
.cmd-table td.cell-heat { --heat: 0; position: relative; }
.cmd-table td.cell-heat.heat-green  {
    background: rgba(39, 174, 96, calc(var(--heat) * 0.55));
    color: #0a3a14;
}
.cmd-table td.cell-heat.heat-blue   { background: rgba(52, 152, 219, calc(var(--heat) * 0.55));  color: #0a2a42; }
.cmd-table td.cell-heat.heat-orange { background: rgba(230, 126, 34, calc(var(--heat) * 0.55)); color: #4a2500; }
.cmd-table td.cell-heat.heat-red    { background: rgba(231, 76, 60, calc(var(--heat) * 0.55));  color: #4a0a0a; }
.cmd-table td.cell-heat.heat-purple { background: rgba(142, 68, 173, calc(var(--heat) * 0.55)); color: #2b0a3c; }
/* Font weight plus marqué quand valeur élevée (heat > 0.25 → bold) */
.cmd-table td.cell-heat[style*="--heat: 0.3"],
.cmd-table td.cell-heat[style*="--heat: 0.4"],
.cmd-table td.cell-heat[style*="--heat: 0.5"],
.cmd-table td.cell-heat[style*="--heat: 0.6"],
.cmd-table td.cell-heat[style*="--heat: 0.7"],
.cmd-table td.cell-heat[style*="--heat: 0.8"],
.cmd-table td.cell-heat[style*="--heat: 0.9"],
.cmd-table td.cell-heat[style*="--heat: 1"] { font-weight: 700; }
.cmd-table tbody tr:hover td.cell-heat { filter: brightness(1.08); }

.cmd-table input.cell-input {
    width: 70px;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    text-align: right;
    border-radius: 5px;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}
.cmd-table input.cell-input::-webkit-outer-spin-button,
.cmd-table input.cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cmd-table input.cell-input:hover  { border-color: #dee2e6; }
.cmd-table input.cell-input:focus  { border-color: #3498db; background: #fff; outline: none; box-shadow: 0 0 0 2px rgba(52,152,219,.15); }
.cmd-table input.cell-input.saving { background: #fff9db; }
.cmd-table input.cell-input.saved  { background: #d3f9d8; }
.cmd-table input.cell-input.error  { background: #ffe3e3; }

/* Pagination */
.cmd-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.50rem 0;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.cmd-pagination .info { color: #6b7280; margin-right: 1rem; font-size: 0.8rem; }
.cmd-pagination button {
    padding: 0.35rem 0.65rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    min-width: 32px;
}
.cmd-pagination button:hover:not(:disabled) { background: #f8f9fa; }
.cmd-pagination button.active { background: var(--green); color: #fff; border-color: var(--green); }
.cmd-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.cmd-pagination select {
    margin-left: 0.5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.8rem;
    background: #fff;
}

/* Skeleton loader */
.cmd-skeleton-row td { padding: 0.6rem 0.6rem; }
.cmd-skeleton-bar {
    height: 12px;
    background: linear-gradient(90deg, #eee, #f6f6f6, #eee);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: cmd-skel 1.2s infinite;
}
@keyframes cmd-skel {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.cmd-empty-msg { text-align: center; padding: 3rem 2rem; color: #6b7280; font-size: 1rem; }
.cmd-empty-msg i { font-size: 2.5rem; color: #dee2e6; display: block; margin-bottom: 0.75rem; }

/* Modals */
.cmd-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: cmd-fade .15s;
}
@keyframes cmd-fade { from { opacity: 0; } to { opacity: 1; } }
.cmd-modal-backdrop.open { display: flex; }
.cmd-modal {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(31,38,135,0.25);
    animation: cmd-pop .18s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes cmd-pop { from { transform: scale(.92); opacity: 0;} to { transform: scale(1); opacity: 1; } }
.cmd-modal h3 { margin-bottom: 1rem; color: var(--dark); font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.cmd-modal .cmd-form-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.cmd-modal .cmd-form-row label { font-weight: 600; font-size: 0.85rem; min-width: 110px; color: var(--text); }
.cmd-modal input, .cmd-modal select {
    padding: 0.55rem 0.75rem;
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 10px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: inherit;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: background .15s, box-shadow .15s;
}
.cmd-modal input:focus, .cmd-modal select:focus {
    outline: none;
    background: rgba(255,255,255,0.9);
    box-shadow: inset 0 0 0 2px rgba(76,175,80,0.6), 0 2px 10px rgba(76,175,80,0.18);
}
.cmd-modal label { color: #1a1a1a; font-weight: 700; }
.cmd-modal input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: #4caf50;
    box-shadow: none;
    padding: 0;
    margin-right: 6px;
    vertical-align: middle;
}
.cmd-modal input[type="file"] {
    padding: 0.3rem;
    background: rgba(255,255,255,0.5);
}

/* =========================================================================
   Modal Auto-Cmd refondue — Seuils / Simulation / Transférer
   ========================================================================= */
.auto-modal .auto-filter-note {
    font-size: 0.8rem;
    color: #4a5260;
    margin-bottom: 0.8rem;
    padding: 0.45rem 0.7rem;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    border-left: 3px solid rgba(52,152,219,0.6);
}
.auto-modal .auto-filter-note b { color: #1a1a1a; }

/* Sub-tabs */
.auto-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 5px;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255,255,255,0.75);
    border-radius: 12px;
    margin-bottom: 1rem;
}
.auto-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0.7rem 0.6rem 0.55rem;
    background: transparent;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    color: #4a5260;
    font-weight: 700;
    font-size: 0.82rem;
    transition: background .15s, color .15s, transform .12s;
}
.auto-tab i { font-size: 1rem; margin-bottom: 2px; opacity: 0.8; }
.auto-tab small { font-size: 0.62rem; opacity: 0.65; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.auto-tab:hover { background: rgba(255,255,255,0.5); color: #1a1a1a; }
.auto-tab.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.7));
    color: #1a1a1a;
    box-shadow: 0 3px 10px rgba(31,38,135,0.15);
}
.auto-tab.active i { opacity: 1; }

/* Panes */
.auto-pane { display: none; }
.auto-pane.active { display: block; animation: auto-fade-in .18s; }
@keyframes auto-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Help box */
.auto-help {
    background: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
}
.auto-help p { margin: 0.3rem 0; }
.auto-help code {
    background: rgba(0,0,0,0.06);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'SF Mono', Consolas, monospace;
}
.auto-help-grid { display: flex; flex-direction: column; gap: 0.45rem; }
.auto-help-grid > div { display: flex; align-items: center; gap: 0.6rem; }
.auto-help-grid .col-desc { font-size: 0.82rem; color: #2a3340; line-height: 1.4; }
.auto-help-grid code { background: rgba(0,0,0,0.06); padding: 0 4px; border-radius: 3px; font-size: 0.82em; }

.auto-fake-note {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.7rem;
    padding: 0.55rem 0.75rem;
    background: rgba(250,220,130,0.35);
    border: 1px solid rgba(230,180,60,0.5);
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
}
.auto-fake-note i { color: #9c6b00; font-size: 0.95rem; padding-top: 2px; }
.auto-fake-note code { background: rgba(0,0,0,0.08); padding: 0 4px; border-radius: 3px; }

.auto-formula {
    margin-top: 0.4rem !important;
    padding: 0.5rem 0.7rem;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.84rem;
}
.auto-formula small { font-family: inherit; color: #666; margin-left: 0.6rem; }
.auto-note { font-size: 0.82rem; color: #4a5260; margin-top: 0.5rem !important; }
.auto-note.danger {
    color: #b02020;
    background: rgba(231,76,60,0.12);
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    border-left: 3px solid rgba(231,76,60,0.6);
}

/* Col chips */
.col-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    min-width: 90px;
    text-align: center;
    font-family: inherit;
    border: 1px solid rgba(255,255,255,0.6);
}
.col-chip.c-bou   { background: linear-gradient(135deg, rgba(245,150,150,0.7), rgba(231,76,60,0.55));  color: #400; }
.col-chip.c-stock { background: linear-gradient(135deg, rgba(250,200,130,0.7), rgba(243,156,18,0.55)); color: #3d2500; }
.col-chip.c-cmd   { background: linear-gradient(135deg, rgba(145,230,165,0.75), rgba(76,175,80,0.55)); color: #0a3a14; }

/* Sections */
.auto-section {
    margin-bottom: 0.9rem;
    padding: 0.75rem 0.9rem;
    background: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 12px;
}
.auto-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #4a5260;
    letter-spacing: 0.06em;
    margin-bottom: 0.55rem;
}
.auto-radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.auto-radio-group > label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255,255,255,0.55);
    border: 1.5px solid rgba(255,255,255,0.7);
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.auto-radio-group > label:hover { background: rgba(255,255,255,0.8); }
.auto-radio-group > label:has(input:checked) {
    background: linear-gradient(135deg, rgba(130,190,240,0.25), rgba(52,152,219,0.12));
    border-color: rgba(52,152,219,0.55);
    box-shadow: 0 2px 8px rgba(52,152,219,0.15);
}
.auto-radio-group input[type="radio"] { accent-color: #3498db; margin-top: 3px; flex-shrink: 0; }
.auto-radio-group b { color: #1a1a1a; }
.auto-radio-group small { color: #4a5260; font-size: 0.78rem; }
.auto-radio-group code { background: rgba(0,0,0,0.06); padding: 0 4px; border-radius: 3px; font-size: 0.8em; }

.auto-subsection {
    padding: 0.8rem 0.9rem;
    background: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 12px;
    margin-bottom: 0.9rem;
}
.auto-hint { color: #6a7380; font-size: 0.75rem; margin-left: 0.5rem; }

/* Colonnes MIN_* — grille 3 cartes */
.auto-cols-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.55rem;
    margin: 0.7rem 0;
}
.auto-col-card {
    padding: 0.6rem 0.7rem;
    background: rgba(255,255,255,0.55);
    border: 1.5px solid rgba(255,255,255,0.7);
    border-radius: 10px;
}
.auto-col-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
}
.auto-col-top input[type="checkbox"] { accent-color: #3498db; width: 16px; height: 16px; }
.auto-ratio-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    color: #4a5260;
    font-size: 0.88rem;
}
.auto-ratio-row input[type="number"] {
    flex: 1;
    padding: 0.4rem 0.55rem !important;
    font-size: 0.88rem !important;
    font-weight: 700;
}

.auto-presets {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(0,0,0,0.08);
}
.auto-presets small { color: #4a5260; font-weight: 700; margin-right: 0.4rem; }
.cmd-btn.mini {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 8px;
}
.cmd-modal .actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Toast */
.cmd-flash {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 0.75rem 1.1rem;
    background: #27ae60;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all .2s;
    pointer-events: none;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 400px;
}
.cmd-flash.show { opacity: 1; transform: translateY(0); }
.cmd-flash.err  { background: var(--danger); }
.cmd-flash.info { background: #3498db; }

/* =========================================================================
   ADMIN SHARED COMPONENTS — utilisable sur toutes les pages admin
   Chargé avec admin-utils.js depuis _layout_header.php
   ========================================================================= */

/* ---- Toast générique ---- */
.admin-flash {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #1a1a1a;
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 0 #000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s;
    z-index: 2000;
    pointer-events: none;
    border: 2px solid #000;
}
.admin-flash.show { opacity: 1; transform: translateY(0); }
.admin-flash.err  { background: #f2d4d6; color: #5a1e22; }
.admin-flash.ok   { background: #cfe7d2; color: #1e5e2b; }
.admin-flash.info { background: #cce5ff; color: #0d3b66; }

/* ---- Modal générique (mêmes règles que cmd-modal, nouveau nom) ---- */
.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: admin-fade .15s;
}
@keyframes admin-fade { from { opacity: 0; } to { opacity: 1; } }
.admin-modal-backdrop.open { display: flex; }
.admin-modal {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(31,38,135,0.25);
    animation: admin-pop .18s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes admin-pop { from { transform: scale(.92); opacity: 0;} to { transform: scale(1); opacity: 1; } }

/* ---- Boutons pastel (migrés depuis facturier.css) ---- */
.btn-pastel {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px solid rgba(255,255,255,0.8);
    border-radius: 14px;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    color: #1a1a1a;
    font-weight: 800;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 4px 14px rgba(31,38,135,0.12);
    justify-content: flex-start;
    text-align: left;
    line-height: 1.15;
    user-select: none;
    text-decoration: none;
}
.btn-pastel:hover  { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 6px 22px rgba(31,38,135,0.18); }
.btn-pastel:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(31,38,135,0.15); }
.btn-pastel:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn-pastel i { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; }
.btn-pastel.full    { width: 100%; }
.btn-pastel.compact { padding: 9px 12px; font-size: 10px; gap: 8px; border-radius: 11px; }
.btn-pastel.mini    { padding: 6px 10px; font-size: 9.5px; gap: 6px; border-radius: 9px; }

/* Variantes couleur — glass tintée (frosted glass) */
.btn-pastel.pb-blue    { background: linear-gradient(135deg, rgba(150,200,245,0.55), rgba(80,160,230,0.4)); }
.btn-pastel.pb-green   { background: linear-gradient(135deg, rgba(145,230,165,0.55), rgba(80,200,120,0.4)); }
.btn-pastel.pb-purple  { background: linear-gradient(135deg, rgba(210,170,240,0.55), rgba(155,115,210,0.4)); }
.btn-pastel.pb-pink    { background: linear-gradient(135deg, rgba(250,175,195,0.55), rgba(230,120,150,0.4)); }
.btn-pastel.pb-yellow  { background: linear-gradient(135deg, rgba(250,225,140,0.6), rgba(240,200,80,0.45)); }
.btn-pastel.pb-cream   { background: linear-gradient(135deg, rgba(245,225,190,0.55), rgba(230,205,155,0.4)); }
.btn-pastel.pb-orange  { background: linear-gradient(135deg, rgba(250,200,140,0.55), rgba(235,160,80,0.4)); }
.btn-pastel.pb-teal    { background: linear-gradient(135deg, rgba(150,225,210,0.55), rgba(80,190,175,0.4)); }
.btn-pastel.pb-gray    { background: linear-gradient(135deg, rgba(230,230,230,0.55), rgba(200,200,200,0.4)); }
.btn-pastel.pb-white   { background: rgba(255,255,255,0.65); }
.btn-pastel.pb-dark    { background: linear-gradient(135deg, rgba(55,55,65,0.82), rgba(35,35,45,0.75)); color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-pastel.pb-dark i  { color: #ffd54f; }

/* ---- Typeahead générique (utilisé par AdminUtils.typeahead) ---- */
/* Le parent de l'input DOIT être position:relative (ou ajoute .ta-wrap) */
.ta-wrap { position: relative; }
.ta-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    z-index: 200;
}
.ta-dropdown .ta-item {
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #eef0f2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.ta-dropdown .ta-item:last-child { border-bottom: none; }
.ta-dropdown .ta-item:hover { background: #fef9c8; }
.ta-dropdown .ta-item.ta-empty {
    color: #999;
    font-style: italic;
    cursor: default;
    justify-content: center;
}
.ta-dropdown .ta-item.ta-empty:hover { background: #fff; }

/* ---- Status badges génériques ---- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-transform: none;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.status-badge.sb-en_attente       { background: #f39c12; }
.status-badge.sb-modifications    { background: #e67e22; }
.status-badge.sb-preparation      { background: #3498db; }
.status-badge.sb-terminee         { background: #27ae60; }
.status-badge.sb-livraison        { background: #9b59b6; }
.status-badge.sb-attente_paiement { background: #e74c3c; }
.status-badge.sb-reserve          { background: #1abc9c; }
.status-badge.sb-facturation      { background: #f97316; }
.status-badge.sb-quai             { background: #64748b; }
.status-badge.sb-arrivage         { background: #8b5cf6; }
.status-badge.sb-transit          { background: #06b6d4; }

/* Statuts spécifiques commandes — une couleur par statut */
.status-badge.sb-cmd-prepa         { background: #f59e0b; }
.status-badge.sb-cmd-envoyee       { background: #3b82f6; }
.status-badge.sb-cmd-devis_recu    { background: #8b5cf6; }
.status-badge.sb-cmd-facture_recue { background: #f97316; }
.status-badge.sb-cmd-arrivee       { background: #6366f1; }
.status-badge.sb-cmd-livree        { background: #10b981; }
.status-badge.sb-cmd-payee         { background: #059669; }
.status-badge.sb-cmd-annulee       { background: #6b7280; }
