:root {
    --bg-color: #f8f8f8;
    --text-color: #333;
    --primary: #111;
    --border: #ddd;
    --browser-ui-bottom-offset: 0px;
    /* Tarifs & offres : tons positifs (bleu / vert) */
    --promo-accent: #0d9488;
    --promo-accent-strong: #047857;
    --promo-accent-blue: #1d4ed8;
    --promo-accent-soft: #ecfdf5;
    --promo-accent-soft-2: #eff6ff;
    --promo-accent-muted: rgba(13, 148, 136, 0.18);
    --promo-was: #64748b;
}

body { margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background: var(--bg-color); color: var(--text-color); }
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Surtout pas de vh ici ! */
    width: 100%;
    overflow: hidden; /* On empêche la page globale de scroller */
    position: fixed; /* Évite les rebonds bizarres sur iOS */
}

#page { /* Utilise le bon ID ou la bonne classe */
    height: 100%; /* Toujours 100%, pas de vh */
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* C'est LUI qui a le droit de scroller si besoin */
    -webkit-overflow-scrolling: touch; /* Pour un scroll fluide sur iPhone */
}
/* LAYOUT */
.app-container {
    position: relative;
    width: 100%;
    height: 100vh;   /* fallback */
    height: 100svh;  /* small viewport height (mobile UI visible) */
    height: 100dvh;  /* dynamic viewport height */
    overflow: hidden;
}

/* Mode développeur : cadre noir autour du simulateur */
.app-container.dev-mode-active {
    outline: 4px solid #000;
    outline-offset: -2px;
}

/* Gate d'accès au simulateur (overlay plein écran déverrouillable avec la touche G) */
.simulator-gate {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.96), rgba(245, 245, 245, 0.98));
}
.simulator-gate-inner {
    max-width: 960px;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 32px;
    align-items: stretch;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
.simulator-gate-image {
    background-image: url("assets/Full-mur-1.png");
    background-size: cover;
    background-position: center;
    min-height: 260px;
}
.simulator-gate-content {
    padding: 32px 32px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}
.simulator-gate-title {
    margin: 0 0 4px;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #111827;
}
.simulator-gate-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.6;
    color: #374151;
}
.simulator-gate-instruction {
    margin-top: 10px;
    font-weight: 600;
    color: #111827;
}
.simulator-gate-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9em;
    padding: 0 0.5em;
    margin: 0 0.15em;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 700;
    font-size: 0.9em;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}
.simulator-gate-note {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}

@media (max-width: 960px) {
    .simulator-gate-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }
    .simulator-gate-image {
        height: 220px;
    }
    .simulator-gate-content {
        padding: 24px 20px 20px;
    }
}

header { padding: 15px 30px; background: white; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
header h1 { font-size: 1.2rem; margin: 0; text-transform: uppercase; letter-spacing: 1px; flex: 1; min-width: 0; }
header .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Intégré dans le site (iframe /fr/simulateur/) : navbar déjà fournie par le parent */
html.is-embedded #view-gallery > header {
    display: none;
}

/* ----- Workspace header (retractable on mobile) ----- */
.workspace-header-wrap {
    flex-shrink: 0;
    position: relative;
    transition: transform 0.25s ease;
}
.workspace-header {
    padding: 12px 16px 12px 12px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    row-gap: 8px;
    flex-wrap: wrap;
}
.workspace-header .back-button { margin-right: 0; }
.collection-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.collection-link:hover { text-decoration: underline; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
/* ----- Header basket (caddy + quantity stepper) ----- */
.header-cart-block {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.order-type-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}
.order-type-btn {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.order-type-btn-active {
    background: var(--primary);
    color: #ffffff;
}
.header-cart-total {
    font-weight: bold;
    font-size: 0.85rem;
    color: #1d355f;
    margin-top: 2px;
    align-self: center;
}

.cart-exceptional-offer,
.promo-offer-line {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--promo-accent-strong);
    padding: 8px 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--promo-accent-soft) 0%, var(--promo-accent-soft-2) 100%);
    border: 1px solid var(--promo-accent-muted);
}
.promo-price-strong {
    color: var(--promo-accent-blue);
    font-weight: 700;
}
.promo-was-price {
    font-size: 0.82em;
    color: var(--promo-was);
    text-decoration: line-through;
    margin-left: 4px;
}
.promo-date-strong {
    color: var(--promo-accent-strong);
    font-weight: 700;
}
.header-cart-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.header-cart-info-icon {
    width: 18px;
    height: 18px;
    display: block;
}
.header-cart-info-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary);
    color: var(--primary);
}
.header-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, filter 0.2s;
}
.header-cart-trigger:hover {
    filter: brightness(1.15);
}
.header-cart-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.header-cart-label {
    white-space: nowrap;
}
.header-save-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.header-save-trigger:hover {
    background: var(--bg-color);
    border-color: var(--primary);
}
.header-save-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.header-save-label {
    white-space: nowrap;
}
.header-order-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, filter 0.2s;
}
.header-order-trigger:hover {
    filter: brightness(1.12);
}
.header-order-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.header-order-label {
    white-space: nowrap;
}
.header-order-label--short {
    display: none;
}
@media (min-width: 901px) {
    .header-order-label--short {
        display: none !important;
    }
}
.header-cart-qty {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    overflow: hidden;
}
.header-cart-qty-btn {
    width: 32px;
    height: 36px;
    padding: 0;
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.header-cart-qty-btn:hover:not(:disabled) {
    background: var(--border);
    color: var(--primary);
}
.header-cart-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.header-cart-qty-value {
    min-width: 2ch;
    padding: 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}
.header-menu-wrap {
    position: relative;
}
.header-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.header-menu-trigger:hover {
    background: var(--bg-color);
    border-color: var(--primary);
    color: var(--primary);
}
.header-menu-trigger[aria-expanded="true"] {
    background: var(--bg-color);
    border-color: var(--primary);
    color: var(--primary);
}
.header-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 200px;
    padding: 6px 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 30;
}
.header-menu-dropdown.is-open {
    display: flex;
}
.header-menu-dropdown .secondary,
.header-menu-dropdown .primary {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    margin: 0;
    border-radius: 4px;
    transition: background 0.15s;
}
.header-menu-dropdown .secondary:hover {
    background: var(--bg-color);
}
.header-menu-dropdown .primary {
    color: white;
    background: var(--primary);
}
.header-menu-dropdown .primary:hover {
    filter: brightness(1.15);
}
.header-scroll-hint {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}
.workspace-header-wrap.header-retracted .header-scroll-hint {
    opacity: 1;
    pointer-events: auto;
}
@media (max-width: 900px) {
    #collection-edit-dev-btn {
        display: none !important;
    }
    /* Mobile: masquer les éléments du mode développeur */
    #dev-mode-header-label,
    .dev-mode-badge,
    #options-dev-warning,
    #dev-color-editor-overlay {
        display: none !important;
    }
    .app-container.dev-mode-active {
        outline: none;
    }
    .workspace-header-wrap {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 20;
    }
    .workspace-header-wrap.header-retracted .workspace-header {
        transform: translateY(-100%);
    }
    .workspace-main {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-top: 52px; /* place pour le header */
    }
    .workspace.workspace-preview-first {
        min-height: calc(100vh - 52px + 20px);  /* fallback */
        min-height: calc(100svh - 52px + 20px);
        min-height: calc(100dvh - 52px + 20px); /* légère surcharge pour permettre le scroll */
    }
    /* Header compact sur mobile pour limiter le passage sur 2 lignes */
    .workspace-header {
        padding: 8px 10px 8px 8px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .workspace-header .back-button {
        flex-shrink: 0;
        padding: 6px 8px;
        font-size: 0.9rem;
    }
    .workspace-header .collection-link {
        min-width: 0;
        font-size: 0.8rem;
    }
    .header-actions {
        flex-shrink: 0;
        gap: 6px;
    }
    .header-cart-block {
        gap: 6px;
    }
    .header-save-label {
        display: none; /* icône seule sur mobile */
    }
    /* Pas de CTA « Continuer » dans le header sur mobile (parcours ailleurs) */
    .header-order-trigger {
        display: none !important;
    }
    /* Menu ⋯ masqué sur mobile */
    .header-menu-wrap {
        display: none !important;
    }
    .mobile-settings-btn {
        display: inline-flex;
    }
    .header-save-trigger {
        padding: 6px 8px;
    }
    .header-save-icon {
        width: 18px;
        height: 18px;
    }
    .header-cart-info-btn {
        padding: 6px 10px;
    }
    .header-cart-info-icon {
        width: 18px;
        height: 18px;
    }
}
@media (min-width: 901px) {
    .workspace-header-wrap.header-retracted .workspace-header { transform: none; }
    .header-scroll-hint { display: none; }
}

/* main dans le Workspace (éditeur) */
#view-workspace main { display: flex; flex: 1; overflow: hidden; min-height: 0; }
/* Desktop : vraie colonne (preview à gauche, sidebar à droite) */
@media (min-width: 901px) {
    #view-workspace main.workspace-main {
        flex-direction: row;
    }
    #view-workspace main .workspace.workspace-preview-first {
        flex: 1;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
    }
    #view-workspace main .sidebar.sidebar-palette-desktop {
        flex-shrink: 0;
    }
}
/* Mobile : colonne verticale, sidebar masquée */
@media (max-width: 900px) {
    #view-workspace main.workspace-main {
        flex-direction: column;
    }
}

/* VIEWER (GAUCHE) */
.viewer { flex: 1; background: #e5e5e5; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; position: relative; }
.grid-controls { position: absolute; top: 20px; left: 20px; z-index: 10; display: flex; gap: 10px; }
.grid-controls button { background: white; border: none; padding: 8px 15px; cursor: pointer; border-radius: 4px; font-size: 0.8rem; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* GRID SYSTEM */
#grid-container { 
    display: grid; 
    gap: 0; 
    transition: var(--grid-container-transition, all 0.5s ease);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Mode Solo : 1 seul gros carreau */
.solo { width: 400px; height: 400px; grid-template-columns: 1fr; }
/* Mode Tapis : 4x4 carreaux */
.tapis { width: 600px; height: 600px; grid-template-columns: repeat(2, 1fr); }

/* SVG STYLES */
svg { width: 100%; height: 100%; display: block; }

/* L'EFFET BLOP (Micro-interaction) — zone-path sur path, rect, circle, ellipse, polygon */
path[data-active="true"],
.zone-path {
    transition: fill var(--cb-zone-fill-dur, var(--cb-zone-fill-fallback, 0.2s)) ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
    cursor: pointer;
}
path[data-active="true"]:hover,
.zone-path:hover {
    filter: brightness(1.1);
    transform: scale(1.02); /* Le petit blop */
    z-index: 10;
}

/* SIDEBAR (DROITE) - Tiroir pleine hauteur, scroll si le contenu dépasse. */
.sidebar {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    min-height: 0; /* permet le scroll dans le flex */
    background: white;
    border-left: 1px solid var(--border);
    padding: 20px;
    padding-right: 12px; /* Espace pour la scrollbar décalée */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Scrollbar discrète et décalée */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}
/* Section nuancier : au moins 30 % de la hauteur du tiroir, scroll vertical si pas assez de place. */
.sidebar.sidebar-palette-desktop #color-palette {
    min-height: 30%;
    max-height: 70%;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    border: none;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
h3 { font-size: 0.9rem; text-transform: uppercase; color: #888; margin-bottom: 10px; }

/* Sur mobile, sidebar nuancier masquée (le nuancier est dans le bottom sheet) */
@media (max-width: 900px) {
    .sidebar.sidebar-palette-desktop { display: none; }
}

/* Desktop : sidebar nuancier toujours visible (preview-first) */
@media (min-width: 901px) {
    .sidebar.sidebar-palette-desktop { display: flex; }
}

/* ----- BOTTOM SHEET (Nuancier mobile) ----- */
.palette-drawer {
    display: none; /* visible uniquement sur mobile via media query */
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--browser-ui-bottom-offset);
    max-height: 70vh;  /* fallback */
    max-height: 70svh;
    max-height: 70dvh;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    z-index: 100;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s;
    visibility: hidden;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}
.palette-drawer.open {
    transform: translateY(0);
    visibility: visible;
}
.palette-drawer-body {
    flex: 1;
    min-height: 0;
    padding: 12px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.palette-drawer-body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
/* Tiroir : une seule ligne sur l’axe X, scroll au doigt */
#color-palette-drawer.palette-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    grid-template-columns: unset;
    width: max-content;
    padding: 4px 8px;
}
#color-palette-drawer .color-swatch {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    touch-action: auto;
    -webkit-user-select: none;
    user-select: none;
}

/* En mode "favoris" (mobile), on désactive l'action native du navigateur pour garantir le drag&drop. */
body.mobile-favorites-ui-enabled #color-palette-drawer .color-swatch {
    touch-action: none;
}

.palette-drawer-recap {
    flex-shrink: 0;
    padding: 10px 16px 16px;
    border-top: 1px solid var(--border);
    background: #fafafa;
    max-height: 28vh;
    overflow-y: auto;
}
.palette-drawer-recap-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 0 0 6px 0;
}
/* Artist recommendations: full-width strips above recap */
.palette-drawer-recommendations {
    flex-shrink: 0;
    padding: 10px 16px 12px;
    border-top: 1px solid var(--border);
    background: #fafafa;
}
.palette-drawer-recommendations-title,
.artist-recommendations-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 0 0 8px 0;
}
.artist-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.artist-recommendation-strip {
    display: flex;
    align-items: center;
    width: 100%;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.artist-recommendation-strip:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.artist-recommendation-strip:active {
    transform: scale(0.99);
}
.artist-recommendation-strip span {
    flex: 1;
    min-width: 0;
    height: 20px;
    align-self: center;
}
.sidebar .artist-recommendations-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.sidebar .artist-recommendations-wrap[aria-hidden="true"] {
    display: none;
}
.sidebar .artist-recommendations-wrap[aria-hidden="false"] {
    display: block;
}
.palette-drawer-recap-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.palette-drawer-recap-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    padding: 4px 0;
}
.palette-drawer-recap-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 2px;
}
.palette-drawer-recap-item:last-child {
    border-bottom: none;
}
.palette-drawer-recap-pigments {
    padding: 4px 0 8px 28px;
    font-size: 0.7rem;
}
.palette-drawer-recap-pigments .recap-pigment-table {
    font-size: 0.65rem;
}
.palette-drawer-recap-pill {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}
.palette-drawer-recap-info {
    flex: 1;
    min-width: 0;
}
.palette-drawer-recap-info .recap-name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-drawer-recap-info .recap-code { display: block; font-size: 0.7rem; color: #666; }

@media (min-width: 901px) {
    .palette-drawer { display: none !important; }
}
@media (max-width: 900px) {
    .palette-drawer { display: flex; }
    /* Sur mobile, on ne montre pas les recommandations d'artiste ni le récap dans le tiroir */
    .palette-drawer-recommendations,
    .palette-drawer-recap {
        display: none !important;
    }
}

/* Mode dosage (?dosage=1) : bouton dans la rangée pastilles (mobile) → panneau récap */
.mobile-dosage-info-tab {
    display: none;
    position: relative;
    margin: 0;
    padding: 0;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #666;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
}
.mobile-dosage-info-tab:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}
.mobile-dosage-info-tab:active {
    transform: scale(0.97);
}
.mobile-dosage-info-tab.mobile-dosage-info-tab--visible {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mobile-dosage-info-tab-inner {
    pointer-events: none;
    white-space: nowrap;
    font-size: 1rem;
    line-height: 1;
}
@media (min-width: 901px) {
    .mobile-dosage-info-tab {
        display: none !important;
    }
}

/* Partage via QR code : bouton (mobile uniquement) */
.qr-share-btn {
    display: none;
    position: relative;
    margin: 0;
    padding: 0;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
}
.qr-share-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}
.qr-share-btn:active {
    transform: scale(0.97);
}
.qr-share-icon {
    width: 18px;
    height: 18px;
    pointer-events: none;
    display: block;
}
/* Aperçu miroir (mobile uniquement, mode dev) */
.mirror-preview-btn {
    display: none;
    position: relative;
    margin: 0;
    padding: 0;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
}
.mirror-preview-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}
.mirror-preview-btn:active {
    transform: scale(0.97);
}
.mirror-preview-icon {
    width: 18px;
    height: 18px;
    pointer-events: none;
    display: block;
}
@media (max-width: 900px) {
    .qr-share-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mirror-preview-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
.mobile-recap-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 108;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.mobile-recap-drawer-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 901px) {
    .mobile-recap-drawer-overlay {
        display: none !important;
    }
}
.mobile-recap-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(100vw - 40px, 400px);
    max-width: 100%;
    background: #fff;
    z-index: 110;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.15);
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-recap-drawer.open {
    transform: translateX(0);
    visibility: visible;
}
@media (min-width: 901px) {
    .mobile-recap-drawer {
        display: none !important;
    }
}
body.mobile-recap-drawer-open {
    overflow: hidden;
}
.mobile-recap-drawer-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 8px 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}
.mobile-recap-drawer-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
    color: #222;
}
.mobile-recap-drawer-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #444;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mobile-recap-drawer-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.mobile-recap-drawer-toolbar {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    border-bottom: 1px solid #eee;
    background: #fff;
}
.mobile-recap-drawer-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 20px;
    -webkit-overflow-scrolling: touch;
}

/* ----- Options drawer (mobile: grille + zoom) ----- */
.options-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.options-drawer-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.options-drawer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    max-width: 320px;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
}
.options-drawer.open {
    transform: translateX(0);
}
.options-drawer-inner {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.options-drawer-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 0 0 8px 0;
}
.options-drawer-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.options-drawer-layout .layout-pill {
    padding: 8px 14px;
    font-size: 0.8rem;
}
.options-drawer-zoom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.options-drawer-zoom label {
    font-size: 0.8rem;
    color: #666;
}
.options-drawer-zoom input[type="range"] {
    width: 100%;
    height: 6px;
    accent-color: var(--primary);
}
.options-drawer-zoom.hidden {
    display: none !important;
}
.options-drawer-joints {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.options-drawer-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
}
.options-drawer-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
/* Joints des carreaux : 1px contour blanc cassé continu autour de chaque tuile (calepinage + mockups).
   On utilise outline au lieu de border pour éviter un décalage d’1 px quand les joints sont masqués
   (surtout en vue mock-up avec perspective). */
#grid-container.show-joints.tapis .tile-wrapper,
.mockup-tapis.show-joints .tile-wrapper {
    outline: 1px solid #f0f0eb;
    outline-offset: -1px;
    box-sizing: border-box;
}
/* Tiroir Options : visible quand ouvert (mobile + desktop) */
.options-drawer-overlay.visible { display: block; }
.options-drawer {
    display: block;
}

/* Overlay transparent : clic en dehors ferme le tiroir (pas de gris) */
.palette-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.palette-drawer-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
@media (max-width: 900px) {
    .palette-drawer-overlay.visible { display: block; }
}
@media (min-width: 901px) {
    .palette-drawer-overlay { display: none !important; }
}

/* ----- BARRE MOBILE : Éditeur / Simulation ----- */
.mobile-view-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--browser-ui-bottom-offset);
    z-index: 50;
    background: white;
    border-top: 1px solid var(--border);
    padding: 10px 16px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    align-items: center;
}
.mobile-view-btn {
    flex: 1;
    max-width: 180px;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.mobile-view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
@media (max-width: 900px) {
    .mobile-view-bar { display: flex; }
}
@media (min-width: 901px) {
    .mobile-view-bar { display: none !important; }
}

/* ----- PREVIEW-FIRST WORKSPACE ----- */
.workspace.workspace-preview-first {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 16px 20px;
    gap: 16px;
    align-items: center;
    justify-content: flex-start;
    position: relative; /* Permet de superposer .preview-controls au-dessus de .preview-area */
}
.preview-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
    max-width: 480px;
    padding: 12px 16px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    /* Sépare visuellement les contrôles de l'aperçu derrière */
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}
/* Grille & zoom : toujours dans le tiroir (mobile + desktop) */
.preview-controls-extras {
    display: none !important;
}
.options-drawer-trigger {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    color: #666;
}
.options-drawer-trigger:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.active-colors-row-wrap {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.preview-controls-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.shuffle-colors-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: linear-gradient(165deg, #ffffff 0%, #f3f5f8 48%, #e9edf3 100%);
    color: #5c6470;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 10px 22px rgba(0, 0, 0, 0.07);
    transition:
        transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1),
        box-shadow 0.22s ease,
        color 0.2s ease,
        background 0.2s ease,
        filter 0.2s ease;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}
.mobile-settings-btn {
    display: none;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 999px;
    background: #fff;
    color: #555;
    font-size: 1.08rem;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.header-cart-block .mobile-settings-btn {
    display: none;
}
.mobile-settings-btn:active {
    transform: scale(0.96);
}
.shuffle-colors-btn:hover:not(:disabled) {
    transform: scale(1.06);
    color: var(--primary);
    background: linear-gradient(165deg, #ffffff 0%, #f6f8fb 50%, #eef2f7 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 4px 8px rgba(0, 0, 0, 0.05),
        0 14px 32px rgba(0, 0, 0, 0.1);
    filter: saturate(1.05);
}
.shuffle-colors-btn:active:not(:disabled) {
    transform: scale(0.96);
    box-shadow:
        0 1px 1px rgba(255, 255, 255, 0.5) inset,
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.06);
    transition-duration: 0.1s;
}
.shuffle-colors-btn:focus-visible {
    outline: none;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 10px 22px rgba(0, 0, 0, 0.07),
        0 0 0 3px rgba(0, 0, 0, 0.12);
}
.shuffle-colors-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.15);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.75) inset,
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 2px 6px rgba(0, 0, 0, 0.04);
}
.shuffle-colors-icon {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
    opacity: 0.92;
    transition: opacity 0.2s ease;
}
.shuffle-colors-btn:hover:not(:disabled) .shuffle-colors-icon {
    opacity: 1;
}
.active-colors-row-cluster {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.active-colors-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    width: 100%;
    max-width: 100%;
}
.active-color-pill {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    /* Bordure visible même quand la pastille est blanche */
    border: 2px solid rgba(0, 0, 0, 0.22);
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    display: block;
    box-sizing: border-box;
    transition: transform 0.15s, box-shadow 0.15s;
    appearance: none;
    background-clip: padding-box;
}
.active-color-pill:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.active-color-pill.active {
    border-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px rgba(0, 0, 0, 0.25);
}
/* Plusieurs zones avec la même nuance (hex) : mise en évidence */
.active-color-pill.active-color-pill-similar {
    outline: 2px solid #c62828;
    outline-offset: 2px;
}
.active-color-pill.active-color-pill-locked {
    cursor: default;
    pointer-events: none;
}
.active-color-pill.active-color-pill-locked:hover {
    transform: none;
    box-shadow: none;
}
.layout-selector {
    display: flex;
    justify-content: center;
}
.layout-dropdown {
    position: relative;
    width: 100%;
}
.layout-dropdown-toggle {
    width: 100%;
    padding: 8px 12px;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: white;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}
.layout-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    display: none;
    z-index: 40;
}
.layout-dropdown-menu.open {
    display: block;
}
.layout-dropdown-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}
.layout-dropdown-option:hover {
    background: var(--bg-color);
}
.layout-dropdown-option.active {
    background: var(--primary);
    color: white;
}
.calepinage-zoom-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.calepinage-zoom-wrap .calepinage-zoom-in,
.calepinage-zoom-wrap .calepinage-zoom-out {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
}
.calepinage-zoom-wrap .calepinage-zoom-in:hover:not(:disabled),
.calepinage-zoom-wrap .calepinage-zoom-out:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}
.calepinage-zoom-wrap .calepinage-zoom-in:disabled,
.calepinage-zoom-wrap .calepinage-zoom-out:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.calepinage-zoom-label {
    font-size: 0.9rem;
    color: #666;
    min-width: 3ch;
    text-align: center;
}
.molding-warning-banner {
    padding: 10px 14px;
    background: #fff8e6;
    border: 1px solid #e6c200;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #6b5a00;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}
.preview-area {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carousel-btn {
    position: absolute;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    top: 50%;
    transform: translateY(-50%);
}
.carousel-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.carousel-btn-prev { left: 8px; }
.carousel-btn-next { right: 8px; }

/* Mobile: carousel prend le max d'espace, flèches discrètes (pas de cercle), ombres latérales */
@media (max-width: 900px) {
    .workspace.workspace-preview-first {
        padding: 8px 0 8px 0;
        gap: 8px;
    }
    .preview-controls {
        left: 0;
        right: 0;
        transform: none;
        max-width: none;
        padding: 10px 12px 10px 12px;
    }
    .preview-area {
        flex: 1;
        min-height: 0;
        width: 100%;
        padding: 0 2px;
    }
    .carousel {
        min-height: 200px;
    }
    .carousel-btn {
        width: 36px;
        height: 36px;
        border-radius: 0;
        border: none;
        background: rgba(255, 255, 255, 0.75);
        font-size: 1.4rem;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    .carousel-btn:hover {
        background: rgba(255, 255, 255, 0.95);
    }
    .carousel-btn-prev { left: 4px; }
    .carousel-btn-next { right: 4px; }
    /* Ombres latérales pour suggérer le swipe */
    .carousel-track-container {
        position: relative;
    }
    .carousel-track-container::before,
    .carousel-track-container::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 24px;
        pointer-events: none;
        z-index: 2;
    }
    .carousel-track-container::before {
        left: 0;
        background: linear-gradient(to right, rgba(0,0,0,0.08), transparent);
    }
    .carousel-track-container::after {
        right: 0;
        background: linear-gradient(to left, rgba(0,0,0,0.08), transparent);
    }
    /* Contrôles sur 2 lignes : boutons puis pastilles, centrés */
    .active-colors-row-wrap {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-width: 0;
    }
    .preview-controls-buttons-row {
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-width: 0;
    }
    .active-colors-row-cluster {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 6px;
        min-width: 0;
        max-width: none;
        overflow: visible;
        justify-content: center;
    }
    .active-colors-row {
        flex: 0 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: center;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    .active-colors-row::-webkit-scrollbar {
        display: none;
        height: 0;
    }
    .active-color-pill {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-width: 1.5px;
    }
    .active-color-pill.active {
        box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35), 0 0 10px rgba(0, 0, 0, 0.22);
    }
    .active-color-pill.active-color-pill-similar {
        outline-width: 1.5px;
        outline-offset: 1px;
    }
    .shuffle-colors-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        flex-shrink: 0;
    }
    .mobile-settings-btn {
        display: inline-flex !important;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 1rem;
        flex-shrink: 0;
    }
    .header-cart-block .mobile-settings-btn {
        display: inline-flex !important;
    }
    .shuffle-colors-icon {
        width: 17px;
        height: 17px;
    }
    .preview-controls .reset-button-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 1.08rem;
        flex-shrink: 0;
    }
    .preview-controls .mobile-dosage-info-tab {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.95rem;
        flex-shrink: 0;
    }

    .preview-controls .qr-share-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
    }
    .preview-controls .mirror-preview-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
    }
}
.settings-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
}
.settings-modal-overlay[aria-hidden="false"] {
    display: flex;
}
.settings-modal-dialog {
    width: min(100%, 380px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    padding: 14px 14px 16px;
}
.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.settings-modal-title {
    margin: 0;
    font-size: 1.05rem;
}
.settings-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.settings-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.settings-modal-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}
.settings-modal-check:last-child {
    border-bottom: none;
}
.settings-modal-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.color-detail-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
    overflow-x: hidden;
    box-sizing: border-box;
}
.color-detail-modal-overlay[aria-hidden="false"] {
    display: flex;
}
.color-detail-modal-dialog {
    width: min(100%, 400px);
    max-width: 100%;
    max-height: min(90vh, 620px);
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    padding: 14px 14px 16px;
    box-sizing: border-box;
    min-width: 0;
}
.color-detail-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.color-detail-modal-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.25;
    font-weight: 600;
    padding-right: 4px;
}
.color-detail-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.color-detail-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.color-detail-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    min-width: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.color-detail-swatch {
    width: 100%;
    aspect-ratio: 1;
    max-height: 200px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}
.color-detail-dl {
    margin: 0;
}
.color-detail-meta-row {
    display: grid;
    grid-template-columns: minmax(0, 38%) 1fr;
    gap: 8px 12px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
}
.color-detail-meta-row:last-child {
    border-bottom: none;
}
.color-detail-meta-label {
    margin: 0;
    font-weight: 600;
    color: #555;
}
.color-detail-meta-value {
    margin: 0;
    color: #222;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.color-detail-meta {
    min-width: 0;
    max-width: 100%;
}
.color-detail-dosage-section {
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
}
.color-detail-dosage-heading {
    margin: 4px 0 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
}
.color-detail-dosage {
    min-width: 0;
    max-width: 100%;
}
.color-detail-dosage .recap-pigment-title {
    font-size: 0.88rem;
}
.color-detail-dosage .pigment-dosage-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    font-size: 0.78rem;
}
.color-detail-dosage .pigment-dosage-table th,
.color-detail-dosage .pigment-dosage-table td {
    padding: 5px 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}
.color-detail-dosage-hint {
    margin-top: 0;
}
.color-detail-dosage .pigment-dosage-unlock-btn {
    margin-top: 4px;
}
.color-detail-collections-section {
    flex-shrink: 0;
}
.color-detail-collections-heading {
    margin: 4px 0 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
}
.color-detail-collections-list {
    margin: 0;
    padding-left: 1.1rem;
    max-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 0.9rem;
    color: #333;
    max-width: 100%;
}
.color-detail-collection-item {
    margin-bottom: 4px;
}
.color-detail-collection-link {
    color: var(--primary, #1d355f);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
.color-detail-collection-link:hover {
    text-decoration-thickness: 2px;
}
.color-detail-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    flex-shrink: 0;
}
.color-detail-add-fav {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}
.color-detail-add-fav:disabled {
    opacity: 0.65;
    cursor: default;
}
.color-detail-btn-close-secondary {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.95rem;
    background: #fafafa;
    color: #333;
    cursor: pointer;
}
.color-detail-btn-close-secondary:hover {
    background: #f0f0f0;
}

.qr-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
}
.qr-modal-overlay[aria-hidden="false"] {
    display: flex;
}
.qr-modal-dialog {
    width: min(100%, 420px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    padding: 14px 14px 16px;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}
.qr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.qr-modal-title {
    margin: 0;
    font-size: 1.05rem;
}
.qr-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.qr-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.qr-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.qr-modal-qr-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #eee;
}
#qr-canvas {
    display: block;
    width: 240px;
    height: 240px;
}
.qr-modal-url-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-top: 2px;
}
.qr-modal-url {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.92rem;
    color: #222;
    background: #fafafa;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qr-modal-url:focus {
    outline: none;
    border-color: var(--primary);
}
.qr-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}
.qr-modal-copy-btn {
    white-space: nowrap;
}
.qr-modal-error {
    margin: 0;
    color: #b3261e;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.mirror-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
}
.mirror-modal-overlay[aria-hidden="false"] {
    display: flex;
}
.mirror-modal-dialog {
    width: min(100%, 520px);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    padding: 14px 14px 16px;
}
.mirror-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.mirror-modal-title {
    margin: 0;
    font-size: 1.05rem;
}
.mirror-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #444;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.mirror-modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.mirror-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mirror-modal-stage-wrap {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    gap: 8px;
    align-items: center;
}
.mirror-stage {
    min-height: 280px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
}
.mirror-stage .tile-wrapper {
    width: min(100%, 320px);
    aspect-ratio: 1 / 1;
    transform: scaleX(-1);
    transform-origin: center center;
}
.mirror-stage .tile-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
}
.mirror-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
}
.mirror-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.mirror-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.mirror-slide-label {
    font-size: 0.9rem;
    color: #444;
}
.mirror-modal-error {
    margin: 0;
    color: #b3261e;
    font-size: 0.9rem;
    min-height: 1.2em;
}
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
}
.carousel-dot:hover {
    border-color: var(--primary);
}
.carousel-dot.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Indication mobile : geste pinch pour zoomer le calepinage (vue tapis) */
.mobile-pinch-zoom-hint {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 36px;
    z-index: 11;
    pointer-events: none;
    justify-content: center;
    padding: 0 12px;
    box-sizing: border-box;
}
@media (prefers-reduced-motion: reduce) {
    .mobile-pinch-zoom-finger--l,
    .mobile-pinch-zoom-finger--r {
        animation: none;
    }
}
.mobile-pinch-zoom-hint[hidden] {
    display: none !important;
}
.mobile-pinch-zoom-hint-card {
    pointer-events: auto;
    max-width: min(320px, 100%);
    background: rgba(29, 53, 95, 0.96);
    color: #fff;
    border-radius: 14px;
    padding: 14px 16px 12px;
    text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.mobile-pinch-zoom-hint-anim {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    margin-bottom: 8px;
}
.mobile-pinch-zoom-finger {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ffd166;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.mobile-pinch-zoom-finger--l {
    animation: cb-pinch-finger-l 1.75s ease-in-out infinite;
}
.mobile-pinch-zoom-finger--r {
    animation: cb-pinch-finger-r 1.75s ease-in-out infinite;
}
@keyframes cb-pinch-finger-l {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-18px); }
}
@keyframes cb-pinch-finger-r {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(18px); }
}
.mobile-pinch-zoom-hint-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}
.mobile-pinch-zoom-hint-text {
    margin: 0 0 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.95;
}
.mobile-pinch-zoom-hint-btn {
    border: none;
    background: #ffd166;
    color: #1d355f;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
}
.mobile-pinch-zoom-hint-btn:active {
    transform: scale(0.98);
}
@media (min-width: 901px) {
    .mobile-pinch-zoom-hint {
        display: none !important;
    }
}
@media (max-width: 900px) {
    .mobile-pinch-zoom-hint:not([hidden]).is-visible {
        display: flex;
    }
}

/* Indication desktop : molette (scroll) pour zoomer le calepinage */
.desktop-wheel-zoom-hint {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 36px;
    z-index: 11;
    pointer-events: none;
    justify-content: center;
    padding: 0 12px;
    box-sizing: border-box;
}
.desktop-wheel-zoom-hint[hidden] {
    display: none !important;
}
.desktop-wheel-zoom-hint-card {
    pointer-events: auto;
    max-width: min(340px, 100%);
    background: rgba(29, 53, 95, 0.96);
    color: #fff;
    border-radius: 14px;
    padding: 14px 16px 12px;
    text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.desktop-wheel-zoom-hint-anim {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
}
.desktop-wheel-arrow {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    opacity: 0.85;
}
.desktop-wheel-arrow--up {
    border-bottom: 9px solid #ffd166;
    animation: cb-wheel-arrow-up 1.4s ease-in-out infinite;
}
.desktop-wheel-arrow--down {
    border-top: 9px solid #ffd166;
    animation: cb-wheel-arrow-down 1.4s ease-in-out infinite;
}
@keyframes cb-wheel-arrow-up {
    0%, 100% { opacity: 0.35; transform: translateY(2px); }
    50% { opacity: 1; transform: translateY(-3px); }
}
@keyframes cb-wheel-arrow-down {
    0%, 100% { opacity: 0.35; transform: translateY(-2px); }
    50% { opacity: 1; transform: translateY(3px); }
}
.desktop-wheel-mouse {
    width: 24px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px 14px 10px 10px;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.12);
}
.desktop-wheel-roller {
    position: absolute;
    left: 50%;
    top: 42%;
    width: 4px;
    height: 12px;
    margin-left: -2px;
    margin-top: -6px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.95) 35%,
        rgba(255, 255, 255, 0.95) 65%,
        rgba(255, 255, 255, 0.25) 100%
    );
    border-radius: 2px;
    animation: cb-wheel-roller-move 1.4s ease-in-out infinite;
}
@keyframes cb-wheel-roller-move {
    0%, 100% { transform: translateY(-5px); opacity: 0.85; }
    50% { transform: translateY(5px); opacity: 1; }
}
.desktop-wheel-zoom-hint-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}
.desktop-wheel-zoom-hint-text {
    margin: 0 0 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.95;
}
.desktop-wheel-zoom-hint-btn {
    border: none;
    background: #ffd166;
    color: #1d355f;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
}
.desktop-wheel-zoom-hint-btn:active {
    transform: scale(0.98);
}
@media (max-width: 900px) {
    .desktop-wheel-zoom-hint {
        display: none !important;
    }
}
@media (min-width: 901px) {
    .desktop-wheel-zoom-hint:not([hidden]).is-visible {
        display: flex;
        justify-content: center;
    }
}
@media (prefers-reduced-motion: reduce) {
    .desktop-wheel-arrow--up,
    .desktop-wheel-arrow--down,
    .desktop-wheel-roller {
        animation: none;
    }
}

/* Chaîne onboarding : aperçu latéral (à côté de la flèche suivante) */
.workspace-carousel-swipe-hint {
    display: none;
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    z-index: 12;
    pointer-events: none;
    max-width: min(220px, calc(100% - 96px));
    box-sizing: border-box;
}
.workspace-carousel-swipe-hint[hidden] {
    display: none !important;
}
.workspace-carousel-swipe-hint:not([hidden]).is-visible {
    display: block;
}
.workspace-carousel-swipe-hint-card {
    pointer-events: auto;
    background: rgba(29, 53, 95, 0.96);
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px 10px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.workspace-carousel-swipe-hint-anim {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-bottom: 6px;
}
.workspace-carousel-swipe-chevron {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2.5px solid #ffd166;
    border-top: 2.5px solid #ffd166;
    transform: rotate(45deg);
    animation: cb-swipe-chevron 1.15s ease-in-out infinite;
}
.workspace-carousel-swipe-chevron--d1 {
    animation-delay: 0.12s;
}
.workspace-carousel-swipe-chevron--d2 {
    animation-delay: 0.24s;
}
@keyframes cb-swipe-chevron {
    0%, 100% { opacity: 0.25; transform: rotate(45deg) translate(0, 0); }
    50% { opacity: 1; transform: rotate(45deg) translate(4px, -4px); }
}
.workspace-carousel-swipe-hint-title {
    margin: 0 0 4px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}
.workspace-carousel-swipe-hint-text {
    margin: 0 0 8px;
    font-size: 0.72rem;
    line-height: 1.35;
    opacity: 0.95;
}
.workspace-carousel-swipe-hint-btn {
    border: none;
    background: #ffd166;
    color: #1d355f;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
}
.workspace-carousel-swipe-hint-btn:active {
    transform: scale(0.98);
}
@media (max-width: 900px) {
    .workspace-carousel-swipe-hint {
        right: 42px;
        max-width: min(168px, calc(100% - 86px));
    }
    .workspace-carousel-swipe-hint-text {
        font-size: 0.68rem;
    }
}

/* Chaîne onboarding : sélection des couleurs (en haut du bandeau preview-controls, flux normal = pas coupé par overflow) */
.workspace-preview-colors-hint {
    display: none;
    position: relative;
    order: -1;
    width: 100%;
    max-width: 100%;
    margin: 0 0 10px;
    z-index: 1;
    pointer-events: none;
    box-sizing: border-box;
    flex-shrink: 0;
}
.workspace-preview-colors-hint[hidden] {
    display: none !important;
}
.workspace-preview-colors-hint:not([hidden]).is-visible {
    display: block;
}
.workspace-preview-colors-hint-card {
    pointer-events: auto;
    background: rgba(29, 53, 95, 0.96);
    color: #fff;
    border-radius: 14px;
    padding: 12px 14px 10px;
    text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.workspace-preview-colors-hint-anim {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}
.workspace-preview-colors-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ffd166;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
    animation: cb-colors-dot-pulse 1.4s ease-in-out infinite;
}
.workspace-preview-colors-dot--delay {
    animation-delay: 0.35s;
    background: #fff;
    box-shadow: 0 0 0 2px #ffd166;
}
@keyframes cb-colors-dot-pulse {
    0%, 100% { transform: scale(0.85); opacity: 0.65; }
    50% { transform: scale(1.15); opacity: 1; }
}
.workspace-preview-colors-hint-main {
    margin: 0 0 10px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0.98;
}
.workspace-preview-colors-hint-btn {
    border: none;
    background: #ffd166;
    color: #1d355f;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
}
.workspace-preview-colors-hint-btn:active {
    transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
    .workspace-carousel-swipe-chevron,
    .workspace-carousel-swipe-chevron--d1,
    .workspace-carousel-swipe-chevron--d2,
    .workspace-preview-colors-dot,
    .workspace-preview-colors-dot--delay {
        animation: none;
    }
}

.carousel-track-container {
    overflow: hidden;
    width: 100%;
    height: 100%;
    flex: 1;
    /* Le navigateur ne gère que le vertical ; le horizontal reste pour le carrousel (évite le « rembobinage » / conflit tactile). */
    touch-action: pan-y;
}
.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    position: relative;
}
.visuel-watermark {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 78px;
    height: auto;
    max-height: 60px;
    object-fit: contain;
    opacity: 0.7;
    z-index: 2;
    pointer-events: none;
}
/* Vue grille : positionné par JS au bord des carreaux ; ombre pour rester visible sur fond clair */
.visuel-watermark-grid {
    top: auto;
    left: auto;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)) drop-shadow(0 0 1px rgba(0,0,0,0.15));
}
.carousel-slide-placeholder {
    padding: 40px;
    background: #eee;
    border-radius: 12px;
    color: #666;
    font-size: 1rem;
    text-align: center;
    min-height: 0;
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Future mock-up content: wrapper fills slide, image scales with object-fit */
.carousel-slide-mockup-content {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.carousel-slide-mockup-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Mockup en situation : sandwich (tapis déformé + overlay). La scène doit avoir une taille (sinon elle collapse car tapis + img sont en absolute).
   On fixe la hauteur à 100% de la slide et la largeur via aspect-ratio (inline) pour matcher le PNG contain. */
.mockup-scene {
    position: relative;
    height: 100%;
    width: auto;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}
.mockup-tapis {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    gap: 0;
    z-index: 0;
    opacity: 1;
}
/* En perspective false : grille gridCols de large, alignée en haut à gauche sous le PNG (pas de centrage) */
.mockup-tapis[data-no-perspective="true"] {
    width: auto;
    height: auto;
    left: 0;
    top: 0;
    right: auto;
    bottom: auto;
    inset: auto;
    transform: none;
}
.mockup-tapis .tile-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    line-height: 0;
    font-size: 0;
    display: block;
    opacity: 1;
    box-sizing: border-box;
}
.mockup-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
}
/* Aperçu calepinage : occupe tout l'espace disponible (rectangle, pas carré forcé) */
.workspace-preview-first #grid-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
}
/* Grille toujours carrée : homothétie, centrée dans la slide */
.workspace-preview-first #grid-container.tapis {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    align-self: center;
    justify-self: center;
    gap: 0;
    row-gap: 0;
    column-gap: 0;
    perspective: 1000px;
}
/* Pendant la transition calepinage : hint compositor (classe retirée à la fin pour libérer la mémoire) */
.workspace-preview-first #grid-container.tapis.cb-calepinage-animating .cb-flip-stage,
.workspace-preview-first #grid-container.tapis.cb-calepinage-animating .tile-wrapper.cb-layout-tile-z-delta {
    will-change: transform;
}
/* Changement de calepinage : flip 180° (double face + backface-visibility) ou rotation Z, délai/durée par carreau */
.workspace-preview-first #grid-container.tapis .tile-wrapper.cb-layout-tile-flip-waapi {
    transform-style: preserve-3d;
    transform-origin: center center;
}
.workspace-preview-first #grid-container.tapis .tile-wrapper .cb-flip-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform-origin: center center;
}
.workspace-preview-first #grid-container.tapis .tile-wrapper .cb-flip-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    transform-style: preserve-3d;
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.workspace-preview-first #grid-container.tapis .tile-wrapper.cb-layout-tile-z-delta {
    transform-origin: center center;
}
/* Mockup sans perspective (data-no-perspective) : même logique d’animation que le tapis principal */
.mockup-scene .mockup-tapis.grid-view.tapis.cb-calepinage-animating {
    perspective: 1000px;
}
.mockup-scene .mockup-tapis.grid-view.tapis.cb-calepinage-animating .cb-flip-stage,
.mockup-scene .mockup-tapis.grid-view.tapis.cb-calepinage-animating .tile-wrapper.cb-layout-tile-z-delta {
    will-change: transform;
}
.mockup-scene .mockup-tapis.grid-view.tapis .tile-wrapper.cb-layout-tile-flip-waapi {
    transform-style: preserve-3d;
    transform-origin: center center;
}
.mockup-scene .mockup-tapis.grid-view.tapis .tile-wrapper .cb-flip-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform-origin: center center;
}
.mockup-scene .mockup-tapis.grid-view.tapis .tile-wrapper .cb-flip-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    transform-style: preserve-3d;
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.mockup-scene .mockup-tapis.grid-view.tapis .tile-wrapper.cb-layout-tile-z-delta {
    transform-origin: center center;
}
.workspace-preview-first #grid-container .tile-wrapper {
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    display: block;
}
/* Override legacy fixed sizes for grid inside preview-first (.tapis garde sa règle carrée ci-dessus) */
.workspace-preview-first #grid-container.solo {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}
@media (max-width: 900px) {
    .workspace-preview-first #grid-container {
        max-width: 100%;
        max-height: 100%;
    }
    /* Ne pas étirer la grille : garder aspect-ratio 1 (carreaux carrés) même en zone étroite */
}
.sidebar-no-zone-msg {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 12px 0;
}
.sidebar-accordion {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.sidebar-accordion-section {
    border-bottom: 1px solid var(--border, #e0e0e0);
    padding: 0;
    flex: 0 0 auto;
}
.sidebar-accordion-title {
    margin: 0;
    padding: 12px 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    cursor: pointer;
    user-select: none;
}
.sidebar-accordion-title:focus-visible {
    outline: 2px solid var(--primary, #1976d2);
    outline-offset: 2px;
    border-radius: 4px;
}
.sidebar-accordion-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 340ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 240ms ease;
    min-height: 0;
}
.sidebar-accordion-section.is-open .sidebar-accordion-panel {
    opacity: 1;
}
.sidebar-accordion-subtitle {
    margin: 0 0 10px 0;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}
/* Champ de recherche du nuancier (desktop uniquement, la sidebar est masquée sur mobile) */
.sidebar-search {
    margin-bottom: 12px;
}
.sidebar-palette-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.sidebar-about-collection {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.sidebar-about-collection-title,
.sidebar-about-collection .sidebar-about-collection-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 10px 0;
}
.sidebar-about-collection-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #1a1a1a;
}
.sidebar-about-collection-desc {
    font-size: 0.85rem;
    color: #555;
    margin: 0 0 8px 0;
    line-height: 1.4;
}
.sidebar-about-collection-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--primary, #1976d2);
    text-decoration: none;
    margin-bottom: 10px;
}
.sidebar-about-collection-link:hover {
    text-decoration: underline;
}
.sidebar-about-collection-distribution {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #555;
}
.sidebar-about-collection-dist-title {
    font-weight: 600;
    margin: 0 0 4px 0;
    font-size: 0.8rem;
}
.sidebar-about-collection-dist-text {
    margin: 0 0 8px 0;
    line-height: 1.4;
}
.sidebar-about-collection-minis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.sidebar-about-collection-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
}
.sidebar-about-collection-mini img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 6px;
    background: #fafafa;
}
.sidebar-about-collection-mini-count {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 2px;
    color: #333;
}
.sidebar-recap {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.sidebar-recap-toolbar {
    margin-bottom: 6px;
}
.sidebar-recap-toolbar-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}
.sidebar-recap-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    margin: 0;
    border: 1px solid var(--border, #d0d0d0);
    border-radius: 5px;
    background: #fff;
    color: #444;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sidebar-recap-tool-btn:hover {
    background: #f3f3f3;
    border-color: #bbb;
    color: #222;
}
.sidebar-recap-tool-btn:focus-visible {
    outline: 2px solid var(--primary, #1976d2);
    outline-offset: 1px;
}
.sidebar-recap-tool-btn svg {
    display: block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.sidebar-recap h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 10px 0;
}
.sidebar-recap-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.sidebar-recap-row-wrap:last-child .sidebar-recap-row { border-bottom: none; }
.sidebar-recap-row-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    color: #888;
    transition: transform 0.2s;
}
.sidebar-recap-row-wrap.expanded .sidebar-recap-row-toggle {
    transform: rotate(180deg);
}
.sidebar-recap-details {
    display: none;
    padding: 8px 0 8px 34px;
    font-size: 0.75rem;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
    background: #f9f9f9;
}
.sidebar-recap-row-wrap.expanded .sidebar-recap-details {
    display: block;
}
.sidebar-recap-details .recap-detail-line { margin: 2px 0; }
.sidebar-recap-details .recap-collections-disclosure {
    margin: 8px 0 0 0;
}
.sidebar-recap-details summary.recap-collections-title {
    margin: 0;
    padding: 4px 0;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.sidebar-recap-details summary.recap-collections-title::-webkit-details-marker {
    display: none;
}
.sidebar-recap-details summary.recap-collections-title::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid #888;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.sidebar-recap-details .recap-collections-disclosure[open] summary.recap-collections-title::before {
    transform: rotate(90deg);
}
.sidebar-recap-details .recap-collections-disclosure .recap-collections-list {
    margin: 4px 0 0 0;
    padding-left: 14px;
}
.sidebar-recap-details .recap-collections-disclosure .recap-collections-empty {
    margin: 4px 0 0 0;
}
.sidebar-recap-details .recap-collections-list li { margin: 2px 0; }
.sidebar-recap-details .recap-collection-link {
    color: var(--primary, #1976d2);
    text-decoration: none;
}
.sidebar-recap-details .recap-pigment-block {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e8e8e8;
}
.sidebar-recap-details .recap-pigment-title {
    margin: 0 0 6px 0;
    font-weight: 600;
    font-size: 0.8rem;
    color: #444;
}
.sidebar-recap-details .recap-pigment-recipe-name {
    margin: 0 0 6px 0;
    font-size: 0.8rem;
    font-weight: 500;
}
.recap-pigment-recipe-note {
    margin: 0 0 8px 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: #555;
}
.recap-pigment-recipe-note-label {
    font-weight: 600;
    color: #444;
}
.sidebar-recap-details .recap-pigment-table {
    font-size: 0.75rem;
    margin-bottom: 0;
}
.sidebar-recap-details .recap-pigment-table th,
.sidebar-recap-details .recap-pigment-table td {
    padding: 4px 3px;
}
.sidebar-recap-pigment-hint,
.sidebar-recap-pigment-footer {
    margin-top: 10px;
    padding: 10px 0 4px 0;
    border-top: 1px solid var(--border, #ddd);
}
.sidebar-recap-pigment-hint .recap-detail-line {
    margin-bottom: 8px;
}
.sidebar-recap-details .recap-collection-link:hover {
    text-decoration: underline;
}
.sidebar-options {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.sidebar-options-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 10px 0;
}
@media (max-width: 900px) {
    .sidebar-options {
        display: none;
    }
}
.options-surface-calc {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #555;
}
.sidebar-accordion-panel .options-surface-calc {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.sidebar-accordion-panel #color-palette {
    min-height: 0;
    max-height: none;
    overflow: visible;
}
.options-layout-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.options-layout-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}
.options-layout-item:hover {
    border-color: var(--primary);
    background: var(--bg-color);
}
.options-layout-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.options-surface-calc-title {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}
.options-surface-calc-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-end;
    margin-bottom: 6px;
}
.options-surface-calc-inputs label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.75rem;
}
.options-surface-calc-inputs input {
    width: 90px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    box-sizing: border-box;
}
.options-surface-calc-multiply,
.options-surface-calc-unit {
    font-size: 0.85rem;
    color: #777;
}
.options-surface-calc-text {
    margin: 6px 0 4px 0;
    line-height: 1.5;
}
.options-surface-calc-value {
    font-weight: 600;
}
.options-surface-waste {
    display: inline;
}
.options-surface-inline-input {
    display: inline-block;
    margin: 0 2px;
}
.options-surface-inline-input input {
    width: 70px;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    box-sizing: border-box;
}
.options-surface-calc-note {
    margin: 0;
    font-size: 0.75rem;
    color: #888;
}
.sidebar-recap-pill {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}
.sidebar-favorites-color-swatch {
    width: 24px !important;
    height: 24px !important;
    border-width: 1px !important;
    border-style: solid;
    border-color: rgba(0,0,0,0.15) !important;
    flex-shrink: 0;
}
.sidebar-favorites-color-swatch:hover {
    transform: none !important;
}
.sidebar-recap-info { flex: 1; min-width: 0; }
.sidebar-recap-info span { display: block; }
.color-swatch-tooltip {
    position: fixed;
    z-index: 1000;
    padding: 10px 14px;
    background: #333;
    color: #fff;
    font-size: 0.8rem;
    border-radius: 8px;
    max-width: 220px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.color-swatch-tooltip.visible {
    opacity: 1;
}
.color-swatch-tooltip .tooltip-name { font-weight: 600; }
.color-swatch-tooltip .tooltip-code { color: #aaa; }
.color-swatch-tooltip .tooltip-pantone,
.color-swatch-tooltip .tooltip-ral { margin-top: 4px; }

/* PALETTE */
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }

/* Nuancier desktop : pastille + bouton favori au survol */
@media (min-width: 901px) {
    #color-palette .nuancier-swatch-cell {
        position: relative;
        min-width: 0;
    }
    #color-palette .nuancier-swatch-cell .color-swatch {
        /* Revenir à la taille d'origine (évite un agrandissement à cause du conteneur). */
        width: 40px;
        height: 40px;
        aspect-ratio: auto;
    }
    .nuancier-swatch-add-fav {
        position: absolute;
        top: 2px;
        right: 2px;
        z-index: 3;
        width: 22px;
        height: 22px;
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.95);
        color: #222;
        font-size: 1rem;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.12s ease, transform 0.12s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .nuancier-swatch-cell:hover .nuancier-swatch-add-fav,
    .nuancier-swatch-cell:focus-within .nuancier-swatch-add-fav {
        opacity: 1;
        pointer-events: auto;
    }
    .nuancier-swatch-add-fav:hover {
        transform: scale(1.06);
        background: #fff;
    }
    .nuancier-swatch-cell--is-favorite .nuancier-swatch-add-fav {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}
.color-swatch { 
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative; /* pour pouvoir positionner le badge de test */
}
.color-swatch:hover { transform: scale(1.1); }
/* Surbrillance couleur active : anneau + léger glow visible sur toutes les teintes */
.color-swatch.selected {
    border-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 14px rgba(0, 0, 0, 0.25);
    transform: scale(1);
}
#color-palette-drawer .color-swatch.selected {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.4), 0 0 16px rgba(0, 0, 0, 0.3);
}

/* Petit badge discret pour les couleurs en test (état = "test") */
.color-swatch-test-badge {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.78);
    color: #ffd166;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    pointer-events: none; /* on laisse le survol à la pastille principale */
}

/* BOUTONS */
button { cursor: pointer; padding: 10px 20px; border-radius: 4px; font-weight: bold; border: none; }
.primary { background: var(--primary); color: white; }
.secondary { background: transparent; border: 1px solid var(--primary); }

/* LOADER */
.loader { color: #888; font-style: italic; }

/* Overlay de chargement au clic sur une collection */
.collection-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    transition: opacity 0.2s ease;
}
.collection-loading-overlay[aria-hidden="false"] {
    display: flex;
}
.collection-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.collection-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary, #333);
    border-top-color: transparent;
    border-radius: 50%;
    animation: collection-loading-spin 0.8s linear infinite;
}
.collection-loading-text {
    margin: 0;
    color: #555;
    font-size: 0.95rem;
}
.collection-loading-subtext {
    margin: 0.25rem 0 0;
    color: #777;
    font-size: 0.85rem;
}
.pdf-progress-bar {
    width: 220px;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.pdf-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary, #333);
    border-radius: 4px;
    transition: width 0.2s ease;
}
@keyframes collection-loading-spin {
    to { transform: rotate(360deg); }
}

/* WORKSPACE : Conteneur global */
.workspace {
    display: flex;
    gap: 40px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap; /* Important pour le mobile : ça passera à la ligne */
}

/* ZONE ÉDITEUR */
.editor-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.single-tile {
    width: 300px;
    height: 300px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    background: white;
}

/* ZONE PREVIEW (5x5) */
.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-5x5 {
    display: grid;
    /* La grille magique de 5 colonnes */
    grid-template-columns: repeat(5, 1fr); 
    width: 400px;  /* Taille visuelle du tapis */
    height: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: white;
}

/* TITRES */
h3 { text-transform: uppercase; font-size: 0.8rem; margin-bottom: 15px; letter-spacing: 1px; color: #666; }

/* RESPONSIVE MOBILE */
@media (max-width: 800px) {
    .workspace { flex-direction: column; align-items: center; }
    .grid-5x5 { width: 300px; height: 300px; } /* Plus petit sur mobile */
}

/* S'assure que le SVG remplit bien la case */
.tile-wrapper, svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* LA GRILLE 5x5 */
.grid-5x5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* Force 5 colonnes égales */
    grid-template-rows: repeat(5, 1fr);    /* Force 5 lignes égales */
    width: 500px;  /* Taille fixe pour bien voir */
    height: 500px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* L'ÉDITEUR SINGLE */
.single-tile {
    width: 400px;
    height: 400px;
    background: #fff;
    border: 1px solid #ddd;
}

/* MOBILE */
@media (max-width: 900px) {
    .grid-5x5 { width: 300px; height: 300px; }
    .single-tile { width: 300px; height: 300px; }
}

/* Ajoute ou remplace ceci à la fin de ton CSS */

.workspace {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start; /* Important pour ne pas étirer */
}

/* GAUCHE */
.single-tile {
    width: 400px;
    height: 400px;
    background: #fff;
    /* Important : le SVG doit pouvoir prendre la place */
    display: block; 
}

/* DROITE */
.grid-5x5 {
    display: grid;
    /* C'est la ligne MAGIQUE qui crée les 25 cases */
    grid-template-columns: repeat(5, 1fr); 
    grid-template-rows: repeat(5, 1fr);
}

/* NAVIGATION SINGLE PAGE */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view.hidden {
    display: none;
}

/* GALLERY */
.gallery-main {
    flex: 1;
    min-height: 0; /* permet au flex de rétrécir et au scroll de fonctionner */
    overflow-y: auto;
    padding: 30px;
    background: var(--bg-color);
}

.gallery-intro {
    max-width: 1200px;
    margin: 0 auto 16px;
    padding: 10px 14px;
    border-left: 3px solid var(--promo-accent-blue);
    border-radius: 0 6px 6px 0;
    background: linear-gradient(90deg, var(--promo-accent-soft-2), var(--promo-accent-soft));
}

.gallery-intro-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #1e293b;
}

.gallery-intro-text strong {
    color: var(--promo-accent-blue);
    font-weight: 600;
}

.gallery-filters {
    max-width: 1200px;
    margin: 0 auto 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
}

.gallery-filters-search {
    flex: 1 1 220px;
    min-width: 0;
}

.gallery-filters-search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #d0d0d0;
    font-size: 0.95rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.gallery-filters-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(35, 67, 123, 0.1);
}

.gallery-filters-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.gallery-filters-label {
    font-size: 0.9rem;
    color: #555;
}

.gallery-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #d0d0d0;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.gallery-filters-toggle input {
    accent-color: var(--primary);
}

.gallery-filters-toggle:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.gallery-filters-note {
    width: 100%;
    font-size: 0.8rem;
    color: #777;
    margin: 0;
}

#view-gallery {
    z-index: 1;
}

#view-workspace {
    z-index: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 200px;
}

.gallery-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-card.is-entering {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
}

.gallery-card.is-leaving {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
    pointer-events: none;
}

.gallery-card-image {
    position: relative;
    width: 100%;
    /* Ratio 4:3 pour les vignettes */
    padding-top: 75%;
    background-color: #e5e5e5;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 60%);
    display: flex;
    align-items: flex-end;
    padding: 16px;
}

.gallery-card-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* BOUTON RETOUR */
.back-button {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: var(--primary);
    cursor: pointer;
    padding: 8px 15px;
    margin-right: 15px;
    transition: opacity 0.2s ease;
}

.back-button:hover {
    opacity: 0.7;
}

.reset-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.reset-button:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}
.reset-button-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* HEADER AVEC BOUTON RETOUR (déjà stylé par .workspace-header) */
#view-workspace .workspace-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* RESPONSIVE GALLERY */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .gallery-filters {
        gap: 10px 12px;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .gallery-main {
        padding: 20px;
    }

    .gallery-intro {
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .gallery-intro-text {
        font-size: 0.85rem;
    }
}

/* ----- Pop-up d’actualités (lancement, promos) — présentation “wow” ----- */
@keyframes simulator-news-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes simulator-news-dialog-in {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes simulator-news-shine {
    0%, 100% { opacity: 0.35; transform: rotate(-8deg) scale(1); }
    50% { opacity: 0.6; transform: rotate(-8deg) scale(1.03); }
}
@keyframes simulator-news-sparkle {
    0%, 100% { opacity: 0.25; transform: scale(0.85); }
    50% { opacity: 0.95; transform: scale(1.15); }
}
@keyframes simulator-news-cta-glow {
    0%, 100% { box-shadow: 0 4px 24px rgba(29, 53, 95, 0.45), 0 0 0 0 rgba(255, 209, 102, 0.35); }
    50% { box-shadow: 0 8px 32px rgba(29, 53, 95, 0.55), 0 0 28px rgba(255, 209, 102, 0.45); }
}

.simulator-news-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background:
        radial-gradient(ellipse 120% 80% at 50% 20%, rgba(255, 209, 102, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 90% 70% at 80% 100%, rgba(29, 53, 95, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse 80% 60% at 10% 90%, rgba(29, 53, 95, 0.28) 0%, transparent 45%),
        rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.simulator-news-overlay[aria-hidden="false"] {
    display: flex;
    animation: simulator-news-overlay-in 0.45s ease-out both;
}
.simulator-news-dialog {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-radius: clamp(18px, 4vw, 26px);
    max-width: min(94vw, 720px);
    width: 100%;
    max-height: min(92vh, 900px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 32px 90px rgba(0, 0, 0, 0.38),
        0 0 100px rgba(29, 53, 95, 0.12);
}
.simulator-news-overlay[aria-hidden="false"] .simulator-news-dialog {
    animation: simulator-news-dialog-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.simulator-news-backdrop-shine {
    pointer-events: none;
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 200deg at 50% 50%, transparent 0deg, rgba(255, 209, 102, 0.12) 60deg, transparent 120deg, rgba(29, 53, 95, 0.08) 200deg, transparent 280deg);
    animation: simulator-news-shine 6s ease-in-out infinite;
    z-index: 0;
}
.simulator-news-top-bar {
    position: relative;
    z-index: 2;
    height: 5px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #ffd166 0%, #1d355f 38%, #3b5a9a 50%, #1d355f 62%, #ffd166 100%);
    background-size: 200% 100%;
    animation: simulator-news-top-sweep 8s linear infinite;
}
@keyframes simulator-news-top-sweep {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.simulator-news-sparkles {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    overflow: hidden;
}
.simulator-news-sparkle {
    position: absolute;
    font-size: clamp(0.75rem, 2vw, 1rem);
    color: #ffd166;
    text-shadow: 0 0 12px rgba(255, 209, 102, 0.9);
    animation: simulator-news-sparkle 2.8s ease-in-out infinite;
}
.simulator-news-sparkle:nth-child(1) { top: 14%; left: 8%; animation-delay: 0s; }
.simulator-news-sparkle:nth-child(2) { top: 22%; right: 10%; animation-delay: 0.4s; }
.simulator-news-sparkle:nth-child(3) { top: 48%; left: 4%; animation-delay: 0.9s; }
.simulator-news-sparkle:nth-child(4) { bottom: 38%; right: 7%; animation-delay: 0.2s; }
.simulator-news-sparkle:nth-child(5) { bottom: 18%; left: 14%; animation-delay: 1.1s; }
.simulator-news-sparkle:nth-child(6) { top: 36%; right: 18%; animation-delay: 0.6s; }
.simulator-news-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1d355f;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.simulator-news-close:hover {
    background: #fff;
    transform: scale(1.06);
    box-shadow: 0 8px 28px rgba(29, 53, 95, 0.2);
}
.simulator-news-close:active {
    transform: scale(0.96);
}
.simulator-news-image-wrap {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    margin: 0;
    overflow: hidden;
    background: linear-gradient(145deg, #e8ecf4 0%, #f3f4f6 100%);
}
.simulator-news-image-wrap::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(255, 255, 255, 0.85) 100%);
    z-index: 1;
}
.simulator-news-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(38vh, 320px);
    min-height: 140px;
    object-fit: cover;
    vertical-align: middle;
    position: relative;
    z-index: 0;
}
.simulator-news-image-placeholder {
    min-height: min(28vh, 240px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 20px;
    font-size: 0.9rem;
    color: #5b6472;
    line-height: 1.5;
    box-sizing: border-box;
    position: relative;
    z-index: 0;
}
.simulator-news-image-placeholder::before {
    content: "Ajoutez votre photo : renseignez imageSrc dans script.js (ex. assets/votre-visuel.jpg).";
}
.simulator-news-content {
    position: relative;
    z-index: 2;
    padding: clamp(18px, 3.5vw, 28px) clamp(18px, 4vw, 32px) clamp(20px, 3vw, 26px);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.simulator-news-badge {
    margin: 0 0 12px 0;
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1d355f;
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.95) 0%, rgba(255, 224, 150, 0.98) 100%);
    box-shadow: 0 2px 12px rgba(255, 209, 102, 0.45);
}
.simulator-news-badge[hidden] {
    display: none !important;
}
.simulator-news-title {
    margin: 0 0 14px 0;
    padding-right: 48px;
    font-size: clamp(1.45rem, 4.2vw, 2.15rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: #0f172a;
    text-shadow: 0 2px 28px rgba(29, 53, 95, 0.08);
}
.simulator-news-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: clamp(0.95rem, 2.2vw, 1.05rem);
    line-height: 1.62;
    color: #334155;
    -webkit-font-smoothing: antialiased;
}
.simulator-news-body p {
    margin: 0 0 12px 0;
}
.simulator-news-body p:last-child {
    margin-bottom: 0;
}
.simulator-news-body a {
    color: #1d355f;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
    transition: color 0.15s ease;
}
.simulator-news-body a:hover {
    color: #0b1220;
}
.simulator-news-actions {
    display: flex;
    justify-content: stretch;
    margin-top: clamp(18px, 3vw, 24px);
    flex-shrink: 0;
}
.simulator-news-cta {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 16px 22px;
    font-size: clamp(1rem, 2.5vw, 1.12rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #1d355f 0%, #2a4a7c 45%, #1d355f 100%);
    background-size: 200% 200%;
    transition: transform 0.2s ease, filter 0.2s ease;
    animation: simulator-news-cta-glow 3.2s ease-in-out infinite;
}
.simulator-news-cta:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.06);
}
.simulator-news-cta:active {
    transform: translateY(0) scale(0.99);
}
.simulator-news-footnote {
    margin: 12px 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

@media (max-width: 600px) {
    .simulator-news-image {
        max-height: min(34vh, 260px);
    }
    .simulator-news-title {
        padding-right: 44px;
    }
    .simulator-news-cta {
        padding: 15px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .simulator-news-overlay[aria-hidden="false"],
    .simulator-news-overlay[aria-hidden="false"] .simulator-news-dialog {
        animation: none;
    }
    .simulator-news-backdrop-shine,
    .simulator-news-top-bar,
    .simulator-news-sparkle,
    .simulator-news-cta {
        animation: none;
    }
    .simulator-news-cta {
        box-shadow: 0 6px 24px rgba(29, 53, 95, 0.4);
    }
}

/* ----- Assistant commande (échantillon / cartons) ----- */
.order-flow-overlay {
    position: fixed;
    inset: 0;
    z-index: 9995;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.order-flow-overlay[aria-hidden="false"] {
    display: flex;
}
.order-flow-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.order-flow-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    height: auto;
    max-height: min(92vh, 880px);
    background: linear-gradient(165deg, #f8f6ff 0%, #ffffff 42%, #ffffff 100%);
    border-radius: 18px;
    border: 1px solid rgba(29, 53, 95, 0.1);
    box-shadow:
        0 24px 64px rgba(29, 53, 95, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset;
    padding: 16px 14px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.order-flow-kicker {
    margin: 0 0 4px 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    text-align: center;
    padding-right: 28px;
}
.order-flow-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #666;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}
.order-flow-close:hover {
    background: var(--bg-color);
    color: var(--primary);
}
.order-flow-viewport {
    width: 100%;
    margin-top: 6px;
    position: relative;
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(824px, calc(92vh - 56px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.order-flow-track {
    position: relative;
    left: 0;
    top: 0;
    width: 300%;
    display: flex;
    align-items: flex-start;
    transition: transform 0.38s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}
.order-flow-track[data-step="root"] {
    transform: translateX(0);
}
.order-flow-track[data-step="sample"] {
    transform: translateX(-33.333333%);
}
.order-flow-track[data-step="boxes"] {
    transform: translateX(-66.666666%);
}
.order-flow-panel {
    flex: 0 0 33.333333%;
    box-sizing: border-box;
    padding: 0 6px 0 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-width: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.order-flow-panel[data-active="false"] {
    max-height: 0;
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: 0;
    margin: 0;
}
.order-flow-panel[data-active="true"] {
    max-height: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.order-flow-panel--root {
    justify-content: flex-start;
}
.order-flow-main-title {
    margin: 0 0 8px 0;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1d355f;
    text-align: center;
    padding-right: 28px;
    line-height: 1.2;
}
.order-flow-lead {
    margin: 0 0 18px 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #444;
    text-align: center;
}
.order-flow-choice-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.order-flow-choice-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 2px solid rgba(29, 53, 95, 0.12);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.22s, box-shadow 0.22s, transform 0.2s;
}
.order-flow-choice-card:hover {
    border-color: rgba(29, 53, 95, 0.45);
    box-shadow: 0 10px 28px rgba(29, 53, 95, 0.14);
    transform: translateY(-1px);
}
.order-flow-choice-media {
    display: block;
    width: 100%;
    height: 96px;
    overflow: hidden;
    background: #f1f5f9;
}
.order-flow-choice-media--tile-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}
.order-flow-choice-media--tile-thumb img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.order-flow-choice-media--grid-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: #f8fafc;
}
.order-flow-grid-thumb-frame {
    width: 100%;
    max-width: 100%;
    max-height: 84px;
    aspect-ratio: var(--of-grid-ar, 1);
    margin: 0 auto;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    background-color: #fff;
    background-repeat: repeat;
    background-position: 0 0;
    /* Chaque tuile ≈ 36 % de la largeur du cadre : la mosaïque remplit tout l’espace */
    background-size: 36% auto;
    opacity: 0.35;
    filter: blur(1px);
    transition: opacity 0.35s ease, filter 0.35s ease;
}
.order-flow-grid-thumb-frame.order-flow-preview-ready {
    opacity: 1;
    filter: none;
}
.order-flow-choice-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px 16px;
}
.order-flow-choice-card:not(.order-flow-choice-card--download) .order-flow-choice-text {
    align-items: center;
    text-align: center;
    padding: 8px 14px 10px;
    justify-content: center;
    min-height: 2.75rem;
}
.order-flow-choice-label {
    font-size: 1.02rem;
    font-weight: 700;
    color: #1d355f;
}
.order-flow-choice-hint {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #64748b;
}
.order-flow-choice-card--download {
    flex-direction: row;
    align-items: center;
    padding: 0;
}
.order-flow-choice-card--download .order-flow-choice-inline {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    text-align: left;
}
.order-flow-download-icon-inline {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--promo-accent-blue);
}
.order-flow-choice-card--download:hover .order-flow-download-icon-inline {
    color: var(--promo-accent-strong);
}
.order-flow-choice-inline-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.order-flow-choice-card--download .order-flow-choice-label,
.order-flow-choice-card--download .order-flow-choice-hint {
    text-align: left;
}
.order-flow-preview-img,
.order-flow-tile-showcase-img {
    opacity: 0.35;
    filter: blur(1px);
    transition: opacity 0.35s ease, filter 0.35s ease;
}
.order-flow-preview-img.order-flow-preview-ready,
.order-flow-tile-showcase-img.order-flow-preview-ready {
    opacity: 1;
    filter: none;
}
.cart-confirm-hero {
    margin: -6px -10px 10px -10px;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    min-height: 96px;
    height: clamp(96px, 26vw, 180px);
    max-height: 180px;
    padding: 0;
    background: #f1f5f9;
}
.cart-confirm-hero-pattern {
    width: 100%;
    height: 100%;
    min-height: 96px;
    display: block;
    background-color: #f1f5f9;
    background-repeat: repeat;
    background-position: 0 0;
    background-size: 26% auto;
    opacity: 0.4;
    filter: blur(1px);
    transition: opacity 0.4s ease, filter 0.4s ease;
}
.cart-confirm-hero-pattern.cart-confirm-hero-ready {
    opacity: 1;
    filter: none;
}
/* Échantillon : un seul carreau centré, léger relief / sol */
.order-flow-tile-showcase {
    position: relative;
    margin: 0 0 16px 0;
    padding: 24px 16px 32px;
    background: linear-gradient(185deg, #ffffff 0%, #f8fafc 42%, #eef2f7 100%);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.order-flow-tile-showcase-floor {
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: 14px;
    height: 42%;
    border-radius: 50%;
    background: radial-gradient(ellipse 72% 55% at 50% 100%, rgba(15, 118, 110, 0.14), transparent 72%);
    pointer-events: none;
}
.order-flow-tile-showcase-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 148px;
    perspective: 640px;
}
.order-flow-tile-showcase-img {
    position: relative;
    z-index: 1;
    max-width: min(210px, 78%);
    max-height: 210px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: rotateX(9deg);
    transform-origin: center bottom;
    transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease;
}
.order-flow-tile-showcase-img.order-flow-preview-ready {
    transform: rotateX(8deg);
    -webkit-box-reflect: below 10px linear-gradient(to bottom, transparent 55%, rgba(255, 255, 255, 0.42) 100%);
}
/* Cartons : grille avec ratio réel (carrés) */
.order-flow-step-hero--boxes {
    margin: 0 0 14px 0;
    padding: 10px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}
.order-flow-grid-preview-frame {
    width: 100%;
    max-height: min(200px, 28vh);
    aspect-ratio: var(--of-grid-ar, 1);
    margin: 0 auto;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    background-color: #fff;
    background-repeat: repeat;
    background-position: 0 0;
    background-size: 34% auto;
    opacity: 0.35;
    filter: blur(1px);
    transition: opacity 0.35s ease, filter 0.35s ease;
}
.order-flow-grid-preview-frame.order-flow-preview-ready {
    opacity: 1;
    filter: none;
}
.order-flow-sample-price-line,
.cart-confirm-sample-price-line {
    margin: 14px 0 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d1fae5 0%, #dbeafe 100%);
    border: 1px solid rgba(4, 120, 87, 0.22);
    font-size: 0.92rem;
    line-height: 1.45;
    color: #134e4a;
}
.order-flow-sample-price-line .promo-price-strong,
.cart-confirm-sample-price-line .promo-price-strong {
    color: var(--promo-accent-blue);
}
.order-flow-price-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f766e;
}
.cart-confirm-sample-price-line .order-flow-price-label {
    display: inline;
    margin-right: 6px;
    margin-bottom: 0;
}
.order-flow-launch-note {
    margin: 0 0 12px 0;
    padding: 10px 12px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #134e4a;
    background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 100%);
    border-radius: 10px;
    border: 1px solid var(--promo-accent-muted);
}
.order-flow-unit-price {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #333;
}
.order-flow-unit-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #1d355f;
}
.order-flow-qty-center {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 8px 0 12px;
}
.order-flow-qty-center .order-flow-qty {
    margin-bottom: 0;
}
.order-flow-qty.order-flow-qty {
    align-self: center;
    min-height: 44px;
    align-items: center;
}
.order-flow-qty .header-cart-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    height: 44px;
    width: 44px;
    font-size: 1.35rem;
}
.order-flow-qty .header-cart-qty-value {
    min-width: 5.5ch;
    padding: 0 14px;
    font-size: 1.05rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.order-flow-surface-recap {
    margin: 0 0 12px 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #555;
}
.order-flow-boxes-total {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid rgba(29, 53, 95, 0.1);
    font-weight: 700;
    font-size: 0.98rem;
    color: #1d355f;
    line-height: 1.35;
}
.order-flow-back-btn {
    align-self: flex-start;
    margin-bottom: 12px;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.order-flow-back-btn:hover {
    background: var(--bg-color);
}
.order-flow-panel-body {
    flex: 0 1 auto;
    min-height: 0;
    overflow: visible;
    padding-right: 4px;
}
.order-flow-panel-body h3 {
    font-size: 0.98rem;
    margin: 0 0 6px 0;
    color: #444;
    text-align: center;
}
.order-flow-panel-body p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 10px 0;
    color: #333;
}
.order-flow-section-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: #1d355f;
    text-align: center;
}
.order-flow-section-intro {
    margin: 0 0 12px 0;
    font-size: 0.88rem;
    color: #555;
    line-height: 1.45;
    text-align: center;
}
.order-flow-qty {
    margin-bottom: 16px;
    align-self: flex-start;
}
.order-flow-panel-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 10px;
    padding-top: 10px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    background: linear-gradient(to top, #ffffff 88%, rgba(255, 255, 255, 0));
    box-shadow: 0 -10px 24px rgba(255, 255, 255, 0.92);
}
.order-flow-dialog .order-flow-primary-btn.primary,
.order-flow-primary-btn.primary {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    background: linear-gradient(165deg, #2dd4bf 0%, #14b8a6 35%, #0d9488 70%, #2563eb 100%);
    color: #fff;
    box-shadow:
        0 10px 28px rgba(13, 148, 136, 0.38),
        0 2px 0 rgba(255, 255, 255, 0.22) inset;
    transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
}
.order-flow-dialog .order-flow-primary-btn.primary:hover,
.order-flow-primary-btn.primary:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow:
        0 14px 32px rgba(37, 99, 235, 0.28),
        0 2px 0 rgba(255, 255, 255, 0.25) inset;
}
.order-flow-dialog .order-flow-primary-btn.primary:active,
.order-flow-primary-btn.primary:active {
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .order-flow-tile-showcase-img {
        transform: none !important;
        -webkit-box-reflect: none;
    }
    .order-flow-primary-btn.primary:hover {
        transform: none;
    }
}
@media (max-width: 480px) {
    .order-flow-dialog {
        padding: 14px 12px 10px;
        max-height: min(92dvh, 92vh, 900px);
    }
    .order-flow-viewport {
        max-height: min(820px, calc(92dvh - 52px), calc(92vh - 52px));
    }
    .order-flow-main-title {
        font-size: 1.1rem;
    }
}

/* ----- Modale de confirmation avant ajout au panier ----- */
.cart-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
}
.cart-confirm-overlay[aria-hidden="false"] {
    display: flex;
}
.cart-confirm-dialog {
    background: #ffffff;
    border-radius: 16px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
    padding: 20px 22px 18px;
    overflow: hidden;
}
.cart-confirm-title {
    margin: 0 0 6px 0;
    padding: 2px 0;
    font-size: 1.1rem;
    line-height: 1.3;
    text-align: center;
}
.cart-confirm-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 4px;
}
.cart-confirm-body h3 {
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: 0;
    margin: 16px 0 6px;
    color: #444;
}
.cart-confirm-body p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 8px 0;
    color: #333;
}
.cart-confirm-body a {
    color: var(--primary);
    text-decoration: underline;
}
.cart-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}
.cart-confirm-actions .cart-confirm-cancel {
    min-width: 0;
}
.cart-confirm-actions .cart-confirm-confirm {
    flex: 1;
}
@media (max-width: 600px) {
    .cart-confirm-dialog {
        padding: 16px 14px 14px;
        border-radius: 14px;
    }
    .cart-confirm-title {
        font-size: 1rem;
    }
    .cart-confirm-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .cart-confirm-actions .cart-confirm-confirm,
    .cart-confirm-actions .cart-confirm-cancel {
        width: 100%;
    }
}

body.modal-open {
    overflow: hidden;
}

/* ----- Toast d'information mobile (usage conseillé sur ordinateur) ----- */
.mobile-usage-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    z-index: 11000;
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    width: min(92vw, 480px);
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.9);
    color: #f9fafb;
    font-size: 0.8rem;
    line-height: 1.5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    transform: translate(-50%, calc(-50% + 12px));
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.mobile-usage-toast.is-visible {
    display: flex;
    transform: translate(-50%, -50%);
    opacity: 1;
}
.mobile-usage-toast-text {
    flex: 1;
    min-width: 0;
}
.mobile-usage-toast-strong {
    font-weight: 600;
}
.mobile-usage-toast-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 999px;
}
.mobile-usage-toast-close:hover {
    background: rgba(249, 250, 251, 0.1);
}
@media (min-width: 901px) {
    .mobile-usage-toast {
        display: none !important;
    }
}

/* Bandeau global du mode développeur (en bas à gauche, au-dessus de tout) */
.dev-mode-badge {
    position: fixed;
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom) + var(--browser-ui-bottom-offset));
    z-index: 12000;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #000;
    color: #fff;
    font-size: 0.75rem;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.dev-mode-badge label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
}
.dev-mode-badge input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
}
.dev-mode-badge-dosage {
    display: flex;
    align-items: center;
    padding-left: 10px;
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}
.dev-mode-badge-dosage label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    font-size: 0.72rem;
    opacity: 0.95;
}

/* Mode réalisateur : section visible uniquement si mode développeur actif */
#configurateur-app:not(.dev-mode-active) .sidebar-director-dev-only {
    display: none !important;
}

.sidebar-director-mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}
.sidebar-director-mode-intro {
    margin: 0 0 4px;
    color: #555;
    font-size: 0.85rem;
    line-height: 1.35;
}
.sidebar-director-mode-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    line-height: 1.35;
}
.sidebar-director-mode-speed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
.sidebar-director-mode-speed label {
    font-weight: 600;
    font-size: 0.85rem;
}
.sidebar-director-ms-value {
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}
.sidebar-director-start-btn {
    width: 100%;
    margin-top: 4px;
    padding: 12px 14px;
    font-size: 0.95rem;
}
.sidebar-director-mode-hint {
    margin: 0;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.35;
}

/* Mode réalisateur actif : zone carreaux + sidebar droite conservée (réglages), fond uni */
body.director-mode-active {
    background: #e5e5e5 !important;
}
body.director-mode-active #configurateur-app.dev-mode-active {
    outline: none !important;
}
body.director-mode-active #view-workspace {
    background: #e5e5e5;
}
body.director-mode-active #workspace-header-wrap,
body.director-mode-active .preview-controls,
body.director-mode-active #palette-drawer,
body.director-mode-active #palette-drawer-overlay,
body.director-mode-active .mobile-dosage-info-tab,
body.director-mode-active .mobile-recap-drawer,
body.director-mode-active .mobile-recap-drawer-overlay,
body.director-mode-active .dev-mode-badge,
body.director-mode-active .carousel-btn,
body.director-mode-active .carousel-dots {
    display: none !important;
}
body.director-mode-active .visuel-watermark {
    display: none !important;
}
body.director-mode-active #workspace-preview-colors-hint,
body.director-mode-active #workspace-carousel-swipe-hint,
body.director-mode-active #mobile-pinch-zoom-hint,
body.director-mode-active #desktop-wheel-zoom-hint {
    display: none !important;
    visibility: hidden !important;
}

body.director-mode-active .workspace.workspace-preview-first {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0;
    gap: 0;
    align-items: center;
    justify-content: center;
}
body.director-mode-active .preview-area {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
}
body.director-mode-active #preview-carousel {
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
}
body.director-mode-active .carousel-track-container {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ----- Dosages pigments (données chiffrées, accès par phrase) ----- */
.dosage-passphrase-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
}
.dosage-passphrase-overlay[aria-hidden="false"] {
    display: flex;
}
.dosage-passphrase-dialog {
    background: #fff;
    border-radius: 14px;
    max-width: 400px;
    width: 100%;
    padding: 20px 22px 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.dosage-passphrase-form {
    margin: 0;
    display: block;
}
/* Hors écran : évite l’avertissement Chrome « password forms should have username fields » */
.dosage-passphrase-user-stub-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}
.dosage-passphrase-user-stub-wrap label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}
.dosage-passphrase-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    line-height: 1.25;
}
.dosage-passphrase-sub {
    margin: 0 0 14px 0;
    font-size: 0.9rem;
    color: #555;
}
.dosage-passphrase-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.dosage-passphrase-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}
.dosage-passphrase-error {
    min-height: 1.25em;
    margin: 8px 0 0 0;
    font-size: 0.85rem;
    color: #b00020;
}
.dosage-passphrase-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}
.dosage-passphrase-cancel {
    background: transparent;
    border: 1px solid var(--primary, #1d355f);
    color: var(--primary, #1d355f);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.dosage-passphrase-submit {
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    border: none;
}
.pigment-dosage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: 10px;
}
.pigment-dosage-table th,
.pigment-dosage-table td {
    border-bottom: 1px solid #e8e8e8;
    padding: 6px 4px;
    text-align: left;
}
.pigment-dosage-table th {
    color: #666;
    font-weight: 600;
}
.pigment-dosage-unlock-btn {
    margin-top: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.pigment-dosage-forget-btn.linklike {
    display: inline-block;
    margin-top: 12px;
    padding: 0;
    border: none;
    background: none;
    color: var(--primary, #1d355f);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.8rem;
}
.sidebar-recap-pigment-footer .pigment-dosage-forget-btn.linklike {
    margin-top: 0;
}

/* Favoris nuancier (sidebar desktop) */
.sidebar-favorites-hint {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.35;
}
.sidebar-favorites-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.sidebar-favorite-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    cursor: default;
}
.sidebar-favorite-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.25;
    color: var(--text-color, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-favorite-row .color-swatch {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    touch-action: none;
}
.sidebar-favorite-remove {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-favorite-remove:hover {
    background: rgba(0, 0, 0, 0.12);
}
.sidebar-favorites-clear-btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border, #ddd);
    background: transparent;
    cursor: pointer;
    font-weight: 600;
}
.sidebar-favorites-clear-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Suppression (desktop) dans la liste "Couleurs favorites" calquée sur le récap */
.sidebar-favorites-remove-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-favorites-remove-btn:hover {
    background: rgba(0, 0, 0, 0.12);
}
.mobile-favorites-strip[hidden] {
    display: none !important;
}
.mobile-favorites-strip {
    display: none;
    position: relative;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.mobile-recommendations-strip[hidden] {
    display: none !important;
}
.mobile-recommendations-strip {
    display: none;
    position: relative;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.mobile-favorites-toggle {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    border: 1.5px solid rgba(0, 0, 0, 0.22);
    border-radius: 999px;
    background: #fff;
    color: #d59b00;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    overflow: visible;
}
.mobile-recommendations-toggle {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    border: 1.5px solid rgba(0, 0, 0, 0.25);
    border-radius: 999px;
    background: linear-gradient(120deg, #ff5f6d 0%, #ffc371 24%, #8de969 49%, #5bc0ff 74%, #9c6bff 100%);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}
.mobile-favorites-toggle-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.mobile-recommendations-toggle-icon {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}
.mobile-favorites-toggle-count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    color: #555;
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
}
.mobile-favorites-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    max-height: min(52vh, 280px);
    border: 1px solid #ddd;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 6px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    z-index: 35;
}
.mobile-recommendations-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: min(56vw, 170px);
    max-height: min(52vh, 280px);
    border: 1px solid #ddd;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 8px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    z-index: 35;
}
.mobile-favorites-panel.mobile-favorites-panel--open {
    display: flex;
}
.mobile-recommendations-panel.mobile-recommendations-panel--open {
    display: flex;
}
.mobile-favorites-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0;
    min-height: 0;
}
.mobile-recommendations-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
@media (max-width: 900px) {
    .mobile-recommendations-list .artist-recommendation-strip {
        height: 28px;
    }
}
.mobile-favorites-list .color-swatch {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
    touch-action: none;
}
.mobile-favorites-clear {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: 1px solid rgba(183, 28, 28, 0.25);
    border-radius: 10px;
    background: #fff6f6;
    color: #b71c1c;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}
.mobile-favorites-clear.mobile-favorites-clear--drop-target {
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.34);
    transform: scale(1.06);
}
@media (max-width: 900px) {
    body.mobile-favorites-ui-enabled .mobile-favorites-strip {
        display: inline-flex;
    }
    body.mobile-favorites-ui-enabled .mobile-recommendations-strip {
        display: inline-flex;
    }
}
.active-color-pill.active-color-pill--drop-hover {
    box-shadow: 0 0 0 3px var(--primary, #111), 0 0 16px rgba(0, 0, 0, 0.2);
    transform: scale(1.08);
}
.color-swatch-drag-ghost {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 9990;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0.92;
    left: 0;
    top: 0;
    box-sizing: border-box;
}
