/* ==============================================================================
   1. VARIABLES DE THÈME - LIQUID GLASS MACOS SOUVERAIN (TAHOE/SONOMA)
   ============================================================================== */
:root {
    --bg-dark: #07090e; 
    --bg-glass: rgba(15, 20, 30, 0.4); 
    --bg-sidebar: rgba(1, 4, 9, 0.75);
    --bg-dropdown: rgba(22, 29, 44, 0.9);
    --bg-ai-sidebar: rgba(14, 18, 28, 0.62);
    --bg-chat-input: rgba(0, 0, 0, 0.4);
    --bg-code-input: rgba(0, 0, 0, 0.55);
    --text-main: #e6edf3; 
    --text-muted: #8b949e;
    --accent-blue: #58a6ff; 
    --accent-green: #3fb950; 
    --accent-red: #f85149; 
    --accent-gold: #e3b341;
    --border: rgba(255, 255, 255, 0.08); 
    --border-highlight: rgba(255, 255, 255, 0.16);
    --specular: rgba(255, 255, 255, 0.12);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Ombres étagées d'Apple (Profondeur physique) */
    --shadow-subtle: 0 1px 2px rgba(0,0,0,0.05), 0 12px 30px -10px rgba(0, 0, 0, 0.3), inset 0 1px 1px var(--specular);
    --shadow-deep: 0 1px 2px rgba(0,0,0,0.1), 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 1px var(--specular);
    --backdrop-gradient: radial-gradient(circle at top right, #161f30, #07090e);
    --glass-blur: blur(35px);
    --glass-saturate: saturate(210%);
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
    --liquid-highlight: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.01) 50%, rgba(0, 0, 0, 0.02) 50.1%, rgba(255, 255, 255, 0.0) 100%);
}

html[data-theme="light"] {
    --bg-dark: #f0f0f5; 
    --bg-glass: rgba(255, 255, 255, 0.42); 
    --bg-sidebar: rgba(230, 230, 235, 0.8);
    --bg-dropdown: rgba(255, 255, 255, 0.88);
    --bg-ai-sidebar: rgba(245, 245, 247, 0.75);
    --bg-chat-input: rgba(255, 255, 255, 0.65);
    --bg-code-input: rgba(255, 255, 255, 0.55);
    --text-main: #1d1d1f; 
    --text-muted: #6e6e73; 
    --accent-blue: #0071e3; 
    --accent-green: #1d9d3d; 
    --accent-red: #ff3b30; 
    --accent-gold: #ff9500;
    --border: rgba(0, 0, 0, 0.05); 
    --border-highlight: rgba(0, 0, 0, 0.1);
    --specular: rgba(255, 255, 255, 0.8);
    --shadow-subtle: 0 1px 2px rgba(0,0,0,0.02), 0 12px 30px -10px rgba(0, 0, 0, 0.08), inset 0 1px 0px var(--specular);
    --shadow-deep: 0 1px 3px rgba(0,0,0,0.04), 0 30px 60px -15px rgba(0, 0, 0, 0.15), inset 0 1px 0px var(--specular);
    --backdrop-gradient: radial-gradient(circle at 75% 15%, #e1e1e9, #f5f5f7);
    --glass-saturate: saturate(220%) brightness(104%);
    --liquid-highlight: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.05) 50%, rgba(0, 0, 0, 0.01) 50.1%, rgba(255, 255, 255, 0.1) 100%);
}

/* ==============================================================================
   2. CONFIGURATION PHYSIQUE DE L'ESPACE DE TRAVAIL
   ============================================================================== */
body { 
    margin: 0; 
    font-family: var(--font-stack); 
    background-color: var(--bg-dark); 
    background: var(--backdrop-gradient);
    color: var(--text-main); 
    display: flex; 
    height: 100vh; 
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.4s var(--transition-curve), color 0.4s var(--transition-curve);
}

#backdrop-mesh {
    position: absolute; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: hidden;
}
.blur-blob {
    position: absolute; border-radius: 50%; filter: blur(95px); opacity: 0.14; transition: all 0.4s;
}
.blob-1 { top: -10%; right: -5%; width: 550px; height: 550px; background: var(--accent-blue); }
.blob-2 { bottom: -10%; left: -5%; width: 650px; height: 650px; background: #8c52ff; }

/* ==============================================================================
   3. BARRE LATÉRALE (DOCK SOUVERAIN)
   ============================================================================== */
#sidebar {
    width: 68px;
    background-color: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 22px;
    box-sizing: border-box;
    z-index: 1010;
    flex-shrink: 0;
    box-shadow: inset -1px 0 0 var(--border);
}
.traffic-lights { 
    display: flex; 
    gap: 7px; 
    margin-bottom: 8px; 
    align-self: flex-start; 
    padding-left: 15px; 
}
.light { width: 12px; height: 12px; border-radius: 50%; border: 0.5px solid rgba(0, 0, 0, 0.1); }
.light.red { background: #ff5f56; }
.light.yellow { background: #ffbd2e; }
.light.green { background: #27c93f; }

.nav-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.3s var(--transition-curve);
    box-sizing: border-box;
}
.nav-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: scale(1.02);
}
.nav-icon.active {
    background: var(--bg-glass);
    background-image: var(--liquid-highlight);
    border: 1px solid var(--border-highlight);
    color: var(--accent-blue);
    box-shadow: var(--shadow-subtle);
}

/* ==============================================================================
   4. EN-TÊTE CENTRAL (WORKSPACE HEADER)
   ============================================================================== */
#workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 50;
    background: transparent;
}

#workspace-header {
    height: 56px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(1, 4, 9, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 999;
}
.workspace-title { 
    font-size: 13px; 
    font-weight: 700; 
    letter-spacing: 0.4px; 
    text-transform: uppercase; 
    opacity: 0.95;
}

.burger-menu {
    cursor: pointer; 
    width: 32px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 8px; 
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid var(--border); 
    transition: all 0.2s var(--transition-curve);
}
.burger-menu:hover { 
    background: rgba(255, 255, 255, 0.05); 
    border-color: var(--border-highlight); 
}

#admin-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px); 
    right: 24px;
    width: 290px;
    background: var(--bg-dropdown);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-deep);
    z-index: 10000;
    transform-origin: top right;
    animation: popoverFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}
@keyframes popoverFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-row { 
    display: flex; 
    justify-content: space-between; 
    font-size: 11px; 
    margin-bottom: 8px; 
    color: var(--text-muted); 
}

#workspace-body { 
    flex: 1; 
    overflow-y: auto; 
    padding: 24px 28px; 
    box-sizing: border-box; 
    z-index: 10; 
    background: transparent;
}
.workspace-view { display: none; animation: fadeIn 0.4s var(--transition-curve); }
.workspace-view.active { display: block; }

/* ==============================================================================
   5. CARTES VERRE LIQUIDE (GLASS CARDS)
   ============================================================================= */
.glass-card {
    background: var(--bg-glass);
    background-image: var(--liquid-highlight);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.glass-card:hover { border-color: var(--border-highlight); }
.card-title { font-weight: 700; font-size: 11px; color: var(--accent-blue); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 15px; }

/* ==============================================================================
   6. ASSISTANT LATÉRAL & HARMONISATION BARRE DE CONTRÔLE (HIGH-END MAC STYLE)
   ============================================================================== */
#ai-sidebar {
    position: fixed;
    top: 0;
    right: -430px; 
    width: 420px;
    height: 100%;
    background: var(--bg-ai-sidebar);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    transition: right 0.4s var(--transition-curve);
    z-index: 9999;
}
#ai-sidebar.active { right: 0; }

/* En-tête de chat aligné et robuste (pas de wrap) */
#ai-header { 
    height: 56px; 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 16px; 
    background: rgba(0,0,0,0.02); 
    box-sizing: border-box;
    flex-shrink: 0;
}
.sidebar-title-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-subtitle {
    font-size: 8.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Barrettes d'actions unifiées style Apple (Segmented Toolbar) */
.chat-actions {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.12);
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    flex-shrink: 0;
}
html[data-theme="light"] .chat-actions {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.05);
}

.chat-actions .icon-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--transition-curve);
    padding: 0;
}
.chat-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}
html[data-theme="light"] .chat-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.chat-actions .icon-btn.active {
    background: var(--bg-glass);
    color: var(--accent-blue);
    box-shadow: var(--shadow-subtle);
}

/* Bouton Fermer unifié (Apple compact de précision) */
#ai-header .btn-danger {
    height: 26px !important;
    width: auto !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 0 10px !important;
    border-radius: 6px !important;
    background: rgba(248, 81, 73, 0.1) !important;
    border: 1px solid rgba(248, 81, 73, 0.2) !important;
    color: var(--accent-red) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s var(--transition-curve) !important;
    flex-shrink: 0;
    box-shadow: none !important;
}
#ai-header .btn-danger:hover {
    background: rgba(248, 81, 73, 0.18) !important;
    border-color: rgba(248, 81, 73, 0.3) !important;
}

/* ==============================================================================
   7. DESIGN DU CHAT ET FLUX DE MESSAGES
   ============================================================================== */
#chat-history { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.message { max-width: 80%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; font-size: 13.5px; word-wrap: break-word; }
.message.user { 
    background: rgba(0, 122, 255, 0.15); 
    border: 1px solid rgba(0, 122, 255, 0.2); 
    align-self: flex-end; 
    color: #fff; 
    border-bottom-right-radius: 4px; 
    box-shadow: var(--shadow-subtle);
}
.message.ai { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }

#chat-input-area { padding: 20px 25px 25px 25px; background: transparent; display: flex; flex-direction: column; }
.chat-input-wrapper { display: flex; align-items: center; background: var(--bg-chat-input); border: 1px solid var(--border); border-radius: 18px; padding: 6px 12px; box-sizing: border-box; }
.chat-input-wrapper textarea { flex: 1; background: transparent; border: none; outline: none; color: var(--text-main); font-size: 13px; height: 24px; resize: none; font-family: var(--font-stack); }

#ai-trigger-btn {
    position: fixed; bottom: 35px; right: 35px; width: 52px; height: 52px; border-radius: 50%;
    background: var(--accent-blue); box-shadow: 0 8px 32px rgba(88, 166, 255, 0.35);
    display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 9998;
    transition: all 0.4s var(--transition-curve);
}
#ai-trigger-btn:hover { transform: scale(1.05); background: #6cb6ff; }

/* ==============================================================================
   8. BOUTONS SYSTEME TRIDIMENSIONNELS (APPLE PHYSIC STYLE)
   ============================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border-radius: 8px;
    padding: 0 15px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s var(--transition-curve);
    width: 100%;
    box-sizing: border-box;
    line-height: 1;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid var(--border);
    color: var(--text-main);
    box-shadow: var(--shadow-subtle);
}
.btn:hover { background-color: rgba(255, 255, 255, 0.08); border-color: var(--border-highlight); }

/* Thème clair : Boutons système d'origine Apple */
html[data-theme="light"] .btn {
    background: linear-gradient(180deg, #ffffff 0%, #f4f4f7 100%);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #1d1d1f;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 #ffffff;
}
html[data-theme="light"] .btn:hover {
    background: linear-gradient(180deg, #fafafa 0%, #eaeaea 100%);
    border-color: rgba(0, 0, 0, 0.18);
}

/* Thème clair & sombre : Vert d'action */
.btn-green { 
    background: rgba(63, 185, 80, 0.15); 
    border-color: rgba(63, 185, 80, 0.3); 
    color: var(--accent-green); 
}
.btn-green:hover { background: rgba(63, 185, 80, 0.25); }

html[data-theme="light"] .btn-green {
    background: linear-gradient(180deg, #34c759 0%, #28a745 100%);
    border-color: rgba(0, 0, 0, 0.15);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.25);
}
html[data-theme="light"] .btn-green:hover {
    background: linear-gradient(180deg, #30b651 0%, #218838 100%);
}

/* Thème clair & sombre : Rouge d'alerte */
.btn-danger { 
    background: rgba(248, 81, 73, 0.15); 
    border-color: rgba(248, 81, 73, 0.3); 
    color: var(--accent-red); 
}
.btn-danger:hover { background: rgba(248, 81, 73, 0.25); }

html[data-theme="light"] .btn-danger {
    background: linear-gradient(180deg, #ff3b30 0%, #e0352b 100%);
    border-color: rgba(0, 0, 0, 0.15);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.25);
}
html[data-theme="light"] .btn-danger:hover {
    background: linear-gradient(180deg, #e03026 0%, #be231a 100%);
}

.send-btn { background: var(--accent-blue); border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.send-btn:hover { background: #79b8ff; }

/* ==============================================================================
   9. HIPPOCAMPE ARCHIVE SESSIONS (TIROIR GLISSANT DE VERRE DÉPOLI)
   ============================================================================== */
#ai-archive-drawer {
    position: absolute;
    top: 0;
    left: 0; 
    width: 320px;
    height: 100%;
    background: var(--bg-dropdown);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-right: 1px solid var(--border);
    box-shadow: -15px 0 40px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--transition-curve), opacity 0.3s ease;
    transform: translateX(0); 
    z-index: -1;
    box-sizing: border-box;
}
#ai-sidebar.archive-active #ai-archive-drawer {
    transform: translateX(-320px); 
    opacity: 1;
    pointer-events: auto;
}

.drawer-header {
    height: 65px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

/* Cartes d'archives translucides dépolies */
.session-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s var(--transition-curve);
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
html[data-theme="light"] .session-card {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(0, 0, 0, 0.05);
}
.session-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-highlight);
}
html[data-theme="light"] .session-card:hover {
    background: rgba(255, 255, 255, 0.75);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

/* ==============================================================================
   10. CONSOLE ET SYSTEME IDE
   ============================================================================== */
.cortex-monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.monitor-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
html[data-theme="light"] .monitor-cell {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.05);
}

.code-input {
    width: 100%;
    background: var(--bg-code-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-main) !important;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace !important;
    font-size: 11.5px !important;
    line-height: 1.6 !important;
    padding: 15px !important;
    border-radius: 10px !important;
    outline: none !important;
    resize: vertical;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.4s var(--transition-curve) !important;
    box-sizing: border-box !important;
}
.code-input:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 122, 255, 0.12) !important;
}

/* ==============================================================================
   11. COMPOSANTS INTERNES, SCROLL ET COMMODITÉS
   ============================================================================== */
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; display: inline-block; vertical-align: middle; }

/* Custom minimalist scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(130, 130, 130, 0.18);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(130, 130, 130, 0.35);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Action Hover (Copier Bloc de Code) */
.copy-code-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s var(--transition-curve);
    display: flex;
    align-items: center;
    gap: 4px;
}
.message pre:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-blue);
    border-color: var(--border-highlight);
}

/* Voice Button Recording */
.voice-btn.recording {
    color: var(--accent-red) !important;
    animation: pulse 1.5s infinite;
}

/* Dragzone */
.dropzone-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(7, 9, 14, 0.85);
    backdrop-filter: blur(8px);
    border: 2px dashed var(--accent-blue);
    border-radius: 12px;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-blue);
    pointer-events: none;
}
#chat-history.drag-over .dropzone-overlay { display: flex; }

/* ==============================================================================
   12. SÉCURITÉ RESPONSIVE DES PETITS PANNEAUX
   ============================================================================== */
@media (max-width: 1023px) {
    #ai-sidebar { width: 380px; }
}

@media (max-width: 767px) {
    body { flex-direction: column-reverse; }
    #sidebar {
        width: 100vw;
        height: 60px;
        border-right: none;
        border-top: 1px solid var(--border);
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1010;
        background: var(--bg-sidebar);
    }
    .traffic-lights { display: none; }
    #workspace { height: calc(100vh - 60px); padding-bottom: 15px; }
    #workspace-header { padding: 0 16px; height: 50px; }
    #workspace-body { padding: 16px; }
    #ai-sidebar { width: 100vw; height: 100vh; transform: translateX(100%); }
    #ai-sidebar.active { transform: translateX(0); }
}

/* Style des curseurs de réglage des Mandats (macOS Tahoe System) */
.studio-slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.studio-slider-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}
.studio-slider-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    outline: none;
    transition: background 0.3s;
}
html[data-theme="light"] .studio-slider-group input[type="range"] {
    background: rgba(0, 0, 0, 0.08);
}
.studio-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-main);
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.1s;
}
.studio-slider-group input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
}