:root { 
    --cyan: #00f2ff; 
    --dark: #050505; 
    --panel: #111; 
    --border: #333; 
    --text: #fff; 
    --red: #ff3333; 
    --green: #00ff41; 
    --purple: #d600ff; 
    --app-height: 100dvh;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* --- FIX GLOBAL MOBILE : Empêche le scroll élastique et les dépassements --- */
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
    body,td,th {
	font-family: "Share Tech Mono", monospace;
}
body { 
    background-color: var(--dark); 
    color: var(--text); 
    font-family: 'Share Tech Mono', monospace; 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    
    /* Ces lignes verrouillent l'application comme une app native */
    position: fixed; 
    width: 100%; 
    height: 100%; 
    height: var(--app-height); 
    overflow: hidden; 
    user-select: none; 
    touch-action: none; 
}

/* --- MODALE ORIENTATION --- */
#orientation-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #050505; z-index: 9999; flex-direction: column; 
    align-items: center; justify-content: center; text-align: center; padding: 20px;
}
#orientation-modal.is-dismissed { display: none !important; }
#orientation-continue-btn {
    margin-top: 18px;
    width: auto;
    min-width: 220px;
    padding: 12px 18px;
    background: var(--cyan);
    color: #000;
    border: none;
    font-weight: 700;
}
.orientation-icon { font-size: 3rem; color: var(--cyan); margin-bottom: 20px; animation: rotatePhone 2s infinite ease-in-out; }
@keyframes rotatePhone { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } }

/* --- TOP NAV / HEADER GLOBAL (voir css/site-header.css) --- */
.top-nav:not(.ir-header) { 
    height: 50px; background: var(--panel); border-bottom: 1px solid var(--border); 
    display: flex; align-items: center; justify-content: space-between; padding: 0 10px; 
    z-index: 200; flex-shrink: 0; padding-top: env(safe-area-inset-top);
}
.nav-logo { font-family: 'Rajdhani'; font-weight: 900; font-size: 1.1rem; color: #fff; cursor: pointer; white-space: nowrap; }
.nav-logo span { color: var(--cyan); }
.nav-group { display: flex; align-items: center; gap: 5px; border-right: 1px solid #333; padding-right: 10px; margin-right: 5px; }
.nav-label { color: #666; font-size: 0.7rem; text-transform: uppercase; display: none; }

/* Boutons Header */
.header-btn { background: transparent; border: 1px solid var(--cyan); color: var(--cyan); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; cursor: pointer; border-radius: 4px; margin-left: 5px; z-index: 201; }
#auth-status { font-size: 0.7rem; color: #666; white-space: nowrap; display: none; margin-right: 5px; }

/* --- MAIN LAYOUT --- */
.editor-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
    height: calc(100dvh - var(--ir-header-h, 56px) - env(safe-area-inset-top, 0px));
}
.main-layout { 
    display: flex; 
    flex: 1; 
    position: relative; 
    overflow: hidden; 
    width: 100%; 
    min-width: 0;
    height: 100%;
}

/* --- TOOLBAR --- */
.toolbar { background: var(--panel); z-index: 100; flex-shrink: 0; display: flex; align-items: center; }
.tools-grid { display: grid; gap: 6px; padding: 5px; }
.tool-icon { width: 40px; height: 40px; background: #181818; border: 1px solid #444; color: #888; cursor: pointer; display: flex; justify-content: center; align-items: center; border-radius: 4px; font-size: 1.1rem; transition: 0.2s; position: relative; flex-shrink: 0; }
.tool-icon.active { background: var(--cyan); color: #000; box-shadow: 0 0 10px var(--cyan); border-color: var(--cyan); }
.separator { background: #333; flex-shrink: 0; }
.toolbar-toggle-btn { display: none; } /* Caché par défaut (PC) */

/* --- WORKSPACE --- */
.workspace { 
    flex: 1; 
    position: relative; 
    background-color: #080808; 
    background-image: radial-gradient(#222 1px, transparent 1px); 
    background-size: 20px 20px; 
    overflow: hidden; 
    z-index: 50; 
    width: 100%;
    min-height: 0;
}

.canvas-wrapper { 
    width: 100%; height: 100%; position: absolute; top: 0; left: 0; box-shadow: none; border: none; transform: none !important; 
}

/* Onglets pièces (Ouies / Plaque avant / …) — bandeau haut workspace */
.ir-piece-tabs {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 520;
    height: 40px;
    background: linear-gradient(180deg, rgba(8, 8, 8, 0.96) 0%, rgba(8, 8, 8, 0.82) 70%, transparent 100%);
    border-bottom: 1px solid rgba(0, 242, 255, 0.18);
    pointer-events: none;
}
.ir-piece-tabs.is-visible {
    display: block;
    pointer-events: auto;
}
.ir-piece-tabs-track {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 4px;
    height: 100%;
    padding: 6px 12px 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.ir-piece-tabs-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    height: 100%;
}
.ir-piece-tabs-close-all,
.ir-piece-tabs-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px 6px 0 0;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}
.ir-piece-tabs-close-all {
    border: 1px solid #3a3a3a;
    background: #161616;
    color: #c8c8c8;
}
.ir-piece-tabs-close-all:hover {
    background: #222;
    border-color: #888;
    color: #fff;
}
.ir-piece-tabs-clear {
    border: 1px solid #5a4010;
    background: #1a1408;
    color: #ffb020;
}
.ir-piece-tabs-clear:hover {
    background: #2a1e0a;
    border-color: #ffb020;
    color: #ffd060;
}
.ir-piece-tabs-close-all i,
.ir-piece-tabs-clear i { font-size: 0.78rem; }
.ir-piece-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 200px;
    height: 30px;
    padding: 0 8px 0 14px;
    margin: 0;
    border: 1px solid #2a2a2a;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: #141414;
    color: #9a9a9a;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ir-piece-tab:focus {
    outline: none;
}
.ir-piece-tab:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(0, 242, 255, 0.55);
}
.ir-piece-tab:hover {
    color: #e8e8e8;
    border-color: #3a3a3a;
    background: #1a1a1a;
}
.ir-piece-tab.is-active {
    color: #0a0a0a;
    background: var(--cyan, #00f2ff);
    border-color: var(--cyan, #00f2ff);
}
.ir-piece-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ir-piece-tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffc107;
    flex-shrink: 0;
}
.ir-piece-tab.is-active .ir-piece-tab-dot {
    background: #0a0a0a;
}
.ir-piece-tab-close {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.55;
    pointer-events: auto;
}
.ir-piece-tab-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    color: #ff6b6b;
}
.ir-piece-tab.is-active .ir-piece-tab-close:hover {
    background: rgba(0, 0, 0, 0.18);
    color: #7a0000;
}
body.ir-has-piece-tabs .canvas-wrapper {
    top: 36px;
    height: calc(100% - 36px);
}

/* Help Bar */
#help-bar { 
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); 
    background: rgba(0, 0, 0, 0.9); border: 1px solid var(--cyan); color: var(--cyan); 
    padding: 5px 15px; font-size: 0.75rem; border-radius: 20px; pointer-events: none; 
    white-space: nowrap; z-index: 500; transition: opacity 0.3s; 
}

/* --- SIDEBAR BASE --- */
.sidebar { 
    background: var(--panel); 
    border-left: 1px solid var(--border); 
    display: flex; flex-direction: column; 
    z-index: 1000; 
    background: #111; 
    /* La position/taille est définie dans les Media Queries plus bas */
}
.sidebar-header { padding: 10px 15px; font-family:'Rajdhani'; font-weight:900; font-size:1.2rem; color:#fff; border-bottom:1px solid #333; display:flex; justify-content:space-between; align-items:center; }
.sidebar-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}
.sidebar-header .header-btn.header-btn-text {
    width: auto;
    min-height: 30px;
    height: auto;
    padding: 4px 8px;
    font-size: 0.72rem;
    line-height: 1.1;
    white-space: nowrap;
    margin-left: 0;
    flex: 0 1 auto;
}
.sidebar-header-link {
    font-size: 0.68rem;
    color: #777;
    text-decoration: none;
    white-space: nowrap;
}
.sidebar-header-link:hover { color: #b6c5d1; }
.sidebar-zone-label {
    padding: 8px 10px 6px;
    color: #6f8797;
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-top: 1px solid #1e2a32;
    border-bottom: 1px dashed #26343e;
    background: #0f1216;
}
.sidebar-zone-label[data-zone="top"] {
    border-top: 0;
    background: #11161b;
}
.sidebar-pinned-tools {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #111;
    border-bottom: 1px solid #22313b;
    padding: 6px 6px 5px;
}
.ir-pinned-top-account {
    position: sticky;
    top: 0;
    z-index: 22;
    background: #111;
}
.ir-pinned-top-library {
    position: sticky;
    top: var(--ir-pinned-lib-top, 92px);
    z-index: 21;
    background: #111;
    padding-top: 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid #232f38;
}
.library-open-btn {
    width: calc(100% - 12px);
    margin: 8px 6px 6px;
    background: #16212a;
    border: 1px solid #3f7fa5;
    color: #bde7ff;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.library-open-btn-fixed {
    width: 100%;
    margin: 0;
}
.library-open-btn:hover {
    background: #1d2f3d;
    border-color: #63a8d1;
}
.sidebar-content {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* --- SECTIONS PROJETS --- */
.project-group { background: #1a1a1a; border: 1px solid #333; margin-bottom: 5px; border-radius: 4px; overflow: hidden; text-align: left; }
.group-header { padding: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: #222; }
.group-title { font-weight: bold; color: var(--cyan); font-size: 0.8rem; }
.group-content { display: none; background: #000; border-top: 1px solid #333; }
.group-content.open { display: block; }
.file-item-sub { padding: 8px; border-bottom: 1px dashed #222; display: flex; align-items: center; font-size: 0.8rem; color: #aaa; cursor: pointer; }
.file-item-sub:hover { background: #222; color: #fff; }

/* --- GRILLES & MODES D'AFFICHAGE --- */
#template-view-toggles.view-toggles {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}
.view-toggles { display: flex; justify-content: flex-end; padding: 0 5px 10px 5px; gap: 5px; max-width: 100%; box-sizing: border-box; }
.view-btn { background: #222; border: 1px solid #444; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px; fill: #666; }
.view-btn.active { background: var(--cyan); border-color: var(--cyan); fill: #000; }
.view-btn svg { pointer-events: none; display: block; }

/* Conteneurs Logique */
#logo-grid, #template-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}
#library-section, #body-lib {
    overflow-x: hidden;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#body-lib {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 42vh;
}

.library-filters {
    padding: 10px 10px 4px;
    border-bottom: 1px solid #222;
    margin-bottom: 6px;
}
.lib-filter-row {
    margin-bottom: 8px;
}
.lib-filter-row label {
    display: block;
    color: var(--cyan);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.lib-select {
    width: 100%;
    box-sizing: border-box;
    background: #000;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
}
.lib-search-input {
    width: 100%;
    box-sizing: border-box;
    background: #000;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 10px;
    margin-top: 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
}
.tpl-card .tpl-cat {
    font-size: 0.55rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tpl-search-empty {
    padding: 16px 10px;
    text-align: center;
    color: #888;
    font-size: 0.75rem;
}
#body-lib .grid-2col,
#body-lib .grid-4col,
#body-lib .grid-list,
#body-lib .grid-1col {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Grilles */
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; width: 100%; }
.grid-2col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
#body-lib .grid-2col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
#body-lib .grid-4col {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.grid-1col {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Logos */
.grid-3col .logo-thumb { height: 60px; width: 100%; object-fit: contain; background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 50% / 12px 12px; border: 1px solid #333; border-radius: 4px; cursor: pointer; padding: 5px; }
.grid-1col .logo-thumb { height: auto; width: 100%; max-height: 100px; object-fit: contain; background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 50% / 12px 12px; border: 1px solid #333; border-radius: 4px; cursor: pointer; padding: 5px; margin-bottom: 5px; }
.logo-item { min-width: 0; }
.logo-label {
    color: #9ab; font-size: 0.65rem; line-height: 1.25; margin-top: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.logo-item--list {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0; border-bottom: 1px solid #222;
}
.logo-item--list .logo-thumb {
    width: 72px; max-width: 72px; height: 48px; max-height: 48px;
    flex-shrink: 0; margin-bottom: 0;
}
.logo-item--list .logo-label {
    flex: 1; min-width: 0; text-align: left; font-size: 0.78rem; color: #ccc;
}

/* Templates */
.tpl-card {
    position: relative;
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 5px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    transition: 0.2s;
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: 110px 130px;
}
.tpl-card:hover { border-color: var(--cyan); background: #222; }
.tpl-card.active { border-color: var(--cyan); box-shadow: 0 0 8px rgba(0, 242, 255, 0.35); background: #222; }
.tpl-card.is-multi {
    border-color: #ffb020;
    box-shadow: 0 0 10px rgba(255, 176, 32, 0.4);
    background: #2a2210;
}
.tpl-card.is-multi::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffb020;
    color: #111;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.ir-multi-piece-bar {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 100050;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(12, 12, 12, 0.94);
    border: 1px solid #5a4010;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    font-family: 'Rajdhani', sans-serif;
}
.ir-multi-piece-bar.is-visible { display: flex; }
.ir-multi-piece-bar-label {
    color: #ffb020;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ir-multi-piece-bar-hint {
    color: #888;
    font-size: 0.75rem;
    white-space: nowrap;
}
.ir-multi-piece-bar .btn-mini {
    padding: 6px 10px;
    font-size: 0.78rem;
}
.tpl-card img {
    width: 100%;
    max-width: 100%;
    height: 60px;
    object-fit: contain;
    margin-bottom: 5px;
}
.tpl-card span,
.tpl-card .tpl-name,
.tpl-card .price-tag {
    font-size: 0.65rem;
    color: #fff;
    display: block;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.tpl-card .price-tag {
    font-size: 0.6rem;
    margin-top: 4px;
    padding-top: 3px;
    border-top: 1px solid #222;
}
.tpl-piece-badge {
    display: inline-block;
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    margin: 2px 0 4px;
    border: 1px solid #3d7fa1;
    color: #bde7ff;
    background: #183244;
    border-radius: 3px;
    font-family: 'Share Tech Mono', monospace;
}
.tpl-kit-badge {
    border-color: #8a7340;
    color: #ffe7b0;
    background: #2a2418;
}
.tpl-pair-badge {
    border-color: #6a4a9a;
    color: #e8d4ff;
    background: #241833;
}
.tpl-card-pair {
    border-color: #4a3a6a;
}
.tpl-3d-badge {
    border-color: #3d8a6a;
    color: #b8ffe0;
    background: #142820;
    margin-left: 4px;
}
.tpl-card-piece {
    border-color: #2a4a5a;
}
.tpl-card.is-loading {
    opacity: 0.65;
    pointer-events: none;
    outline: 1px solid #3d7fa1;
}
.tpl-card-kit .tpl-name {
    color: #cfefff;
}
.ir-pieces-folder-bar {
    display: none;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    padding: 8px 10px;
    background: #141a1e;
    border: 1px solid #2a3a44;
}
.ir-pieces-folder-back {
    cursor: pointer;
    border: 1px solid #3d7fa1;
    background: #183244;
    color: #bde7ff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    padding: 6px 10px;
}
.ir-pieces-folder-back:hover {
    background: #1f4256;
}
.ir-pieces-folder-title {
    color: #9ab;
    font-size: 0.75rem;
    font-family: 'Share Tech Mono', monospace;
}

/* Vue 3D gabarit (haut gauche) */
.ir-3d-preview {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 420;
    width: min(320px, 42vw);
    height: min(220px, 34vh);
    display: none;
    flex-direction: column;
    background: rgba(8, 12, 16, 0.94);
    border: 1px solid #2a4a5a;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    pointer-events: auto;
    box-sizing: border-box;
}
.ir-3d-preview.is-user-sized {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
}
.ir-3d-preview.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: none;
    /* Au-dessus du header site (10000) + dock outils */
    z-index: 12050;
}
/* Pendant plein écran 3D : ne pas laisser header / dock passer devant */
body.ir-3d-fullscreen .ir-header,
body.ir-3d-fullscreen .top-nav.ir-header {
    z-index: 12040;
    pointer-events: none;
    opacity: 0;
}
body.ir-3d-fullscreen #ir-detached-sections-host {
    z-index: 12030;
    pointer-events: none;
}
body.ir-3d-fullscreen .ir-detached-panel.ir-constructor-dock {
    opacity: 0;
    pointer-events: none;
}
.ir-3d-preview.is-fullscreen .ir-3d-resize-handle {
    display: none !important;
}
.ir-3d-preview.is-fullscreen .ir-3d-preview-head {
    position: relative;
    z-index: 12;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    cursor: default;
    touch-action: manipulation;
    background: rgba(12, 18, 24, 0.96);
}
.ir-3d-preview.is-fullscreen .ir-3d-preview-actions {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
/* En plein écran : RÉDUIRE dans le head (pas de bouton flottant par-dessus) */
.ir-3d-preview.is-fullscreen #ir-3d-fs {
    display: none !important;
}
.ir-3d-fs-exit {
    display: none !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: static;
    min-width: 0;
    height: 26px;
    padding: 0 10px;
    border: 1px solid #8ed0ff;
    background: #2a6a8a;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    border-radius: 4px;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: none;
    flex-shrink: 0;
}
.ir-3d-preview.is-fullscreen .ir-3d-fs-exit {
    display: inline-flex !important;
    height: 40px;
    min-width: 44px;
    font-size: 0.85rem;
    font-weight: 700;
}
.ir-3d-preview-head {
    position: relative;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: #12181e;
    border-bottom: 1px solid #243038;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    touch-action: none;
}
.ir-3d-preview-head .ir-3d-btn,
.ir-3d-preview-head button {
    touch-action: manipulation;
}
/* Actions header 3D : tous les boutons alignés + menus au-dessus du canvas */
.ir-3d-preview-actions {
    position: relative;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 26px;
}
.ir-3d-preview-actions > .ir-3d-btn,
.ir-3d-preview-actions > .ir-3d-colors-wrap,
.ir-3d-preview-actions > .ir-3d-scene-wrap,
.ir-3d-preview-actions > .ir-3d-view-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 26px;
    vertical-align: middle;
}
.ir-3d-preview-actions .ir-3d-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 26px;
    min-height: 26px;
    line-height: 1;
    padding: 0 6px;
    margin: 0;
}
.ir-3d-preview-actions .ir-3d-btn i {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ir-3d-scene-menu,
.ir-3d-colors-menu,
.ir-3d-view-menu {
    pointer-events: auto;
}
.ir-3d-scene-menu input,
.ir-3d-scene-menu select,
.ir-3d-colors-menu input,
.ir-3d-colors-menu select,
.ir-3d-view-menu button {
    pointer-events: auto;
    touch-action: manipulation;
}
/* Poignées resize type fenêtre Windows */
.ir-3d-resize-handle {
    position: absolute;
    z-index: 5;
    background: transparent;
}
.ir-3d-resize-n, .ir-3d-resize-s {
    left: 8px; right: 8px; height: 6px;
}
.ir-3d-resize-n { top: 0; cursor: ns-resize; }
.ir-3d-resize-s { bottom: 0; cursor: ns-resize; }
.ir-3d-resize-e, .ir-3d-resize-w {
    top: 8px; bottom: 8px; width: 6px;
}
.ir-3d-resize-e { right: 0; cursor: ew-resize; }
.ir-3d-resize-w { left: 0; cursor: ew-resize; }
.ir-3d-resize-ne, .ir-3d-resize-nw,
.ir-3d-resize-se, .ir-3d-resize-sw {
    width: 12px; height: 12px;
}
.ir-3d-resize-ne { top: 0; right: 0; cursor: nesw-resize; }
.ir-3d-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.ir-3d-resize-se { bottom: 0; right: 0; cursor: nwse-resize; }
.ir-3d-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.ir-3d-resize-se::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(142, 208, 255, 0.55);
    border-bottom: 2px solid rgba(142, 208, 255, 0.55);
    pointer-events: none;
}
body.ir-3d-resizing,
body.ir-3d-resizing * {
    cursor: inherit !important;
    user-select: none !important;
}
.ir-3d-preview-title {
    color: #8ed0ff;
    font-size: 0.72rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
}
.ir-3d-btn {
    cursor: pointer;
    border: 1px solid #3d7fa1;
    background: #183244;
    color: #bde7ff;
    font-size: 0.7rem;
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    font-family: 'Share Tech Mono', monospace;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ir-3d-btn:hover { background: #1f4256; }
#ir-toggle-3d.active {
    color: #8ed0ff;
    border-color: #3d7fa1;
    background: #183244;
}
#ir-toggle-3d.ir-3d-available {
    color: #8ed0ff;
    border-color: #3d7fa1;
    box-shadow: 0 0 0 1px rgba(62, 160, 210, 0.45);
}
/* Bouton flottant : réafficher la 3D après fermeture (✕) */
.ir-3d-reopen {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 421;
    display: none;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #3d7fa1;
    background: rgba(18, 40, 54, 0.96);
    color: #bde7ff;
    font-size: 0.72rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ir-3d-reopen:hover {
    background: #1f4256;
}
.ir-3d-reopen.is-pulse {
    animation: ir3d-reopen-pulse 1.6s ease-in-out 2;
}
@keyframes ir3d-reopen-pulse {
    0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
    50% { box-shadow: 0 0 0 3px rgba(100, 190, 240, 0.35), 0 6px 18px rgba(0, 0, 0, 0.45); }
}
.ir-3d-preview-body {
    position: relative;
    flex: 1;
    min-height: 0;
}
.ir-3d-preview-body canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
.ir-3d-preview-status {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 16, 0.55);
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.ir-3d-preview-status[hidden] {
    display: none !important;
}
.ir-3d-preview-status.is-ready {
    background: rgba(8, 12, 16, 0.28);
}
.ir-3d-preview-status.is-error {
    background: rgba(40, 10, 10, 0.62);
}
.ir-3d-loader {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #3d7fa1;
    background: rgba(12, 20, 28, 0.92);
    color: #cfefff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    border-radius: 6px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
.ir-3d-loader i {
    color: #8ed0ff;
    font-size: 0.95rem;
}
.ir-3d-preview-status.is-ready .ir-3d-loader i {
    display: none;
}
.ir-3d-preview-status.is-error .ir-3d-loader {
    border-color: #a05050;
    color: #ffd0d0;
}
.ir-3d-preview-status.is-error .ir-3d-loader i {
    display: none;
}
.ir-3d-preview-foot,
.ir-3d-foot-info {
    display: none !important;
}

/* Barre vinyle / laminat — visible uniquement en plein écran 3D */
.ir-3d-finish-bar {
    display: none;
    flex-shrink: 0;
    z-index: 14;
    pointer-events: auto;
    background: linear-gradient(180deg, rgba(10, 14, 18, 0.72) 0%, rgba(8, 12, 16, 0.96) 35%, #0a1016 100%);
    border-top: 1px solid #2a3a48;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
.ir-3d-preview.is-fullscreen .ir-3d-finish-bar.is-visible,
.ir-3d-preview.is-fullscreen .ir-3d-finish-bar:not([hidden]) {
    display: block;
}
.ir-3d-finish-bar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.ir-3d-finish-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.ir-3d-finish-label {
    flex: 0 0 auto;
    min-width: 72px;
    color: #8ed0ff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ir-3d-finish-label i {
    margin-right: 4px;
    opacity: 0.85;
}
.ir-3d-finish-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #3a5568 transparent;
    padding: 2px 0 4px;
    min-width: 0;
    flex: 1;
}
.ir-3d-finish-chips::-webkit-scrollbar {
    height: 4px;
}
.ir-3d-finish-chips::-webkit-scrollbar-thumb {
    background: #3a5568;
    border-radius: 2px;
}
.ir-3d-finish-chip {
    flex: 0 0 auto;
    appearance: none;
    border: 1px solid #3a4e5e;
    background: #152028;
    color: #d5e4ef;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    padding: 7px 11px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ir-3d-finish-chip:hover {
    border-color: #7ec8ef;
    color: #fff;
}
.ir-3d-finish-chip.is-active {
    border-color: #8ed0ff;
    background: #1f4256;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(142, 208, 255, 0.28) inset;
}
.ir-3d-finish-chip--oos,
.ir-3d-finish-chip--oos:hover {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: #5a3a40;
    color: #c9a0a6;
}
.ir-3d-finish-empty {
    color: #667788;
    font-size: 0.68rem;
    font-family: 'Share Tech Mono', monospace;
    padding: 6px 2px;
}
.ir-3d-finish-meta {
    color: #7a8a99;
    font-size: 0.64rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.03em;
    min-height: 1em;
    padding-left: 2px;
}
.ir-3d-colors-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
}
.ir-3d-colors-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 34px;
    height: 26px;
}
.ir-3d-colors-toggle-swatches {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.ir-3d-colors-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    border: 1px solid rgba(255,255,255,0.4);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}
.ir-3d-colors-wrap.is-open .ir-3d-colors-toggle {
    background: #1f4256;
    border-color: #8ed0ff;
}
.ir-3d-colors-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 168px;
    padding: 8px;
    background: #0f161c;
    border: 1px solid #3d7fa1;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ir-3d-colors-menu[hidden] {
    display: none !important;
}
.ir-3d-plastic-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.ir-3d-plastic-label {
    color: #7ab;
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    min-width: 52px;
    font-family: 'Share Tech Mono', monospace;
}
.ir-3d-plastic-pick {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid #3d7fa1;
    background: #142830;
    color: #cfefff;
    cursor: pointer;
}
.ir-3d-plastic-pick:hover { background: #1a3644; }
.ir-3d-plastic-swatch {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255,255,255,0.35);
    background: #fff;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}
.ir-3d-plastic-reset {
    min-width: 24px;
    height: 26px;
    padding: 0;
    flex-shrink: 0;
    visibility: hidden;
}
/* Sol & éclairage 3D */
.ir-3d-scene-wrap,
.ir-3d-view-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
}
.ir-3d-scene-toggle,
.ir-3d-view-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 26px;
    min-width: 28px;
}
.ir-3d-scene-wrap.is-open .ir-3d-scene-toggle,
.ir-3d-view-wrap.is-open .ir-3d-view-toggle {
    background: #1f4256;
    border-color: #8ed0ff;
}
.ir-3d-view-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 22;
    width: min(260px, calc(100vw - 16px));
    max-height: min(70vh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    background: #0f161c;
    border: 1px solid #3d7fa1;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}
.ir-3d-view-menu[hidden] { display: none !important; }
.ir-3d-view-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.ir-3d-view-chip {
    min-height: 36px;
    border: 1px solid #2e4a5a;
    background: #142028;
    color: #cfefff;
    border-radius: 8px;
    font-size: 0.66rem;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 4px;
}
.ir-3d-view-chip:hover { border-color: #8ed0ff; }
.ir-3d-view-chip.is-active {
    border-color: #3fa9f5;
    background: #163041;
    color: #fff;
}
.ir-3d-view-chip-wide {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
}
.ir-3d-view-chip-spin {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border-color: #3d7fa1;
    color: #9fefff;
}
.ir-3d-view-chip-wide.is-active,
.ir-3d-view-chip-spin.is-active {
    border-color: #00f2ff;
    background: #0d2830;
    color: #9fefff;
}
.ir-3d-view-chip-wide .fa-sync-alt,
.ir-3d-view-chip-spin .fa-sync-alt {
    animation: none;
}
.ir-3d-view-chip-wide.is-active .fa-sync-alt,
.ir-3d-view-chip-spin.is-active .fa-sync-alt {
    animation: ir-3d-spin-icon 1.2s linear infinite;
}
.ir-3d-view-spin-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@keyframes ir-3d-spin-icon {
    to { transform: rotate(360deg); }
}
.ir-3d-view-rotate-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ir-3d-view-rotate-row .ir-3d-scene-mini { flex: 1; }
.ir-3d-scene-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 22;
    width: min(300px, calc(100vw - 16px));
    max-height: min(72vh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    background: #0f161c;
    border: 1px solid #3d7fa1;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}
/* Menu scène type GXS Racing (panel LED / Sol PVC) */
.ir-3d-scene-menu--gxs {
    min-width: 12.5rem;
    max-width: min(19rem, calc(100vw - 1.2rem));
    width: min(19rem, calc(100vw - 1.2rem));
    padding: 0.55rem 0.65rem 0.7rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(14, 17, 22, 0.95);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    gap: 0.35rem;
    overscroll-behavior: contain;
}
.ir-3d-scene-menu--gxs .ir-3d-scene-menu-head {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    margin-bottom: 0.15rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ir-3d-gxs-label {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin: 0.45rem 0 0.3rem;
}
.ir-3d-gxs-sublabel {
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
    margin: 0.2rem 0 0.2rem;
}
.ir-3d-gxs-sublabel i {
    font-style: normal;
    color: #00d2be;
    margin-left: 0.25rem;
}
.ir-3d-gxs-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem;
    margin-bottom: 0.35rem;
}
.ir-3d-gxs-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.4rem;
}
.ir-3d-gxs-chip {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #161a20;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-family: inherit;
    line-height: 1.2;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ir-3d-gxs-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.ir-3d-gxs-chip:hover,
.ir-3d-gxs-chip.is-active,
.ir-3d-gxs-chip:has(input[type="checkbox"]:checked) {
    border-color: #00d2be;
    color: #00d2be;
    background: rgba(0, 210, 190, 0.1);
}
.ir-3d-gxs-chip--action {
    border-color: rgba(0, 210, 190, 0.45);
    color: #00d2be;
    background: rgba(0, 210, 190, 0.12);
    font-weight: 600;
}
.ir-3d-gxs-swatch {
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: transparent;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.ir-3d-gxs-swatch:hover {
    border-color: #00d2be;
    box-shadow: 0 0 0 2px rgba(0, 210, 190, 0.25);
}
.ir-3d-gxs-hidden,
.ir-3d-scene-menu--gxs .ir-3d-scene-select[hidden] {
    display: none !important;
}
.ir-3d-scene-menu--gxs .ir-3d-neon-controls {
    margin-top: 0.25rem;
    padding-top: 0.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.ir-3d-scene-menu--gxs .ir-3d-scene-hint {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.56rem;
    letter-spacing: 0.02em;
}
.ir-3d-scene-menu--gxs input[type="range"] {
    width: 100%;
    height: 1.4rem;
    accent-color: #00d2be;
}
.ir-3d-scene-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #8ed0ff;
    font-size: 0.72rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-bottom: 2px;
}
.ir-3d-scene-close {
    border: 1px solid #3a5566;
    background: #152028;
    color: #cfefff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}
.ir-3d-scene-close:hover { border-color: #8ed0ff; color: #fff; }
.ir-3d-scene-section { display: flex; flex-direction: column; gap: 6px; }
.ir-3d-scene-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.ir-3d-scene-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 8px;
    background: #142028;
    border: 1px solid #2e4a5a;
    border-radius: 8px;
    color: #cfefff;
    font-size: 0.68rem;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}
.ir-3d-scene-chip:has(input[type="checkbox"]:checked) {
    border-color: #3fa9f5;
    background: #163041;
}
.ir-3d-scene-chip > span,
.ir-3d-scene-chip-main > span { flex: 1; min-width: 0; }
.ir-3d-scene-chip-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
.ir-3d-scene-chip input[type="checkbox"] {
    accent-color: #3fa9f5;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.ir-3d-scene-chip input[type="color"] {
    width: 26px;
    height: 22px;
    padding: 0;
    border: 1px solid #3d7fa1;
    background: #0d151a;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.ir-3d-scene-chip:has(#ir-3d-ground-toggle:checked),
.ir-3d-scene-chip:has(#ir-3d-scrim-toggle:checked) {
    border-color: #3fa9f5;
    background: #163041;
}
.ir-3d-scene-details {
    border: 1px solid #2a4050;
    border-radius: 8px;
    background: #121a20;
    overflow: hidden;
}
.ir-3d-scene-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 10px;
    color: #8ed0ff;
    font-size: 0.7rem;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ir-3d-scene-details > summary::-webkit-details-marker { display: none; }
.ir-3d-scene-details > summary::after {
    content: '▾';
    color: #6a8a9a;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}
.ir-3d-scene-details:not([open]) > summary::after {
    transform: rotate(-90deg);
}
.ir-3d-scene-details-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 10px;
}
.ir-3d-scene-sep {
    height: 1px;
    background: #2a4050;
    margin: 2px 0;
}
.ir-3d-neon-controls {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #2a3a48;
}
.ir-3d-neon-controls[hidden] {
    display: none !important;
}
.ir-3d-scene-hint {
    margin: 0;
    font-size: 0.58rem;
    color: #6a8a9a;
    font-family: 'Share Tech Mono', monospace;
    line-height: 1.25;
}
.ir-3d-scene-mini {
    height: 28px !important;
    min-width: auto !important;
    padding: 0 8px !important;
    font-size: 0.62rem !important;
}
#ir-3d-overhead-color {
    width: 34px;
    height: 28px;
    padding: 0;
    border: 1px solid #3d7fa1;
    background: #142830;
    cursor: pointer;
    flex-shrink: 0;
}
#ir-3d-light-intensity,
#ir-3d-overhead-intensity,
#ir-3d-overhead-x,
#ir-3d-overhead-y,
#ir-3d-overhead-z {
    width: 100%;
    height: 28px;
    accent-color: #3fa9f5;
}
#ir-3d-overhead-intensity,
#ir-3d-overhead-x,
#ir-3d-overhead-y,
#ir-3d-overhead-z {
    accent-color: #f5c84a;
}
.ir-3d-scene-menu[hidden] {
    display: none !important;
}
.ir-3d-scene-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.ir-3d-scene-row--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.ir-3d-scene-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #cfefff;
    font-size: 0.68rem;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    flex: 1;
}
.ir-3d-scene-check input {
    accent-color: #3fa9f5;
}
.ir-3d-scene-select {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 34px;
    background: #142830;
    border: 1px solid #3d7fa1;
    color: #cfefff;
    font-size: 0.72rem;
    font-family: 'Share Tech Mono', monospace;
    padding: 0 8px;
    border-radius: 6px;
}
#ir-3d-ground-color,
#ir-3d-scrim-color {
    width: 26px;
    height: 22px;
    padding: 0;
    border: 1px solid #3d7fa1;
    background: #142830;
    cursor: pointer;
}
#ir-3d-light-intensity {
    width: 100%;
    accent-color: #3fa9f5;
}
#ir-3d-light-inten-val {
    font-style: normal;
    color: #8ed0ff;
    margin-left: 4px;
}
/* ——— Vue 3D responsive mobile ——— */
@media (max-width: 900px) {
    .ir-3d-preview:not(.is-fullscreen):not(.is-user-sized) {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: min(42dvh, 320px);
        min-height: 180px;
        max-height: calc(100% - 48px);
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid #3d7fa1;
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .ir-3d-preview:not(.is-fullscreen).is-user-sized {
        border-top: 1px solid #3d7fa1;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
        padding-bottom: 0;
    }
    .ir-3d-preview.is-fullscreen {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        padding-top: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
        z-index: 12050;
    }
    .ir-3d-preview.is-fullscreen .ir-3d-fs-exit {
        position: static;
        min-width: 110px;
        height: 40px;
        min-height: 40px;
        font-size: 0.85rem;
        font-weight: 700;
    }
    .ir-3d-preview.is-fullscreen .ir-3d-preview-head {
        z-index: 12;
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .ir-3d-preview-head {
        padding: 8px 10px;
        gap: 6px;
    }
    .ir-3d-preview-title {
        font-size: 0.78rem;
    }
    .ir-3d-preview-actions {
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        min-height: 34px;
    }
    .ir-3d-preview-actions > .ir-3d-btn,
    .ir-3d-preview-actions > .ir-3d-colors-wrap,
    .ir-3d-preview-actions > .ir-3d-scene-wrap,
    .ir-3d-preview-actions > .ir-3d-view-wrap,
    .ir-3d-preview-actions .ir-3d-btn,
    .ir-3d-colors-wrap,
    .ir-3d-scene-wrap,
    .ir-3d-view-wrap,
    .ir-3d-colors-toggle,
    .ir-3d-scene-toggle,
    .ir-3d-view-toggle {
        height: 34px;
        min-height: 34px;
    }
    .ir-3d-btn {
        min-width: 36px;
        height: 34px;
        font-size: 0.8rem;
        padding: 0 8px;
        touch-action: manipulation;
    }
    .ir-3d-preview-foot {
        padding: 6px 10px 8px;
        gap: 6px;
    }
    .ir-3d-preview.is-fullscreen .ir-3d-finish-bar {
        padding: 8px 10px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .ir-3d-finish-label {
        min-width: 64px;
        font-size: 0.62rem;
    }
    .ir-3d-finish-chip {
        padding: 8px 12px;
        font-size: 0.7rem;
        min-height: 36px;
    }
    .ir-3d-plastic-pick {
        height: 32px;
        font-size: 0.7rem;
    }
    .ir-3d-plastic-reset {
        min-width: 34px;
        height: 32px;
    }
    .ir-3d-plastic-label {
        min-width: 58px;
        font-size: 0.68rem;
    }
    .ir-3d-reopen {
        top: auto;
        left: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        height: 40px;
        padding: 0 14px;
        font-size: 0.78rem;
        touch-action: manipulation;
    }
    /* Menus 3D : bottom-sheet (souvent montés sur body pour éviter overflow:hidden) */
    .ir-3d-scene-menu,
    .ir-3d-view-menu,
    .ir-3d-colors-menu,
    .ir-3d-menu-sheet {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto !important;
        width: 100%;
        max-width: none;
        max-height: min(78dvh, 640px);
        z-index: 13000;
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
        gap: 10px;
        border-radius: 16px 16px 0 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
    }
    .ir-3d-view-menu,
    .ir-3d-colors-menu {
        max-height: min(70dvh, 560px);
    }
    .ir-3d-scene-menu[hidden],
    .ir-3d-view-menu[hidden],
    .ir-3d-colors-menu[hidden] {
        display: none !important;
    }
    .ir-3d-colors-menu .ir-3d-plastic-pick {
        min-height: 40px;
    }
    .ir-3d-gxs-swatch,
    .ir-3d-scene-chip > input[type="color"],
    .ir-3d-scene-menu input[type="color"] {
        width: 40px;
        height: 40px;
        min-width: 40px;
        pointer-events: auto;
        touch-action: manipulation;
    }
    .ir-3d-scene-menu--gxs {
        width: 100%;
        max-width: none;
        padding: 0.7rem 0.75rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
        border-radius: 16px 16px 0 0;
        gap: 0.4rem;
    }
    .ir-3d-gxs-chip {
        min-height: 36px;
        padding: 0.4rem 0.7rem;
        font-size: 0.68rem;
    }
    .ir-3d-scene-menu--gxs .ir-3d-scene-menu-head {
        background: transparent;
        position: sticky;
        top: 0;
        z-index: 1;
    }
    .ir-3d-view-chip {
        min-height: 44px;
        font-size: 0.74rem;
    }
    .ir-3d-scene-menu-head {
        font-size: 0.78rem;
        position: sticky;
        top: 0;
        background: #0f161c;
        z-index: 1;
        padding-bottom: 6px;
    }
    .ir-3d-scene-close {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    .ir-3d-scene-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .ir-3d-scene-chip {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 0.74rem;
        gap: 8px;
    }
    .ir-3d-scene-chip > input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    .ir-3d-scene-details > summary {
        min-height: 44px;
        padding: 12px;
        font-size: 0.76rem;
    }
    .ir-3d-scene-details-body {
        padding: 0 12px 12px;
        gap: 10px;
    }
    .ir-3d-scene-select {
        height: 40px;
        font-size: 0.78rem;
    }
    #ir-3d-light-intensity,
    #ir-3d-overhead-intensity,
    #ir-3d-overhead-x,
    #ir-3d-overhead-y,
    #ir-3d-overhead-z {
        height: 36px;
    }
    .ir-3d-scene-mini {
        height: 36px !important;
        min-width: 72px !important;
        font-size: 0.72rem !important;
    }
    /* Onglets pièces visibles : remonter le bouton 3D */
    body.ir-has-piece-tabs .ir-3d-reopen {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .ir-3d-preview:not(.is-fullscreen):not(.is-user-sized) {
        top: 0;
        bottom: 0;
        left: auto;
        right: 0;
        width: min(46vw, 340px);
        height: 100%;
        min-height: 0;
        max-height: none;
        border-top: none;
        border-left: 1px solid #3d7fa1;
        border-bottom: none;
        box-shadow: -8px 0 28px rgba(0, 0, 0, 0.5);
        padding-bottom: 0;
        padding-right: env(safe-area-inset-right, 0);
    }
    .ir-3d-reopen {
        top: 10px;
        bottom: auto;
        left: auto;
        right: 10px;
    }
}

@media (max-width: 520px) {
    .ir-3d-preview:not(.is-fullscreen):not(.is-user-sized) {
        height: min(46dvh, 300px);
        min-height: 200px;
    }
    .ir-3d-foot-info {
        display: none;
    }
}

/* Empêche le panneau 3D d’être recouvert par le canvas / status */
.ir-3d-preview {
    z-index: 450;
}
.canvas-wrapper .canvas-container,
.workspace .canvas-container {
    z-index: 1;
}

/* 2 colonnes : cartes compactes, pas de débordement horizontal */
#body-lib .grid-2col .tpl-card {
    min-height: 176px;
    padding: 10px 8px;
    justify-content: flex-start;
}
#body-lib .grid-2col .tpl-card img {
    height: 122px;
    margin-bottom: 8px;
    background: #101010;
    border: 1px solid #2f2f2f;
    border-radius: 4px;
    padding: 4px;
}
#body-lib .grid-2col .tpl-card span,
#body-lib .grid-2col .tpl-card .tpl-name {
    font-size: 0.72rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.3em;
}
#body-lib .grid-2col .tpl-card .price-tag {
    font-size: 0.62rem;
    margin-top: 4px;
    padding-top: 3px;
}
#body-lib .grid-4col .tpl-card {
    min-height: 94px;
    padding: 5px 4px;
}
#body-lib .grid-4col .tpl-card img {
    height: 46px;
    margin-bottom: 4px;
}
#body-lib .grid-4col .tpl-card .tpl-name {
    font-size: 0.56rem;
}
#body-lib .grid-4col .tpl-card .price-tag {
    font-size: 0.5rem;
}

#body-lib .grid-list .tpl-card {
    flex-direction: row;
    min-height: 92px;
    padding: 8px 10px;
    text-align: left;
    justify-content: flex-start;
    gap: 10px;
}
#body-lib .grid-list .tpl-card img {
    width: 90px;
    height: 70px;
    margin: 0;
    flex-shrink: 0;
    background: #101010;
    border: 1px solid #2c2c2c;
    border-radius: 4px;
}
#body-lib .grid-list .tpl-card .tpl-name {
    font-size: 0.84rem;
    white-space: normal;
    line-height: 1.2;
}
#body-lib .grid-list .tpl-card .tpl-cat {
    font-size: 0.64rem;
}
#body-lib .grid-list .tpl-card .price-tag {
    font-size: 0.7rem;
    margin-top: 5px;
    border-top-color: #333;
}
@media (max-width: 1100px) {
    #body-lib .grid-4col {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 760px) {
    #body-lib .grid-4col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #body-lib .grid-list .tpl-card {
        min-height: 78px;
    }
    #body-lib .grid-list .tpl-card img {
        width: 72px;
        height: 56px;
    }
}

.grid-1col .tpl-card { flex-direction: row; height: 60px; min-height: 60px; padding: 0 10px; text-align: left; justify-content: flex-start; }
.grid-1col .tpl-card img { width: 40px; height: 40px; margin-bottom: 0; margin-right: 15px; flex-shrink: 0; }
.grid-1col .tpl-card span { font-size: 0.8rem; white-space: normal; }

/* --- INPUTS & BOUTONS --- */
/* FIX IOS : Font-size 16px empêche le zoom automatique */
select, button.btn, input { 
    width: 100%; 
    padding: 8px; 
    background: #000; 
    border: 1px solid #444; 
    color: #fff; 
    font-family: 'Share Tech Mono'; 
    margin-bottom: 6px; 
    border-radius: 4px; 
    font-size: 16px; 
}
.nav-select { 
    font-size: 14px; /* Plus petit dans la navbar */
    min-width: 90px; 
}

button.btn-save { background: var(--cyan); color: #000; font-weight: bold; margin-top: 10px; }

/* --- PROPRIÉTÉS & SLIDERS --- */
.prop-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 0.75rem; }
input[type="color"] { border: none; width: 40px; height: 25px; background: none; cursor: pointer; border: 1px solid #444; padding: 0; }
input[type="range"] { width: 60%; accent-color: var(--cyan); }
.sym-group { background: #1a1a1a; padding: 8px; border: 1px solid #444; border-radius: 4px; margin-bottom: 15px; }
.sym-toggle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; font-size: 0.75rem; color: #ccc; }
.sym-toggle input { accent-color: var(--cyan); width: auto; margin:0; }
.palette-swatch { width: 30px; height: 30px; border: 1px solid #555; cursor: pointer; transition: 0.2s; margin-bottom: 5px; }

/* --- GESTION DES CALQUES --- */
#layer-list { display: flex; flex-direction: column; width: 100%; padding-bottom: 60px; }
.layer-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 5px; border-bottom: 1px solid #222; font-size: 0.8rem; background: #111; color: #aaa; min-height: 44px; transition: background 0.2s; }
.layer-item:hover { background: #181818; }
.layer-item.active-layer { border-left: 3px solid var(--cyan); background: #222; color: #fff; }
.layer-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; opacity: 0.7; transition: 0.2s; }
.layer-btn:hover { opacity: 1; background-color: rgba(255,255,255,0.1); border-radius: 4px; }
.layer-name { flex: 1; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-align: left; font-weight: 500; }

/* --- ACCORDÉONS MENU --- */
.prop-group { border-bottom: 1px solid #222; margin-bottom: 5px; background: #111; border-radius: 4px; overflow: hidden; }
.prop-header { display: flex; justify-content: space-between; align-items: center; padding: 10px; cursor: pointer; background: #1a1a1a; transition: background 0.2s; }
.prop-header:hover { background: #252525; }
.prop-header span { font-family: 'Rajdhani', sans-serif; font-weight: bold; font-size: 0.85rem; color: var(--cyan); display: flex; align-items: center; gap: 8px; }
.prop-header .chevron { color: #666; font-size: 0.7rem; transition: transform 0.3s ease; }
.prop-content { padding: 10px; display: block; border-top: 1px solid #222; }
.prop-content.closed { display: none; }
.prop-header.closed .chevron { transform: rotate(-90deg); }

/* --- OUTILS PRIORITAIRES (compact Illustrator-like) --- */
#body-priority-tools.priority-tools-panel {
    padding: 8px;
    background: #0f1218;
}
#body-priority-tools .priority-group {
    margin-bottom: 8px;
    border: 1px solid #1f2a35;
    background: #121821;
    border-radius: 6px;
}
#body-priority-tools .priority-group-header {
    padding: 7px 9px;
    min-height: 30px;
    background: #18222d;
}
#body-priority-tools .priority-group-header span {
    font-size: 0.74rem;
    letter-spacing: 0.03em;
}
#body-priority-tools .priority-group-content {
    padding: 8px;
    border-top: 1px solid #233140;
}
#body-priority-tools .ir-palette-grid {
    gap: 4px;
}
#body-priority-tools .priority-logo-colors-hint {
    margin: 0 0 8px;
    color: #7a8796;
    font-size: 0.64rem;
    line-height: 1.35;
}
#body-priority-tools .priority-logo-palette .palette-btn,
#body-priority-tools .priority-logo-palette .priority-logo-swatch {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 4px;
    border: 1px solid #3a4655;
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
#body-priority-tools .priority-logo-palette .palette-btn:hover,
#body-priority-tools .priority-logo-palette .priority-logo-swatch:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px rgba(0, 242, 255, 0.35);
}
#body-priority-tools #priority-logo-colors.is-visible {
    display: block;
}
#body-priority-tools .priority-action-btn,
#body-priority-tools .priority-muted-btn {
    width: 100%;
    min-height: 30px;
    margin-top: 6px;
    font-size: 0.69rem;
    letter-spacing: 0.02em;
}
#body-priority-tools .priority-action-btn {
    background: #1a222b;
    border: 1px solid var(--cyan);
    color: var(--cyan);
}
#body-priority-tools .priority-muted-btn {
    margin-top: 7px;
    background: #171c24;
    border: 1px solid #3a4655;
    color: #c7d0dd;
}
#body-priority-tools .priority-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
}
#body-priority-tools .priority-tile-btn {
    width: 100%;
    min-height: 56px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #1b242f;
    border: 1px solid #2e3e4f;
    color: #d9e4ef;
    letter-spacing: 0.02em;
}
#body-priority-tools .priority-tile-btn i {
    font-size: 0.9rem;
    color: var(--cyan);
}
#body-priority-tools .priority-tile-btn span {
    font-size: 0.64rem;
    text-transform: uppercase;
    line-height: 1.05;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Masque : pleine largeur (sinon 5e tile hors zone / label invisible) */
#body-priority-tools #priority-toggle-mask-btn {
    grid-column: 1 / -1;
    min-height: 44px;
    flex-direction: row;
    gap: 8px;
}
#body-priority-tools #priority-toggle-mask-btn .priority-mask-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: inherit;
}
#body-priority-tools .priority-tile-btn:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px rgba(0, 242, 255, 0.18) inset;
}
#body-priority-tools .priority-tile-btn--muted {
    background: #171c24;
    border-color: #3a4655;
    color: #c7d0dd;
}
#body-priority-tools .priority-inline-row {
    gap: 6px;
    margin: 7px 0 0;
}
#body-priority-tools .priority-inline-btn {
    width: 50%;
    min-height: 30px;
    padding: 6px 7px;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    background: #1b242f;
    border: 1px solid #2e3e4f;
}
#body-priority-tools .priority-inline-btn:hover {
    border-color: var(--cyan);
}
#body-priority-tools .sym-toggle {
    font-size: 0.7rem;
    margin-bottom: 4px;
}
#body-priority-tools .priority-layer-block {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px dashed #2c3947;
}
#body-priority-tools .priority-layer-label {
    display: block;
    margin-bottom: 6px;
    color: var(--cyan);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
#body-priority-tools #layer-list {
    max-height: 210px;
    overflow-y: auto;
    padding-bottom: 10px;
    border: 1px solid #1f2a35;
    border-radius: 5px;
    background: #0e131a;
}
#body-priority-tools .priority-layer-hint {
    margin: 4px 0 0;
    font-size: 0.58rem;
    color: #667387;
    letter-spacing: 0.02em;
}

/* --- OUTILS TEXTE --- */
.text-toolbar { display: flex; gap: 5px; margin-bottom: 5px; }
.style-btn { flex: 1; background: #222; border: 1px solid #444; color: #888; height: 30px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.style-btn:hover { background: #333; color: #fff; }
.style-btn.active { background: var(--cyan); color: #000; border-color: var(--cyan); box-shadow: 0 0 5px rgba(0, 242, 255, 0.5); }

/* =========================================
   MEDIA QUERIES - VERSION MOBILE (< 900px)
   ========================================= */
@media (max-width: 900px) {
    @media (orientation: portrait) {
        #orientation-modal:not(.is-dismissed) { display: flex; }
    }
    
    .top-nav { height: calc(50px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: 10px; padding-right: 10px; }
    
    .main-layout { flex-direction: column; height: 100%; }
    .editor-shell { overflow: visible; }
    
    /* Toolbar Mobile : Horizontale */
    .toolbar { 
        order: 2; 
        width: 100vw; /* Force la largeur viewport */
        max-width: 100%;
        height: 60px; 
        padding-bottom: env(safe-area-inset-bottom); 
        border-top: 1px solid var(--cyan); 
        border-right: none; 
        flex-direction: row; 
        overflow-x: auto; /* Scroll interne */
        padding-left: 10px; 
        flex-shrink: 0; 
        -webkit-overflow-scrolling: touch;
    }
    .tools-grid { display: flex; gap: 10px; padding: 5px 0; align-items: center; }
    .separator { width: 1px; height: 30px; margin: 0 5px; }

    .workspace { order: 1; width: 100%; height: calc(100% - 60px); position: relative; }
    
    #help-bar { top: 10px; left: 10px; bottom: auto; transform: none; width: auto; font-size: 0.7rem; text-align: left; background: rgba(0,0,0,0.8); white-space: normal; max-width: 50%; }

    .sidebar-header {
        align-items: flex-start;
        gap: 6px;
        flex-shrink: 0;
    }
    .sidebar-header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .sidebar-header .header-btn.header-btn-text {
        min-height: 28px;
        padding: 4px 7px;
        font-size: 0.66rem;
        max-width: 46vw;
        white-space: normal;
        text-align: center;
    }
    #close-sidebar-btn { width: auto !important; padding: 4px 8px !important; font-size: 0.66rem; height: auto; }
    .sidebar-pinned-tools {
        flex-shrink: 0;
        position: relative;
        top: auto;
        z-index: 5;
    }

    /* SIDEBAR MOBILE : sous le header, au-dessus des overlays démarrage */
    .sidebar { 
        position: fixed; 
        top: calc(var(--ir-header-h, 56px) + env(safe-area-inset-top, 0px)); 
        right: 0; 
        width: min(94vw, 380px); 
        max-width: 100%; 
        height: calc(100dvh - var(--ir-header-h, 56px) - env(safe-area-inset-top, 0px));
        display: flex;
        flex-direction: column;
        
        /* Cacher la sidebar quand elle est fermée pour ne pas casser la largeur */
        visibility: hidden; 
        transform: translateX(100%); 
        
        /* Transition fluide mais on attend la fin du mouvement pour cacher */
        transition: transform 0.3s ease, visibility 0s linear 0.3s;
        
        z-index: 10050; 
        box-shadow: -10px 0 50px rgba(0,0,0,0.9); 
        border-left: 1px solid var(--cyan); 
        padding-top: 0; 
        pointer-events: auto;
    }

    .sidebar-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    /* ADD_TO_BUFFER : en bas du scroll, pas sticky / pas toujours visible */
    #sidebar-order-footer {
        position: static;
        flex-shrink: 0;
        margin-top: 14px;
        padding: 8px 8px 12px;
        border-top: 1px solid #29323a;
    }
    #sidebar-order-footer #add-btn {
        min-height: 44px;
        font-size: 0.8rem;
        margin-top: 6px;
        padding: 10px 12px;
    }
    .editor-finish-summary {
        min-height: 40px;
        font-size: 0.7rem;
    }
    
    .sidebar.active { 
        transform: translateX(0); 
        visibility: visible;
        /* On affiche immédiatement au début de l'animation */
        transition: transform 0.3s ease, visibility 0s linear 0s;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        top: calc(var(--ir-header-h, 56px) + env(safe-area-inset-top, 0px));
        background: rgba(0, 0, 0, 0.55);
        z-index: 10040;
        -webkit-tap-highlight-color: transparent;
        pointer-events: auto;
    }
    body.ir-sidebar-open-mobile .sidebar-backdrop {
        display: block;
    }
    body.ir-sidebar-open-mobile {
        overflow: hidden;
    }

    .modal-box {
        width: min(96vw, 450px);
        max-height: min(90dvh, calc(100vh - 16px));
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cart-input-row {
        flex-direction: column;
        gap: 8px;
    }
}

/* =========================================
   MEDIA QUERIES - VERSION PC (> 900px)
   ========================================= */
@media (min-width: 901px) {
    .nav-label { display: inline; }
    #auth-status { display: inline; }
    #mobile-menu-btn { display: none; }
    #close-sidebar-btn { display: none; }
    
    /* INPUTS PC : Retour à une taille normale */
    select, button.btn, input { font-size: 0.8rem; }

    /* Toolbar Verticale */
    .toolbar { 
        height: 100%; 
        border-right: 1px solid var(--cyan); 
        border-top: none; 
        flex-direction: column; 
        padding-top: 10px; 
        overflow-y: auto; 
        overflow-x: hidden; 
        transition: width 0.3s ease; 
        scrollbar-width: none; 
    }
    .toolbar::-webkit-scrollbar { display: none; }

    /* Toolbar Mode Narrow */
    .toolbar.narrow { width: 54px; padding: 0; }
    .toolbar.narrow .tools-grid { grid-template-columns: 1fr; width: 100%; padding: 0; display: flex; flex-direction: column; align-items: center; }
    .toolbar.narrow .tool-icon { width: 40px; height: 40px; margin-bottom: 5px; }
    .toolbar.narrow .separator { width: 80%; margin: 5px auto; }

    /* Bouton Bascule Toolbar */
    .toolbar-toggle-btn {
        display: flex; justify-content: center; align-items: center;
        width: 100%; height: 40px; cursor: pointer; color: #555;
        border-top: 1px solid #333; margin-top: auto; background: #080808; flex-shrink: 0; 
    }
    .toolbar-toggle-btn:hover { background: #222; color: var(--cyan); }
    
    .tools-grid { grid-template-columns: 1fr 1fr; width: 100%; padding: 5px; }
    .separator { width: 90%; height: 1px; margin: 5px 0; }
    
    .sidebar { width: 320px; position: relative; height: 100%; transform: translateX(0); visibility: visible; display: flex; flex-direction: column; flex-shrink: 0; }
    .sidebar .sidebar-content { flex: 1 1 auto; min-height: 0; }
    .sidebar.hidden { display: none; } 
    .sidebar-backdrop { display: none; }
}
body.immersive .ir-detached-panel.ir-constructor-dock,
body.immersive .ir-detached-panel.ir-constructor-dock.ir-dock-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Modales */
.modal-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.95); z-index: 1000; align-items: center; justify-content: center; }
.modal-box { background: #000; border: 2px solid var(--cyan); padding: 20px; width: 90%; max-width: 450px; max-height: min(88dvh, calc(100vh - 24px)); overflow-y: auto; text-align: center; border-radius: 8px; position: relative; z-index: 9009; }
#auth-portal-modal .modal-box.modal-box--auth-portal,
.modal-box.modal-box--auth-portal.modal-auth-wide {
    width: min(96vw, 720px) !important;
    max-width: min(96vw, 720px) !important;
    text-align: left;
    box-sizing: border-box;
}
#cart-modal .modal-content,
.modal-content.modal-auth-wide {
    width: min(96vw, 720px) !important;
    max-width: min(96vw, 720px) !important;
    text-align: left;
    box-sizing: border-box;
}
#auth-portal-modal .auth-options-grid,
#cart-modal .auth-options-grid,
.auth-options-grid.auth-options-grid--3col {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}
#auth-portal-modal .auth-options-grid > .auth-card,
#cart-modal .auth-options-grid > .auth-card,
.auth-options-grid.auth-options-grid--3col > .auth-card {
    flex: 0 1 200px !important;
    min-width: 0 !important;
    max-width: 200px !important;
    width: 200px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box;
    padding: 10px 8px !important;
}
.auth-options-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    margin-top: 12px;
    align-items: stretch;
    width: 100%;
}
.auth-options-grid--3col {
    flex-wrap: nowrap !important;
}
.auth-card {
    background: #0a0a0a;
    border: 1px solid #333;
    padding: 10px 8px;
    border-radius: 4px;
    text-align: center;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    box-sizing: border-box;
}
.auth-card:hover {
    border-color: var(--cyan);
    background: #111;
}
.auth-icon { font-size: 1.5rem; color: var(--cyan); margin-bottom: 6px; display: block; }
.auth-title { color: #fff; font-weight: 900; font-size: 0.82rem; margin-bottom: 6px; text-transform: uppercase; }
.auth-desc { color: #777; font-size: 0.65rem; margin-bottom: 8px; line-height: 1.35; flex-grow: 1; }
.mini-login-input {
    background: #000;
    border: 1px solid #444;
    color: #fff;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 5px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
}
@media (max-width: 520px) {
    #auth-portal-modal .auth-options-grid,
    #cart-modal .auth-options-grid,
    .auth-options-grid,
    .auth-options-grid--3col { flex-direction: column !important; }
    #auth-portal-modal .auth-options-grid > .auth-card,
    #cart-modal .auth-options-grid > .auth-card,
    .auth-options-grid > .auth-card { flex: 1 1 auto !important; width: 100% !important; }
}
.modal-box--projects {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.modal-box--projects .modal-tabs {
    flex: 0 0 auto;
}
.projects-view-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.modal-file-list {
    flex: 1 1 auto;
    min-height: 180px;
    max-height: min(52dvh, calc(100vh - 360px));
    overflow-y: auto !important;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}
.modal-box--projects .modal-file-list {
    height: 100%;
}
.modal-box--projects #view-projects,
.modal-box--projects #view-orders,
.modal-box--projects #view-infos,
.modal-box--projects #view-timelines {
    min-height: 0;
}
.modal-box--projects #view-infos {
    flex: 1 1 auto;
    overflow: hidden;
    padding: 0 2px;
}
.modal-box--projects #view-infos .infos-switch-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 10px;
    flex: 0 0 auto;
}
.modal-box--projects #view-infos .switch-btn {
    flex: 1 1 calc(33.33% - 4px);
    min-width: 0;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    color: #666;
    font-size: 0.68rem;
    font-weight: bold;
    background: #111;
    transition: 0.3s;
    border: 1px solid #333;
    font-family: 'Share Tech Mono', monospace;
}
.modal-box--projects #view-infos .switch-btn:hover {
    background: #222;
    color: #fff;
}
.modal-box--projects #view-infos .switch-btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(0, 242, 255, 0.08);
}
.modal-box--projects #view-infos .infos-scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(48dvh, calc(100dvh - 380px));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
}
.modal-box--projects #view-infos .infos-save-btn {
    flex: 0 0 auto;
    margin-top: 10px !important;
}
.modal-box--projects #view-infos .info-tab-content {
    display: none;
}
.modal-box--projects #view-infos .info-tab-content.active {
    display: block;
}
.modal-box--projects #view-infos .profile-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 900px) {
    .modal-box--projects #view-infos .infos-scroll-body {
        max-height: calc(100dvh - 340px);
    }
    .modal-box--projects #view-infos .switch-btn {
        font-size: 0.62rem;
        padding: 7px 2px;
    }
    .modal-box--projects #view-infos .profile-grid-2 {
        grid-template-columns: 1fr;
    }
}
.library-modal-box {
    width: min(96vw, 720px);
    max-width: 720px;
    max-height: 90vh;
    padding: 14px;
    border-color: #3fa9f5;
    background: #0d1014;
    text-align: left;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
#library-modal {
    z-index: 260000;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) 8px env(safe-area-inset-bottom, 0);
    box-sizing: border-box;
}
body.ir-library-modal-open {
    overflow: hidden;
}
@media (max-width: 900px) {
    #library-modal {
        align-items: stretch;
        justify-content: flex-end;
        padding: 0;
    }
    #library-modal .library-modal-box {
        width: 100%;
        max-width: none;
        max-height: none;
        height: 100dvh;
        height: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #library-modal .library-modal-content {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    #library-modal .library-startup-extras {
        flex-shrink: 0;
    }
    #library-modal .startup-template-grid {
        min-height: 120px;
    }
}
#initial-bike-selector {
    display: none !important;
}
.library-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.library-modal-header h3 {
    margin: 0;
    color: #8ed0ff;
    font-size: 1rem;
}
.library-modal-progress {
    flex-shrink: 0;
    margin: 0 0 10px;
    padding: 0;
}
.library-modal-progress[hidden] {
    display: none !important;
}
.library-modal-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.68rem;
    color: #7a9bb0;
    letter-spacing: 0.02em;
}
#library-modal-progress-count {
    font-variant-numeric: tabular-nums;
    color: #5a7a8e;
    white-space: nowrap;
}
.library-modal-progress-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(63, 169, 245, 0.15);
    overflow: hidden;
}
.library-modal-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: linear-gradient(90deg, #2a8fd4, #3fa9f5 55%, #8ed0ff);
    transition: width 0.18s ease-out;
}
.library-modal-progress.is-indeterminate .library-modal-progress-fill {
    width: 35% !important;
    animation: library-modal-progress-slide 1.1s ease-in-out infinite;
}
@keyframes library-modal-progress-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}
.library-modal-subtitle {
    margin: 0 0 10px;
    color: #666;
    font-size: 0.8rem;
}
.library-modal-content {
    border: 1px solid #2b3f4a;
    border-radius: 8px;
    background: #0c0f12;
    padding: 10px;
    max-height: calc(90vh - 180px);
    overflow: auto;
}
/* Contenu bibliothèque dans la modale : toujours visible (sidebar-layout ne doit pas le masquer) */
#library-modal #body-lib,
#library-modal #body-lib.section-body,
#library-modal #body-lib.closed {
    display: block !important;
    max-height: none;
    overflow: visible;
    background: transparent;
    padding: 0;
}
#library-modal .library-filters {
    border-bottom-color: #2b3f4a;
}
#library-modal #template-view-toggles {
    display: none;
}
#library-modal #template-search-input {
    display: none;
}
#library-modal #library-hint {
    display: none;
}
/* Évite le double affichage pièces (picker-grid + template-container) */
#library-modal #template-container {
    display: none !important;
}
.library-startup-extras {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #333;
}
.library-startup-extras-label {
    color: #8aa;
    font-size: 0.72rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.library-startup-extras-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.startup-library-content .input-group {
    margin-bottom: 10px;
}
.startup-library-content label {
    display: block;
    text-align: left;
    color: var(--cyan, #00f2ff);
    font-size: 0.75rem;
    margin-bottom: 5px;
    font-weight: bold;
}
.startup-library-content .lib-select {
    width: 100%;
}
.modal-tabs { display: flex; border-bottom: 1px solid #333; margin-bottom: 15px; }

@media (max-width: 900px) {
    .modal-box {
        width: min(96vw, 560px);
        max-height: calc(100dvh - 14px);
        padding: 14px;
    }
    .modal-file-list {
        min-height: 160px;
        max-height: calc(100dvh - 330px);
    }
}
.modal-tab { flex: 1; padding: 10px; background: #111; color: #666; border: none; cursor: pointer; font-weight: bold; }
.modal-tab.active { background: var(--cyan); color: #000; }
.modal-box--projects .modal-tab {
    min-width: 0;
    font-size: 0.72rem;
    padding: 9px 6px;
}
.modal-file-list .group-content {
    display: none;
}
.modal-file-list .group-content.open {
    display: block;
}
.modal-file-list .group-header .fa-chevron-down {
    transition: transform 0.18s ease;
}
.modal-file-list .group-header.open .fa-chevron-down {
    transform: rotate(180deg);
}

/* --- STYLE UNIFORME POUR TOUS LES GROUPES DE PROPRIÉTÉS --- */
.prop-group, .project-group {
    border: 1px solid #222;
    margin-bottom: 8px;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
}

/* En-tête identique pour tous (Calques, Création, Infos, etc.) */
.prop-header, .group-header, .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    background: #181818; /* Gris très sombre comme les autres */
    transition: background 0.2s;
    border-bottom: 1px solid #222;
}

.prop-header:hover, .group-header:hover {
    background: #222;
}

/* Texte des titres en Cyan */
.prop-header span, .group-title, .section-header {
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--cyan);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icônes de flèche (Chevron) */
.chevron, .fa-chevron-down {
    color: #555;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

/* État fermé pour la flèche */
.closed .chevron, .closed .fa-chevron-down {
    transform: rotate(-90deg);
}

/* Contenu des menus */
.prop-content, .group-content, .section-body {
    padding: 12px;
    background: #0d0d0d;
    display: block;
}

.prop-content.closed, .group-content.closed, .section-body.closed {
    display: none;
}

/* --- STYLE SPÉCIFIQUE CALQUES (Pour matcher le reste) --- */
.layer-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: #151515;
    border: 1px solid #222;
    margin-bottom: 4px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.8rem;
}

.layer-item.active-layer {
    border-color: var(--cyan);
    background: #1a1a1a;
    box-shadow: inset 0 0 5px rgba(0, 242, 255, 0.2);
}
.layer-name {
    flex: 1;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    text-align: left;
    font-weight: bold;
    color: #ffffff !important; /* Force la couleur blanche pour le texte */
    font-size: 0.8rem;
    font-family: 'Rajdhani', sans-serif;
}

.layer-item {
    display: flex;
    align-items: center;
    background: #111;
    border: 1px solid #222;
    margin-bottom: 4px;
    min-height: 44px;
    border-radius: 4px;
}
/* --- RESPONSIVE TOP NAV --- */

/* Pour tablettes et mobiles (moins de 1024px) */
@media screen and (max-width: 1024px) {
    /* On cache les étiquettes "1. MARQUE", "2. MODÈLE" pour gagner de la place */
    .nav-label {
        display: none !important;
    }
    
    /* On réduit les marges imposées */
    .nav-group {
        margin-left: 5px !important;
        border: none !important;
    }
    
    /* On réduit la taille des sélecteurs */
    .nav-select {
        width: 100px !important;
        font-size: 0.8rem;
    }
}

/* Pour mobiles uniquement (moins de 768px) */
@media screen and (max-width: 768px) {
    .top-nav {
        padding: 0 5px; /* Moins de padding sur les côtés */
        gap: 5px; /* Petit espace entre les éléments */
    }

    /* LOGO : On réduit la taille et on cache le "RIDER" */
    .nav-logo {
        font-size: 0.9rem !important;
        white-space: nowrap;
    }
    .nav-logo span {
        display: none;
    }

    /* PRIX : On réduit la police */
    #display-price {
        font-size: 0.9rem !important;
    }

    /* BOUTON AJOUTER : On ne garde que l'icône (+) */
    #btn-add-cart {
        font-size: 0 !important; /* Cache le texte "AJOUTER" */
        padding: 0 !important;
        width: 35px;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 5px !important;
    }
    #btn-add-cart i {
        font-size: 1.2rem !important; /* L'icône reste visible */
        margin: 0;
    }

    /* WIDGET PANIER : On ne garde que l'icône */
    #cart-widget {
        font-size: 0 !important; /* Cache le texte "BUFFER" */
        padding: 5px !important;
        border: none !important;
        margin-right: 2px !important;
    }
    #cart-widget::before {
        content: '\f07b'; /* Code FontAwesome pour le dossier/panier */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 1.2rem;
        color: var(--cyan);
    }
    
    /* ÉLÉMENTS INUTILES SUR MOBILE : On les cache */
    #auth-status, 
    .header-btn[title="Mode Immersif"] {
        display: none !important;
    }
    
    /* Menu Burger (Sidebar) toujours visible et cliquable */
    #mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        pointer-events: auto !important;
        z-index: 10001;
        position: relative;
    }

    .sidebar-header-actions {
        justify-content: flex-start;
        gap: 5px;
    }
    .sidebar-header .header-btn.header-btn-text {
        max-width: 100%;
        flex: 1 1 calc(50% - 6px);
    }
    .sidebar-header-link {
        flex: 1 1 100%;
        text-align: right;
    }
}

/* ===== Sidebar layout customizer ===== */
.ir-sidebar-section { position: relative; }
.ir-sidebar-section.is-dragging { opacity: 0.55; }
.ir-sidebar-section.is-drop-target > .section-header { outline: 1px dashed var(--cyan); }
.ir-section-tools {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ir-section-tools button {
    border: 1px solid #3a3a3a;
    background: #111;
    color: #8ea5b3;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}
.ir-section-tools button:hover { color: var(--cyan); border-color: var(--cyan); }
#ir-detached-sections-host {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6500;
}
.ir-detached-panel {
    position: fixed;
    width: 340px;
    max-width: min(90vw, 360px);
    max-height: 78vh;
    background: #0d0f12;
    border: 1px solid #2a3b47;
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}
.ir-detached-titlebar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #13202a;
    color: #bfe9ff;
    border-bottom: 1px solid #274456;
    padding: 8px 10px;
    cursor: move;
    user-select: none;
}
.ir-detached-titlebar .ir-detached-vis,
.ir-detached-titlebar .ir-detached-attach {
    border: 1px solid #365164;
    background: #0f1a22;
    color: #bfe9ff;
    border-radius: 4px;
    min-height: 24px;
    padding: 2px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
}
.ir-detached-titlebar .ir-detached-vis {
    min-width: 28px;
    justify-content: center;
    padding: 2px 8px;
    gap: 5px;
}
.ir-detached-titlebar .ir-detached-vis .ir-vis-label {
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}
.ir-detached-titlebar .ir-detached-vis:hover,
.ir-detached-titlebar .ir-detached-attach:hover {
    background: #153142;
    border-color: #5e9dc2;
}
.ir-detached-panel[data-body-hidden="1"],
.ir-detached-panel.is-collapsed {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}
.ir-detached-panel[data-body-hidden="1"] > :not(.ir-detached-titlebar),
.ir-detached-panel.is-collapsed > :not(.ir-detached-titlebar) {
    display: none !important;
}
.ir-detached-panel.ir-constructor-dock[data-body-hidden="1"],
.ir-detached-panel.ir-constructor-dock.is-collapsed,
.ir-detached-panel.ir-constructor-dock.ir-dock-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
/* Bouton flottant pour réouvrir Outils prioritaires après masquage (œil) */
.ir-constructor-reopen {
    position: absolute;
    top: 12px;
    right: 330px;
    z-index: 430;
    display: none;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #3d7fa1;
    background: rgba(18, 40, 54, 0.96);
    color: #bde7ff;
    font-size: 0.72rem;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ir-constructor-reopen:hover {
    background: #1f4256;
}
@media (max-width: 1200px) {
    .ir-constructor-reopen { right: 12px; top: 70px; }
}
.ir-detached-titlebar .ir-detached-merge {
    border: 1px solid #4f485f;
    background: #171325;
    color: #d7c6ff;
    border-radius: 4px;
    min-height: 24px;
    padding: 2px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
}
.ir-detached-titlebar .ir-detached-merge:hover {
    background: #251f3d;
    border-color: #8a71d1;
}
.ir-detached-tabs {
    display: none;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px 8px;
    border-bottom: 1px solid #243743;
    background: #101a21;
}
.ir-detached-tab-btn {
    border: 1px solid #385262;
    background: #0f1820;
    color: #9ec0d4;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.66rem;
    cursor: pointer;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ir-detached-tab-btn.active {
    background: #1d3342;
    color: #ddf4ff;
    border-color: #63a8d1;
}
.ir-detached-panel.ir-constructor-dock {
    right: 326px;
    top: 88px;
    bottom: auto;
    left: auto !important;
    width: 320px;
    max-width: 340px;
    max-height: calc(100vh - 100px);
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}
@media (max-width: 1200px) {
    .ir-detached-panel.ir-constructor-dock {
        right: 12px;
        top: 70px;
        bottom: auto;
        max-height: calc(100vh - 86px);
        width: min(360px, calc(100vw - 24px));
    }
}
.ir-sidebar-section.is-detached > .section-header { cursor: default; }

/* ===== Illustrator-like layer rows ===== */
#layer-list { padding-bottom: 24px; }
.layer-item.ir-ai-layer {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 6px 4px;
    margin-bottom: 2px;
    border: 1px solid #1f1f1f;
    border-radius: 3px;
    background: #111317;
}
.layer-item.ir-ai-layer:hover { background: #171b21; }
.layer-item.ir-ai-layer.active-layer {
    border-color: #4e6e82;
    box-shadow: inset 0 0 0 1px #6ea8c9;
    background: #1a232b;
}
.layer-item.ir-ai-layer .layer-btn {
    width: 24px;
    height: 24px;
    opacity: .9;
    color: #a2afba;
}
.layer-item.ir-ai-layer .layer-btn:hover {
    background: #26313b;
    color: #d4f1ff;
}
.layer-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}
.layer-kind { width: 14px; color: #9ca8b5; font-size: 0.72rem; text-align: center; }
.layer-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.25);
    flex-shrink: 0;
}
.layer-name-wrap { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.layer-item.ir-ai-layer .layer-name {
    padding: 0;
    color: #e3e9ef !important;
    font-size: 0.73rem;
    font-family: Arial, sans-serif;
    font-weight: 600;
    line-height: 1.15;
}
.layer-meta {
    color: #8392a0;
    font-size: 0.62rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ===== Footer commande en bas du contenu sidebar (scrollable, pas sticky) ===== */
#sidebar-order-footer {
    position: static;
    z-index: 1;
    margin-top: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(8, 10, 12, 0.96) 0%, rgba(8, 10, 12, 1) 22%);
    border-top: 1px solid #29323a;
    backdrop-filter: blur(6px);
    flex-shrink: 0;
}

.editor-finish-details {
    margin: 0 0 6px;
}
.editor-finish-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid #2d3a45;
    border-radius: 6px;
    background: #12181f;
    color: var(--cyan);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}
.editor-finish-summary::-webkit-details-marker { display: none; }
.editor-finish-summary .fa-chevron-down { transition: transform 0.2s ease; font-size: 0.7rem; }
.editor-finish-details[open] .editor-finish-summary .fa-chevron-down { transform: rotate(180deg); }

#sidebar-order-footer #editor-finish-options {
    padding: 8px !important;
}

#sidebar-order-footer #editor-finish-options label {
    font-size: 0.64rem !important;
    margin-bottom: 3px !important;
}

#sidebar-order-footer #vinyl-base-select,
#sidebar-order-footer #lamination-select {
    min-height: 28px;
    font-size: 0.72rem;
    padding: 4px 8px;
}

#sidebar-order-footer #editor-finish-price-hint {
    margin-top: 6px !important;
    font-size: 0.7rem !important;
}

#sidebar-order-footer #add-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
}

#sidebar-order-footer #simulate-order-btn {
    margin-top: 4px !important;
    font-size: 0.66rem !important;
}
/* --- MENU FLOTTANT OBJET (HUD) --- */
#obj-floating-menu {
    position: absolute;
    display: none; /* Caché par défaut */
    gap: 5px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--cyan);
    padding: 5px 10px;
    border-radius: 4px;
    z-index: 1000;
    pointer-events: auto;
    transform: translate(-50%, -120%); /* Centré au-dessus */
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

/* Petite flèche en bas du menu */
#obj-floating-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--cyan) transparent transparent transparent;
}

.hud-btn {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    transition: 0.2s;
}

.hud-btn:hover { background: #222; border-color: #666; }
.hud-btn.btn-up:hover { color: var(--green); border-color: var(--green); }
.hud-btn.btn-down:hover { color: var(--purple); border-color: var(--purple); }
.hud-btn.btn-del:hover { background: var(--red); color: #000; border-color: var(--red); }

/* ===== Memory timeline bottom panel ===== */
.ir-memory-bottom-panel {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 120;
    display: none;
    gap: 6px;
    align-items: center;
    padding: 7px 8px;
    border: 1px solid #2e3a48;
    border-radius: 8px;
    background: rgba(8, 12, 18, 0.92);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
body.ir-memory-panel-visible #help-bar {
    bottom: 74px;
}
.ir-memory-bottom-panel .btn {
    width: auto;
    min-width: 78px;
    margin: 0;
    padding: 6px 10px;
    font-size: 0.72rem;
    line-height: 1;
    background: #151d26;
    border: 1px solid #3a4d61;
    color: #dce8f6;
}
.ir-memory-bottom-panel .btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}
.ir-memory-bottom-panel .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #2f3944;
    color: #7d8b99;
}
.ir-memory-bottom-panel .btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 0 1px rgba(0, 242, 255, 0.2) inset;
}
#ir-memory-panel-rec-toggle {
    border-color: #5a3131;
    color: #ffbcbc;
}
#ir-memory-panel-rec-pause {
    border-color: #42566b;
    color: #b2d7ff;
}
#ir-memory-panel-speed {
    border-color: #3b5266;
    color: #a7ddff;
    min-width: 88px;
}
#ir-memory-panel-share {
    border-color: #2e5a46;
    color: #9df2cc;
}
#ir-memory-panel-clear {
    min-width: 150px;
    border-color: #5c3a3a;
    color: #ffb3b3;
}
#ir-memory-panel-clear:hover {
    border-color: var(--red);
    color: var(--red);
}
@media (max-width: 900px) {
    .ir-memory-bottom-panel {
        left: 8px;
        right: 8px;
        transform: none;
        width: auto;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 5px;
        bottom: 8px;
        padding: 6px;
    }
    .ir-memory-bottom-panel .btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        font-size: 0.68rem;
        padding: 7px 8px;
    }
    #ir-memory-panel-clear {
        flex-basis: 100%;
    }
}

/* --- STYLE CHAMPS ADRESSE PANIER --- */
.cart-address-box {
    margin-top: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #333;
    text-align: left;
}
.cart-section-label {
    color: var(--cyan);
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.cart-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}
.cart-input {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    transition: 0.3s;
}
.cart-input:focus {
    border-color: var(--cyan);
    outline: none;
    box-shadow: 0 0 5px rgba(0, 242, 255, 0.2);
}
.cart-input.highlight {
    border-color: var(--purple);
    color: var(--purple);
}
.cart-input::placeholder { color: #444; }
/* --- STYLE UNIFORME CHAMPS PROFIL --- */
.profile-input {
    background: #000 !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-family: 'Share Tech Mono', monospace !important;
    font-size: 0.9rem !important;
    margin-bottom: 10px !important; /* Espacement régulier */
    transition: 0.3s;
}

.profile-input:focus {
    border-color: var(--cyan) !important;
    outline: none;
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

.profile-label {
    color: #aaa; 
    font-size: 0.7rem; 
    font-weight: bold; 
    display: block; 
    margin-bottom: 4px;
}
#info-phone {
  width: 100%;
  background: #000;
  border: 1px solid #333;
  color: #fff;
  padding: 12px;
  font-family: 'Share Tech Mono';
  margin-top: 5px;
  outline: none;
  box-sizing: border-box;
  font-size: 16px;
  border-radius: 0;
  appearance: none;
}

/* --- CORRECTIF AFFICHAGE OUTILS TEXTE --- */
    #text-props-container {
        /* On s'assure que le conteneur a de la place */
        min-height: 100px; 
    }

    .text-toolbar {
        /* On force l'affichage en Flexbox */
        display: flex !important;
        flex-direction: row;
        gap: 5px;
        margin: 5px 0;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
    }

    /* Style des boutons pour être sûr qu'ils ne sont pas blancs sur blanc */
    .text-toolbar .style-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 35px;
        height: 35px;
        background-color: #222;
        border: 1px solid #444;
        color: #fff;
        cursor: pointer;
    }

    .text-toolbar .style-btn:hover {
        background-color: #444;
        border-color: var(--cyan, #00f2ff);
    }
	/* Overlay démarrage — même coque visuelle que library-modal-box */
#initial-bike-selector {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    /* Au-dessus du header global (.ir-header = 10000) et de .ir-search-meta (9999) */
    z-index: 100050;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    box-sizing: border-box;
}
#initial-bike-selector:not(.is-hidden)[style*="flex"] {
    display: flex !important;
}
#initial-bike-selector.is-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}
#initial-bike-selector .library-modal-box {
    position: relative;
    z-index: 1;
}

.lib-template-picker {
    margin: 8px 0 10px;
    padding: 10px;
    border: 1px solid #2b3f4a;
    border-radius: 6px;
    background: #0a0d10;
    box-sizing: border-box;
}
.lib-template-picker > label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cyan, #00f2ff);
    margin: 0 0 6px;
    font-weight: bold;
}
.lib-template-picker .lib-select {
    padding: 10px 12px;
    font-size: 0.75rem;
}

@media (max-width: 520px), (max-height: 680px) {
    #initial-bike-selector {
        align-items: flex-start;
        padding: max(10px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom));
    }
    #initial-bike-selector .library-modal-box {
        width: min(98vw, 100%);
        max-width: none;
        max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        padding: 10px;
    }
    .startup-template-grid {
        max-height: min(32vh, 220px);
    }
}

.startup-template-grid {
    max-height: 42vh;
    overflow-y: auto;
    margin-top: 8px;
    padding: 4px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
}

.startup-template-search {
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 10px 12px;
    background: #000;
    border: 1px solid #444;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    border-radius: 4px;
}
.startup-template-search:focus {
    outline: none;
    border-color: var(--cyan, #00f2ff);
    box-shadow: 0 0 0 1px rgba(0, 242, 255, 0.25);
}
.startup-template-search-empty {
    margin-top: 8px;
    padding: 10px;
    text-align: center;
    color: #888;
    font-size: 0.78rem;
    border: 1px dashed #333;
    background: #0a0a0a;
    border-radius: 4px;
}

.startup-template-grid .grid-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

#modal-template-grid .tpl-card,
#template-picker-grid .tpl-card {
    min-height: 110px;
    padding: 8px 6px;
    cursor: pointer;
}

#modal-template-grid .tpl-card .tpl-thumb-slot,
#template-picker-grid .tpl-card .tpl-thumb-slot,
.tpl-card .tpl-thumb-slot {
    display: block;
    width: 100%;
    height: 64px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #1a1a1a 0%, #242424 50%, #1a1a1a 100%);
    background-size: 200% 100%;
    animation: ir-thumb-shine 1.1s linear infinite;
    border-radius: 2px;
}

@keyframes ir-thumb-shine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

#modal-template-grid .tpl-card img,
#template-picker-grid .tpl-card img,
.tpl-card .tpl-thumb-img {
    width: 100%;
    height: 64px;
    object-fit: contain;
    margin-bottom: 6px;
}
/* Ancien WebP plaques généré avec flip Imagick → corriger le sens */
.tpl-card .tpl-thumb-img.tpl-thumb-yfix {
    transform: scaleY(-1);
}

#modal-template-grid .tpl-card .tpl-name,
#template-picker-grid .tpl-card .tpl-name {
    font-size: 0.68rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#modal-template-grid .tpl-card .price-tag,
#template-picker-grid .tpl-card .price-tag {
    font-size: 0.62rem;
    margin-top: 4px;
}