        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        :root {
            /* Couleurs principales */
            --primary: #4a90d9;
            --primary-dark: #2a5a8a;
            --accent: #d99040;

            /* Couleurs de statut */
            --success: #28a745;
            --danger: #dc3545;
            --warning: #ffc107;
            --info: #17a2b8;

            /* Backgrounds */
            --bg-dark: #1a1a1a;
            --bg-secondary: #2a2a2a;
            --bg-tertiary: #333;
            --bg-panel: #252525;
            --bg-toolbar: #2d2d2d;

            /* Texte et bordures */
            --border: #444;
            --text: #e0e0e0;
            --text-muted: #888;

            /* Dimensions */
            --toolbar-height: 56px;
            --toolbar2-height: 46px;
            --status-height: 36px;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-dark);
            color: var(--text);
            font-size: 14px;
            overflow: hidden;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }
        
        .app-container {
            width: 100%;
            height: 100vh;
            height: 100dvh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .toolbar {
            background: linear-gradient(to bottom, #3a3a3a, var(--bg-toolbar));
            border-bottom: 1px solid var(--border);
            padding: 6px;
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
            min-height: var(--toolbar-height);
            height: auto;
            flex-wrap: wrap;
            overflow-x: visible;
            overflow-y: visible;
        }
        
        .toolbar::-webkit-scrollbar { display: none; }

        .toolbar.toolbar-row2 {
            background: linear-gradient(to bottom, #353535, var(--bg-secondary));
            min-height: 38px;
            padding: 4px 6px;
            border-top: none;
        }

        .logo-mds {
            display: flex;
            align-items: center;
            padding: 0 8px 0 4px;
            flex-shrink: 0;
        }
        .logo-mds img { height: 28px; width: auto; }

        .toolbar-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 4px 8px;
            min-width: 48px;
            min-height: 44px;
            background: linear-gradient(to bottom, #404040, #333);
            border: 1px solid #555;
            border-radius: 6px;
            cursor: pointer;
            color: #ddd;
            flex-shrink: 0;
            transition: all 0.15s;
        }
        
        .toolbar-btn:active { transform: scale(0.95); background: linear-gradient(to bottom, #4a6a8a, #3a5a7a); }
        .toolbar-btn.active { background: linear-gradient(to bottom, #2a5a8a, #1a4a7a); border-color: var(--primary); color: #fff; }
        .toolbar-btn .icon { font-size: 18px; line-height: 1; }
        .toolbar-btn .label { font-size: 9px; margin-top: 2px; white-space: nowrap; }
        .toolbar-btn:disabled { opacity: 0.4; pointer-events: none; }
        
        .toolbar-btn.calibrating, .toolbar-btn.measuring {
            background: linear-gradient(to bottom, #8a5a2a, #7a4a1a) !important;
            border-color: var(--accent) !important;
            animation: pulse 1s ease-in-out infinite;
        }
        
        .toolbar-btn.picking {
            background: linear-gradient(to bottom, #2a8a5a, #1a7a4a) !important;
            border-color: var(--success) !important;
            animation: pulse 1s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { box-shadow: 0 0 5px currentColor; }
            50% { box-shadow: 0 0 15px currentColor; }
        }
        
        .cursor-display {
            background: var(--bg-dark);
            border: 2px solid var(--primary);
            border-radius: 6px;
            padding: 5px 10px;
            font-size: 11px;
            font-weight: bold;
            color: var(--primary);
            font-family: 'SF Mono', Monaco, monospace;
            white-space: nowrap;
            flex-shrink: 0;
            min-width: 140px;
            text-align: center;
        }
        
        .toolbar-spacer { flex: 1; min-width: 10px; }
        
        .toolbar2 {
            background: var(--bg-toolbar);
            border-bottom: 1px solid var(--border);
            padding: 4px 6px;
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
            height: var(--toolbar2-height);
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }
        
        .toolbar2::-webkit-scrollbar { display: none; }
        
        .toolbar-group {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 0 6px;
            border-left: 1px solid var(--border);
            flex-shrink: 0;
        }
        
        .toolbar-group:first-child { border-left: none; }
        .toolbar-group label { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

        /* Palette selector */
        .palette-selector {
            position: relative;
        }
        .palette-current {
            width: 60px;
            height: 20px;
            border-radius: 4px;
            border: 2px solid var(--border);
            cursor: pointer;
            background: linear-gradient(to right, #000, #fff);
            transition: border-color 0.2s;
        }
        .palette-current:hover {
            border-color: var(--primary);
        }
        .palette-dropdown {
            display: none;
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            margin-top: 8px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px;
            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            display: none;
        }
        .palette-dropdown.open {
            display: grid;
        }
        .palette-option {
            cursor: pointer;
            border-radius: 4px;
            padding: 2px;
            border: 2px solid transparent;
            transition: all 0.15s;
        }
        .palette-option:hover {
            border-color: var(--primary);
            transform: scale(1.05);
        }
        .palette-option.active {
            border-color: var(--accent);
        }
        .palette-preview {
            width: 50px;
            height: 16px;
            border-radius: 3px;
        }

        /* Surface detection group - visual grouping of Surface button with threshold controls */
        .surface-group {
            background: rgba(100, 150, 200, 0.15);
            border-radius: 8px;
            padding: 4px 8px;
            border: 1px solid rgba(100, 150, 200, 0.3);
            margin: 0 4px;
            position: relative;
        }

        .surface-group .threshold-label {
            position: absolute;
            top: -8px;
            right: 8px;
            font-size: 9px;
            color: var(--text-muted);
            background: var(--bg);
            padding: 0 4px;
        }

        .surface-group .toolbar-btn {
            margin-right: 6px;
        }

        .pm-btn {
            width: 32px;
            height: 32px;
            border: 1px solid var(--primary);
            border-radius: 6px;
            background: linear-gradient(to bottom, #3a5a7a, #2a4a6a);
            color: #fff;
            font-size: 18px;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        
        .pm-btn:active { transform: scale(0.95); background: linear-gradient(to bottom, #2a4a6a, #1a3a5a); }
        
        .value-display, .value-input {
            background: var(--bg-dark);
            border: 2px solid var(--primary);
            border-radius: 5px;
            padding: 5px 8px;
            font-size: 12px;
            font-weight: bold;
            color: var(--primary);
            font-family: 'SF Mono', Monaco, monospace;
            min-width: 44px;
            text-align: center;
        }
        
        .value-input { width: 52px; -moz-appearance: textfield; }
        .value-input::-webkit-outer-spin-button, .value-input::-webkit-inner-spin-button { -webkit-appearance: none; }
        
        .bg-btn, .xzoom-btn, .voie-btn {
            padding: 6px 10px;
            background: #404040;
            border: 1px solid #555;
            border-radius: 5px;
            color: #ddd;
            font-size: 11px;
            font-weight: 500;
            min-height: 32px;
            cursor: pointer;
        }
        
        .bg-btn:active, .xzoom-btn:active, .voie-btn:active { transform: scale(0.95); }
        .bg-btn.active, .xzoom-btn.active, .voie-btn.active { background: var(--primary-dark); border-color: var(--primary); color: #fff; }
        .voie-btn:disabled { background: var(--bg-secondary); border-color: #3a3a3a; color: #555; pointer-events: none; }
        
        .main-container {
            display: flex;
            flex: 1;
            min-height: 0;
            gap: 0;
            background: #1e1e1e;
            overflow: hidden;
            position: relative;
            flex-direction: row;
        }
        
        .file-list-panel {
            position: fixed;
            top: 0; left: 0; bottom: 0;
            width: 320px;
            max-width: 85vw;
            background: var(--bg-secondary);
            border-right: 2px solid var(--primary);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            z-index: 100;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
        }
        
        .file-list-panel.open { transform: translateX(0); }
        
        .file-list-header {
            background: linear-gradient(to bottom, #3a3a3a, var(--bg-toolbar));
            padding: 12px;
            font-size: 14px;
            font-weight: bold;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .file-list-close { width: 36px; height: 36px; border: none; background: transparent; color: #888; font-size: 28px; cursor: pointer; }
        .file-list { flex: 1; overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
        
        .file-drop-zone {
            padding: 20px 12px;
            margin: 8px 0;
            border: 2px dashed var(--primary);
            border-radius: 8px;
            text-align: center;
            font-size: 13px;
            font-weight: bold;
            color: var(--primary);
            cursor: pointer;
            background: rgba(74, 144, 217, 0.05);
        }
        
        .file-drop-zone:active { background: rgba(74, 144, 217, 0.15); }

        .folder-btn-inline {
            margin-left: 8px;
            padding: 4px 8px;
            background: rgba(74, 144, 217, 0.2);
            border: 1px solid var(--primary);
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s;
            vertical-align: middle;
        }
        .folder-btn-inline:hover {
            background: rgba(74, 144, 217, 0.4);
            transform: scale(1.05);
        }

        .sample-files-hint {
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px dashed rgba(255, 193, 7, 0.3);
            font-size: 11px;
            color: #888;
        }
        .sample-files-hint a {
            color: #f0a500;
            text-decoration: none;
            font-weight: 600;
        }
        .sample-files-hint a:hover {
            text-decoration: underline;
            color: #ffbb33;
        }
        .sample-files-hint .hint-icon {
            margin-right: 3px;
        }

        .file-item {
            padding: 12px 12px 12px 20px;
            margin: 6px 0;
            background: #333;
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            color: #bbb;
            position: relative;
            transition: border-color 0.15s, opacity 0.15s;
        }
        
        .file-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 28px; font-weight: 500; }
        .file-item-info { display: flex; gap: 8px; margin-top: 6px; font-size: 11px; color: #888; align-items: center; }
        .file-item-device { background: #8a5a2a; padding: 2px 6px; border-radius: 4px; color: #ddd; }
        .file-item-loading { animation: spin 1s linear infinite; font-size: 12px; }
        .file-item-loaded { color: var(--success); font-size: 12px; margin-right: 2px; }
        
        .file-item-delete {
            position: absolute;
            top: 8px; right: 8px;
            width: 28px; height: 28px;
            border: none;
            background: transparent;
            color: #666;
            font-size: 20px;
            cursor: pointer;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .file-item-delete:active { background: var(--danger); color: #fff; }
        .file-item-drag {
            position: absolute;
            left: 2px;
            top: 50%;
            transform: translateY(-50%);
            color: #555;
            font-size: 14px;
            cursor: grab;
            padding: 4px 2px;
            line-height: 1;
            user-select: none;
        }
        .file-item-drag:hover { color: #aaa; }
        .file-item-drag:active { cursor: grabbing; }
        .file-item.dragging { opacity: 0.4; border-style: dashed; }
        .file-item.drag-over { border-color: var(--primary); border-top: 2px solid var(--primary); margin-top: 2px; }
        .file-item:active { background: #3a4a5a; border-color: #5a8aba; }
        .file-item.active { background: var(--primary-dark); border-color: var(--primary); color: #fff; }
        .file-item.active .file-item-device { background: var(--accent); }
        
        .radargram-panel { flex: 1; display: flex; flex-direction: column; background: var(--bg-secondary); min-width: 0; overflow: hidden; position: relative; }
        .scale-toggle { position: absolute; top: 0; left: 0; width: 35px; height: 22px; background: #222; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-size: 8px; color: #aaa; user-select: none; }
        .scale-toggle:hover { background: #444; color: #fff; }
        .scale-toggle:active { background: #555; }
        .axis-x { height: 22px; background: #333; border-bottom: 1px solid var(--border); margin-left: 35px; overflow-x: auto; overflow-y: hidden; flex-shrink: 0; scrollbar-width: none; }
        .axis-x::-webkit-scrollbar { display: none; }
        .radargram-area { display: flex; flex: 1; overflow: auto; min-height: 0; background: var(--bg-dark); -webkit-overflow-scrolling: touch; }
        .axis-y { width: 35px; background: #333; border-right: 1px solid var(--border); flex-shrink: 0; position: sticky; left: 0; z-index: 2; }
        .canvas-wrapper { flex-shrink: 0; }
        #radargramCanvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
        
        .oscope-panel {
            position: fixed;
            top: 0; right: 0; bottom: 0;
            width: 260px;
            max-width: 85vw;
            background: var(--bg-secondary);
            border-left: 2px solid var(--primary);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            z-index: 100;
            transform: translateX(100%);
            transition: transform 0.3s ease;
        }
        
        .oscope-panel.open { transform: translateX(0); }
        
        .oscope-header {
            display: none;
        }
        
        .oscope-top-bar {
            background: #333;
            height: 22px;
            padding: 0 8px;
            font-size: 10px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            color: #aaa;
        }
        
        .oscope-close { width: 20px; height: 20px; border: none; background: transparent; color: #888; font-size: 16px; cursor: pointer; padding: 0; }
        .oscope-content { flex: 1; display: flex; min-height: 0; background: var(--bg-dark); overflow-y: auto; overflow-x: hidden; }
        .oscope-y-axis { width: 30px; background: var(--bg-secondary); flex-shrink: 0; }
        .oscope-canvas-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; }
        #oscopeCanvas { background: var(--bg-dark); display: block; }
        .oscope-x-axis { height: 22px; background: var(--bg-secondary); flex-shrink: 0; }
        
        .status-bar {
            background: var(--bg-toolbar);
            border-top: 1px solid var(--border);
            padding: 6px 10px;
            font-size: 11px;
            display: flex;
            gap: 10px;
            color: var(--text-muted);
            flex-shrink: 0;
            height: var(--status-height);
            overflow-x: auto;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
        }
        
        .status-bar::-webkit-scrollbar { display: none; }
        .status-bar span:first-child { color: #aaa; font-weight: 500; }
        
        .mobile-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 90; }
        .mobile-overlay.visible { display: block; }
        
        .upload-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(20,20,20,0.95); display: flex; align-items: center; justify-content: center; z-index: 200; }
        .upload-overlay.hidden { display: none; }
        .upload-box-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; }
        .upload-box { text-align: center; padding: 30px 20px; border: 3px dashed var(--primary); border-radius: 16px; cursor: pointer; background: var(--bg-panel); max-width: 90%; }
        .upload-box:active { background: #2a3a4a; }
        .upload-box .icon { font-size: 48px; color: var(--primary); }
        .upload-box p { margin-top: 15px; color: #aaa; font-size: 14px; }
        .upload-close-btn { position: absolute; top: -12px; right: -12px; width: 28px; height: 28px; border-radius: 50%; background: #444; border: 2px solid #666; color: #ccc; font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 10; }
        .upload-close-btn:hover { background: var(--danger); border-color: #c0392b; color: #fff; }
        .upload-folder-btn { margin-top: 16px; padding: 12px 20px; background: linear-gradient(135deg, #3a5a7a, #2a4a6a); border: 1px solid #4a7aaa; border-radius: 8px; color: #fff; font-size: 13px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 90%; box-sizing: border-box; }
        .upload-folder-btn:hover { background: linear-gradient(135deg, #4a6a8a, #3a5a7a); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }

        /* Folder loading overlay */
        .folder-loading-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(10, 10, 15, 0.97);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 250;
            backdrop-filter: blur(8px);
        }
        .folder-loading-overlay.visible { display: flex; }

        .folder-loading-container {
            width: 400px;
            max-width: 90%;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
        }

        .folder-loading-header {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px 0;
            border-bottom: 1px solid rgba(74, 144, 217, 0.3);
            margin-bottom: 16px;
        }

        .folder-loading-icon {
            font-size: 28px;
            animation: folder-pulse 1.5s ease-in-out infinite;
        }

        @keyframes folder-pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        .folder-loading-title {
            font-size: 18px;
            font-weight: 600;
            color: #fff;
        }

        .folder-loading-list {
            flex: 1;
            overflow: hidden;
            position: relative;
            min-height: 200px;
            max-height: 400px;
            mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
            -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
        }

        .folder-loading-list-inner {
            transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
        }

        .folder-loading-item {
            padding: 12px 16px;
            margin: 4px 0;
            border-radius: 8px;
            font-family: 'SF Mono', Monaco, monospace;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.3);
            background: transparent;
            transition: all 0.4s ease;
            display: flex;
            align-items: center;
            gap: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .folder-loading-item .file-icon {
            font-size: 16px;
            opacity: 0.5;
            transition: all 0.3s;
        }

        .folder-loading-item.loading {
            color: #4dabf7;
            background: rgba(74, 144, 217, 0.15);
            transform: scale(1.02);
            box-shadow: 0 0 20px rgba(74, 144, 217, 0.2);
        }

        .folder-loading-item.loading .file-icon {
            opacity: 1;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .folder-loading-item.done {
            color: rgba(40, 167, 69, 0.8);
        }

        .folder-loading-item.done .file-icon {
            opacity: 0.7;
        }

        .folder-loading-progress {
            margin-top: 20px;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            overflow: hidden;
        }

        .folder-loading-progress-bar {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #4dabf7, #74c0fc);
            border-radius: 2px;
            transition: width 0.3s ease;
        }

        .folder-loading-status {
            margin-top: 12px;
            text-align: center;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.5);
        }
        #fileInput { display: none; }
        
        .modal-panel {
            display: none;
            position: fixed;
            left: 10px; right: 10px; bottom: 50px;
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 14px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
            z-index: 150;
            max-height: 70vh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        .modal-panel.visible { display: block; }
        .modal-panel h3 { margin: 0 0 10px 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
        
        .picking-panel { border: 2px solid var(--success); min-width: 450px; max-width: 550px; left: auto; right: 20px; transform: none; max-height: 75vh; bottom: 20px; }
        .picking-panel h3 { color: var(--success); }
        .picking-stats { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .picking-stats-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; border-bottom: 1px solid #333; }
        .picking-stats-row:last-child { border-bottom: none; }
        .picking-stats-label { color: var(--text-muted); }
        .picking-stats-value { color: var(--primary); font-weight: bold; font-family: monospace; }
        .picking-global-stats { margin-top: 8px; padding-top: 8px; border-top: 2px solid #444; }
        .picking-stats-header { font-size: 11px; font-weight: bold; color: #e0e0e0; margin-bottom: 6px; text-align: center; }
        .picking-global-xy { display: flex; gap: 8px; margin-top: 6px; }
        .picking-xy-section { flex: 1; background: rgba(255,255,255,0.03); border-radius: 6px; padding: 6px; }
        .picking-xy-section .picking-stats-row { padding: 2px 0; font-size: 11px; }
        .picking-xy-header-x { color: #6fa8dc; }
        .picking-xy-header-y { color: #93c47d; }
        .picking-mode-selector { margin-bottom: 10px; padding: 8px; background: #333; border-radius: 6px; }
        .picking-mode-selector label { font-size: 11px; color: #aaa; display: block; margin-bottom: 6px; }
        .picking-mode-buttons { display: flex; gap: 6px; }
        .picking-mode-btn { flex: 1; padding: 6px 10px; background: #404040; border: 1px solid #555; border-radius: 4px; color: #ccc; font-size: 11px; cursor: pointer; transition: all 0.15s; }
        .picking-mode-btn:hover { background: #505050; }
        .picking-mode-btn.active { background: var(--success); border-color: var(--success); color: #fff; }
        .view3d-preset-btn { width: 44px; height: 44px; background: rgba(60,60,60,0.9); border: 1px solid #666; border-radius: 8px; color: #fff; font-size: 20px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
        .view3d-preset-btn:hover { background: rgba(80,80,80,0.95); border-color: #888; transform: scale(1.08); }
        .view3d-preset-btn:active { background: var(--primary); border-color: var(--primary); }
        .picking-points-list { max-height: 120px; overflow-y: auto; margin-bottom: 10px; }
        .picking-point-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #333; border-radius: 5px; margin-bottom: 4px; font-size: 11px; }
        .picking-point-color { width: 12px; height: 12px; border-radius: 50%; background: #ff6b6b; flex-shrink: 0; }
        .picking-point-color-v2 { width: 12px; height: 12px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
        .picking-point-info { flex: 1; }
        .picking-point-delete { background: transparent; border: none; color: #666; font-size: 18px; padding: 4px 8px; cursor: pointer; }
        .picking-point-delete:active { background: var(--danger); color: #fff; border-radius: 4px; }
        .picking-empty { text-align: center; color: #666; padding: 16px; font-size: 12px; }
        
        .btn-group { display: flex; gap: 8px; }
        .btn { flex: 1; padding: 10px 12px; border: none; border-radius: 6px; font-size: 13px; font-weight: bold; cursor: pointer; min-height: 44px; }
        .btn-danger { background: var(--danger); color: #fff; }
        .btn-danger:active { background: var(--danger); }
        .btn-danger.confirming { background: var(--danger); animation: blink 0.5s ease-in-out infinite; }
        @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
        .btn-secondary { background: #444; color: #ccc; }
        .btn-secondary:active { background: #555; }
        .btn-primary { background: var(--primary); color: #fff; }
        .btn-primary:active { background: var(--primary-dark); }

        /* CSV Dropdown */
        .csv-dropdown-container {
            position: relative;
            display: inline-block;
        }
        .csv-dropdown-menu {
            display: none;
            position: absolute;
            bottom: 100%;
            left: 0;
            margin-bottom: 4px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 6px;
            box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
            min-width: 180px;
            z-index: 100;
            overflow: hidden;
        }
        .csv-dropdown-menu.visible {
            display: block;
        }
        .csv-dropdown-item {
            display: block;
            width: 100%;
            padding: 10px 14px;
            background: transparent;
            border: none;
            color: var(--text);
            font-size: 13px;
            text-align: left;
            cursor: pointer;
            transition: background 0.15s;
        }
        .csv-dropdown-item:hover {
            background: var(--bg-dark);
        }
        .csv-dropdown-item:not(:last-child) {
            border-bottom: 1px solid var(--border);
        }
        .csv-dropdown-item:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .calibration-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
        .calibration-modal.visible { display: flex; }
        .calibration-dialog { background: var(--bg-secondary); border: 2px solid var(--accent); border-radius: 12px; padding: 20px; width: 100%; max-width: 320px; }
        .calibration-dialog h3 { color: var(--accent); margin: 0 0 16px 0; font-size: 18px; text-align: center; }
        .calibration-info { background: var(--bg-dark); border-radius: 8px; padding: 12px; margin-bottom: 16px; font-size: 13px; }
        .calibration-info .value { color: var(--primary); font-weight: bold; font-family: monospace; }
        .export-option-section { margin-bottom: 12px; }
        .export-option-section:last-child { margin-bottom: 0; }
        .export-option-label { display: block; font-size: 12px; color: #aaa; margin-bottom: 6px; }
        .export-toggle-buttons { display: flex; gap: 8px; }
        .export-toggle-btn { flex: 1; padding: 10px 12px; background: #404040; border: 2px solid #555; border-radius: 6px; color: #999; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
        .export-toggle-btn:hover { background: #505050; border-color: #666; }
        .export-toggle-btn.active { background: var(--success); border-color: var(--success); color: #fff; }
        .export-toggle-btn.active[data-value="false"] { background: #666; border-color: #666; }
        .export-toggle-btn.active[data-value="csv"] { background: #2196F3; border-color: #2196F3; }
        .export-toggle-buttons-3 .export-toggle-btn { padding: 10px 8px; font-size: 12px; }
        .detect-sensitivity-btn { flex: 1; padding: 10px 4px; background: #404040; border: 2px solid #555; border-radius: 6px; color: #ccc; cursor: pointer; font-size: 12px; text-align: center; line-height: 1.3; }
        .detect-sensitivity-btn.active { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
        .calibration-input-group { margin-bottom: 16px; }
        .calibration-input-group label { display: block; color: #ccc; margin-bottom: 8px; font-size: 14px; }
        .calibration-input { width: 100%; padding: 14px; font-size: 18px; background: var(--bg-dark); border: 2px solid #555; border-radius: 8px; color: #fff; text-align: center; font-family: monospace; }
        .calibration-input:focus { outline: none; border-color: var(--accent); }
        .calibration-result { margin-top: 12px; padding: 12px; background: #1a3a1a; border: 1px solid #3a6a3a; border-radius: 8px; color: #7aba7a; text-align: center; display: none; }
        .calibration-result.visible { display: block; }
        
        .measure-panel { position: fixed; bottom: 80px; right: 20px; background: var(--bg-secondary); border: 2px solid #00e5ff; border-radius: 12px; padding: 16px; z-index: 150; display: none; min-width: 200px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
        .measure-panel.visible { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
        .measure-info { display: flex; flex-direction: column; gap: 10px; width: 100%; }
        .measure-btn-clear { padding: 8px 16px; background: #c0392b; border: none; border-radius: 6px; color: #fff; cursor: pointer; font-size: 12px; margin-top: 8px; }
        .measure-btn-clear:hover { background: var(--danger); }
        .measure-value { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #404040; }
        .measure-value:last-child { border-bottom: none; }
        .measure-value .label { color: var(--text-muted); font-size: 12px; }
        .measure-value .val { color: #00e5ff; font-weight: bold; font-family: monospace; font-size: 16px; }
        .measure-value .val.avg { color: #90ee90; font-size: 14px; }
        .measure-count { color: var(--text-muted); font-size: 12px; font-weight: normal; }
        .measure-avg-section { display: none; width: 100%; }
        .measure-avg-section.visible { display: block; }
        .measure-panel.draggable h4 { cursor: grab; user-select: none; }
        .measure-panel.dragging { opacity: 0.9; }
        .measure-panel.dragging h4 { cursor: grabbing; }

        .calibration-mode, .calibration-mode canvas, .picking-mode, .picking-mode canvas, .measure-mode, .measure-mode canvas { cursor: crosshair !important; }
        .cut-mode, .cut-mode canvas { cursor: crosshair !important; }

        .toolbar-btn.cutting {
            background: linear-gradient(to bottom, #8a2a5a, #7a1a4a) !important;
            border-color: #d94090 !important;
            animation: pulse 1s ease-in-out infinite;
        }

        /* Draggable panel styles */
        .modal-panel.draggable { cursor: move; }
        .modal-panel.draggable h3 { cursor: move; user-select: none; }
        .modal-panel.dragging { opacity: 0.9; }

        /* CSV Export Modal */
        .csv-export-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); min-width: 280px; z-index: 1000; padding: 16px; }
        .csv-export-modal h4 { margin: 0 0 8px 0; color: #ff6b00; font-size: 14px; }

        /* Frequency Filter Panel */
        .freq-filter-panel { position: fixed; right: 20px; top: 150px; left: auto; bottom: auto; z-index: 300; }
        .freq-filter-panel h3 { color: var(--info); margin-bottom: 8px !important; }

        .switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #444; transition: 0.3s; border-radius: 24px; }
        .switch .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: #888; transition: 0.3s; border-radius: 50%; }
        .switch input:checked + .slider { background-color: var(--info); }
        .switch input:checked + .slider:before { transform: translateX(20px); background-color: #fff; }

        .filter-type-buttons { display: flex; gap: 4px; }
        .filter-type-btn { flex: 1; padding: 6px 4px; background: #404040; border: 1px solid #555; border-radius: 4px; color: #ddd; font-size: 10px; cursor: pointer; text-align: center; transition: all 0.2s; }
        .filter-type-btn:hover { background: #505050; }
        .filter-type-btn.active { background: #2a5a8a; border-color: var(--info); color: #fff; }

        .filter-freq-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
        .freq-control { display: flex; flex-direction: column; gap: 2px; }
        .freq-control label { font-size: 11px; color: #aaa; }

        .filter-preset { display: flex; align-items: center; gap: 8px; padding: 8px; background: rgba(255,255,255,0.05); border-radius: 6px; }
        .preset-label { flex: 1; font-size: 11px; color: #aaa; }
        .preset-label strong { color: var(--info); }

        /* Cross-section and histogram views in picking panel */
        .picking-views { display: flex; gap: 6px; margin-bottom: 10px; }
        .picking-view-btn { flex: 1; padding: 8px; background: #404040; border: 1px solid #555; border-radius: 5px; color: #ddd; font-size: 11px; cursor: pointer; text-align: center; }
        .picking-view-btn:active { transform: scale(0.95); }
        .picking-view-btn.active { background: var(--primary-dark); border-color: var(--primary); color: #fff; }

        /* Cross-section chart modal */
        .section-chart-container { width: 100%; height: 250px; background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; position: relative; }
        .section-chart-container canvas { width: 100%; height: 100%; }

        /* Circular section view */
        .circular-container { width: 100%; background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .circular-controls { display: flex; gap: 8px; margin-bottom: 10px; }
        .circular-control { display: flex; flex-direction: column; gap: 2px; }
        .circular-control label { font-size: 10px; color: var(--text-muted); }
        .circular-control input { width: 80px; padding: 4px 6px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 12px; }
        .circular-chart { width: 100%; height: 280px; display: flex; justify-content: center; align-items: center; }
        .circular-chart canvas { max-width: 100%; max-height: 100%; }
        .circular-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; padding: 8px; background: #252525; border-radius: 6px; }
        .circular-legend-item { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #ccc; }
        .circular-legend-color { width: 12px; height: 12px; border-radius: 50%; }

        /* Histogram chart */
        .histogram-container { width: 100%; background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .histogram-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: flex-end; }
        .histogram-control { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 70px; }
        .histogram-control label { font-size: 10px; color: var(--text-muted); }
        .histogram-control input[type="number"] { width: 100%; padding: 4px 6px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 12px; }
        .histogram-control.checkbox-control { flex-direction: row; align-items: center; gap: 6px; min-width: auto; flex: 0; }
        .histogram-control.checkbox-control label { font-size: 11px; white-space: nowrap; }
        .histogram-control.checkbox-control input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
        .histogram-chart { height: 280px; position: relative; padding: 25px 15px 60px 40px; box-sizing: border-box; }
        .histogram-chart-area { position: relative; width: 100%; height: 100%; border-left: 1px solid #666; border-bottom: 1px solid #666; }
        .histogram-bar { position: absolute; bottom: 0; border-radius: 2px 2px 0 0; min-width: 15px; }
        .histogram-bar.below-front { background: var(--danger); }
        .histogram-bar.above-front { background: var(--success); }
        .histogram-y-label { position: absolute; left: -30px; font-size: 9px; color: #888; transform: translateY(50%); }
        .histogram-x-label { position: absolute; bottom: -15px; font-size: 9px; color: #888; transform: translateX(-50%); }
        .histogram-percent-label { position: absolute; top: -20px; font-size: 11px; font-weight: bold; }
        .histogram-percent-label.below { color: var(--danger); }
        .histogram-percent-label.above { color: var(--success); }
        .histogram-total { text-align: center; font-size: 11px; color: #888; margin-top: 8px; }
        .histogram-axis-title { position: absolute; bottom: -35px; left: 50%; transform: translateX(-50%); font-size: 10px; color: #aaa; }
        .histogram-front-line { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--danger); z-index: 10; }
        .histogram-front-label { position: absolute; top: 50%; right: 5px; font-size: 9px; color: var(--danger); transform: translateY(-50%); white-space: nowrap; }

        /* Interface Panel */
        .interface-panel { border: 2px solid #ff6b00; min-width: 420px; max-width: 520px; left: auto; right: 20px; transform: none; max-height: 75vh; bottom: 20px; }
        .interface-panel h3 { color: #ff6b00; cursor: move; }
        .interface-selector { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .interface-selector > label { font-size: 11px; color: #aaa; display: block; margin-bottom: 6px; }
        .interface-selector-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
        .interface-selector-row select { flex: 1; padding: 6px 8px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 12px; }
        .interface-name-row { display: flex; gap: 6px; align-items: center; }
        .interface-name-row input[type="text"] { flex: 1; padding: 6px 8px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 12px; }
        .interface-name-row input[type="color"] { width: 36px; height: 28px; padding: 0; border: 1px solid #555; border-radius: 4px; cursor: pointer; }
        .btn-icon { width: 28px; height: 28px; padding: 0; background: #404040; border: 1px solid #555; border-radius: 4px; color: #ccc; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .btn-icon:hover { background: #505050; }
        .btn-icon.danger:hover { background: var(--danger); color: #fff; }
        .interface-mode-selector { margin-bottom: 10px; padding: 8px; background: #333; border-radius: 6px; }
        .interface-mode-selector label { font-size: 11px; color: #aaa; display: block; margin-bottom: 6px; }
        .interface-mode-hint { font-size: 11px; color: #888; text-align: center; padding: 4px; }
        .interface-mode-hint span { background: #404040; padding: 4px 8px; border-radius: 4px; display: inline-block; }
        .interface-resolution-selector { margin-bottom: 10px; padding: 8px; background: #333; border-radius: 6px; }
        .interface-resolution-selector label { font-size: 11px; color: #aaa; display: block; margin-bottom: 6px; }
        .interface-resolution-selector select { width: 100%; padding: 6px 8px; background: #222; border: 1px solid #444; border-radius: 4px; color: #fff; font-size: 12px; }
        .interface-stats { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .interface-stats-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 12px; border-bottom: 1px solid #333; }
        .interface-stats-row:last-child { border-bottom: none; }
        .interface-stats-label { color: var(--text-muted); flex: 1; }
        .interface-stats-value { color: #ff6b00; font-weight: bold; font-family: monospace; min-width: 60px; text-align: right; }
        .interface-stats-pos { color: #888; font-size: 10px; font-family: monospace; min-width: 50px; text-align: right; margin-left: 8px; }
        .interface-thickness-section { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; border-left: 3px solid #ff6b00; }
        .interface-section-title { font-size: 11px; color: #ff6b00; font-weight: bold; margin-bottom: 8px; text-transform: uppercase; }
        .interface-thickness-item { background: var(--bg-secondary); border-radius: 6px; padding: 8px; margin-bottom: 6px; }
        .interface-thickness-item:last-child { margin-bottom: 0; }
        .interface-thickness-header { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #ccc; margin-bottom: 4px; }
        .interface-thickness-color { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
        .interface-thickness-arrow { color: #666; }
        .interface-thickness-values { display: flex; justify-content: space-between; font-size: 11px; }
        .interface-thickness-val { display: flex; flex-direction: column; align-items: center; }
        .interface-thickness-val-label { color: #666; font-size: 9px; }
        .interface-thickness-val-num { color: #00b894; font-weight: bold; font-family: monospace; }
        .interface-thickness-val-pos { color: #888; font-size: 9px; font-family: monospace; }
        .interface-preview { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
        .interface-preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 11px; color: #aaa; }
        .interface-preview canvas { width: 100%; height: 100px; background: #1a1a1a; border-radius: 4px; }
        .interface-chart-container { width: 100%; height: 400px; background: #1a1a1a; border-radius: 8px; padding: 10px; }
        .interface-chart-container canvas { width: 100%; height: 100%; }
        .interface-chart-stats { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 16px; padding: 12px; background: var(--bg-dark); border-radius: 8px; }
        .interface-chart-stat { text-align: center; }
        .interface-chart-stat-label { font-size: 11px; color: #888; display: block; }
        .interface-chart-stat-value { font-size: 18px; font-weight: bold; color: #ff6b00; }
        .interface-mode, .interface-mode canvas { cursor: crosshair !important; }
        .eraser-cursor, .eraser-cursor canvas { cursor: cell !important; }

        /* Epsilon Configuration Section */
        .interface-epsilon-section { background: var(--bg-dark); border-radius: 8px; padding: 10px; margin-bottom: 10px; border-left: 3px solid #0984e3; }
        .interface-section-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
        .interface-section-header .toggle { background: none; border: none; color: #888; font-size: 10px; padding: 2px 6px; }
        .epsilon-section-content { margin-top: 8px; }
        .epsilon-section-content.collapsed { display: none; }

        .epsilon-mode-selector { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
        .epsilon-mode-option { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #ccc; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
        .epsilon-mode-option:hover { background: #333; }
        .epsilon-mode-option input[type="radio"] { accent-color: #0984e3; margin: 0; }

        /* Mode Manuel: Couches */
        .epsilon-manual-config { margin-top: 8px; }
        .epsilon-layer-item { background: var(--bg-secondary); border-radius: 6px; padding: 8px; margin-bottom: 6px; }
        .epsilon-layer-item:last-child { margin-bottom: 0; }
        .epsilon-layer-header { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #888; margin-bottom: 6px; }
        .epsilon-layer-colors { display: flex; align-items: center; gap: 3px; }
        .epsilon-layer-color { width: 10px; height: 10px; border-radius: 2px; }
        .epsilon-layer-arrow { color: #555; font-size: 8px; }
        .epsilon-layer-input-row { display: flex; align-items: center; gap: 8px; }
        .epsilon-layer-input-row label { color: #aaa; font-size: 11px; min-width: 20px; }
        .epsilon-layer-input-row input[type="number"] { width: 55px; padding: 4px 6px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 11px; text-align: center; }
        .epsilon-layer-input-row input[type="range"] { flex: 1; height: 4px; -webkit-appearance: none; background: linear-gradient(to right, #27ae60, var(--warning), var(--danger)); border-radius: 2px; }
        .epsilon-layer-input-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: #fff; border-radius: 50%; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
        .epsilon-material-hint { font-size: 9px; color: #666; text-align: right; min-width: 45px; }

        /* Mode Sondage */
        .epsilon-sounding-config { margin-top: 8px; }
        .sounding-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        .sounding-toolbar .btn-small { font-size: 10px; padding: 4px 8px; background: #0984e3; border: none; border-radius: 4px; color: #fff; cursor: pointer; display: flex; align-items: center; gap: 4px; }
        .sounding-toolbar .btn-small:hover { background: #0773c7; }
        .sounding-distance-input { display: flex; align-items: center; gap: 4px; }
        .sounding-distance-input input { width: 80px; padding: 4px 6px; background: #333; border: 1px solid #555; border-radius: 4px; color: #fff; font-size: 11px; }
        .sounding-distance-input .btn-icon { padding: 4px 6px; font-size: 10px; }
        .sounding-hint { font-size: 10px; color: #0984e3; margin: 6px 0; padding: 6px 8px; background: rgba(9,132,227,0.1); border-radius: 4px; }

        .soundings-list { margin-top: 8px; }
        .sounding-card { background: var(--bg-secondary); border-radius: 8px; padding: 10px; margin-bottom: 8px; border-left: 3px solid #00b894; }
        .sounding-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
        .sounding-card-title { font-weight: bold; color: #fff; font-size: 11px; }
        .sounding-card-position { font-size: 10px; color: #00b894; font-family: monospace; }
        .sounding-card-delete { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; padding: 2px 6px; }
        .sounding-card-delete:hover { color: #c0392b; }

        .sounding-layer { background: #333; border-radius: 6px; padding: 8px; margin-bottom: 6px; }
        .sounding-layer:last-child { margin-bottom: 0; }
        .sounding-layer-title { font-size: 9px; color: #888; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
        .sounding-layer-color { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
        .sounding-layer-row { display: flex; justify-content: space-between; align-items: center; font-size: 10px; margin-bottom: 4px; }
        .sounding-layer-row:last-child { margin-bottom: 0; }
        .sounding-layer-row label { color: #aaa; }
        .sounding-layer-row input { width: 55px; padding: 3px 5px; background: #222; border: 1px solid #444; border-radius: 3px; color: #fff; font-size: 10px; text-align: right; }
        .sounding-layer-row .value { color: #888; font-family: monospace; }
        .sounding-epsilon-result { color: #00b894; font-weight: bold; font-family: monospace; }

        /* Section Appliquer à l'échelle */
        .sounding-apply-section { margin-top: 12px; padding: 10px; background: rgba(255,107,0,0.1); border-radius: 6px; border: 1px solid rgba(255,107,0,0.3); }
        .sounding-apply-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 11px; color: #aaa; }
        .sounding-apply-info strong { color: #ff6b00; font-size: 14px; font-family: monospace; }
        #applySoundingEpsilonBtn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }

        /* Marqueur sondage sur radargramme */
        .sounding-marker-canvas { position: absolute; pointer-events: none; }

        /* Interface Chart Modal */
        #interfaceChartModal {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10000;
        }
        #interfaceChartModal.visible { display: flex; }
        #interfaceChartModal .modal-content {
            background: var(--bg-panel);
            border-radius: 16px;
            width: 95%;
            max-width: 1200px;
            max-height: 90vh;
            padding: 24px;
            overflow: auto;
        }
        #interfaceChartModal h2 { color: #ff6b00; margin: 0 0 16px 0; text-align: center; }
        #interfaceChartModal .interface-chart-container { width: 100%; height: 450px; background: #1a1a1a; border-radius: 8px; padding: 10px; }
        #interfaceChartModal .modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }

        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: var(--bg-secondary); }
        ::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }
        
        @media (min-width: 900px) {
            .app-container { width: 100%; }
            .file-list-panel { position: relative !important; transform: none !important; width: 280px; min-width: 280px; flex-shrink: 0; z-index: 1; border-right: 1px solid var(--border); border-radius: 0; overflow: hidden; }
            .file-list-close { display: none; }
            #filesMenuBtn { display: none; }
            .mobile-overlay { display: none !important; }
            .toolbar { flex-wrap: wrap; overflow-x: visible; }
            .toolbar-btn { min-width: 70px; }
            .toolbar-btn .label { display: block; }
            .oscope-panel { position: relative !important; transform: none !important; width: 0; height: auto; flex-shrink: 0; border-radius: 0; bottom: auto; left: auto; border: none; overflow: hidden; transition: width 0.3s; }
            .oscope-panel.open { width: 200px; border-left: 1px solid var(--border); display: flex !important; }
            .oscope-close { display: none; }
            .radargram-panel { flex: 1; }
            /* GPS panel inline on desktop - completely hidden when not open */
            .gps-side-panel {
                position: absolute !important;
                right: 0 !important;
                top: 0 !important;
                width: 0 !important;
                min-width: 0 !important;
                height: 0 !important;
                overflow: hidden;
                opacity: 0;
                pointer-events: none;
            }
            .gps-side-panel.open {
                position: relative !important;
                right: auto !important;
                top: auto !important;
                width: var(--gps-panel-width, 350px) !important;
                min-width: 200px !important;
                max-width: 600px !important;
                height: auto !important;
                flex-shrink: 0;
                border-radius: 8px 0 0 8px;
                margin-left: 8px;
                border-left: none;
                display: flex !important;
                opacity: 1;
                pointer-events: auto;
                box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
                transition: opacity 0.5s ease;
            }
            .cursor-display { min-width: 220px; }
            .pm-btn { width: 32px; height: 32px; }
            .toolbar-group label { display: inline; }
        }
        
        @media (max-width: 360px) {
            .toolbar-btn { min-width: 42px; padding: 3px 6px; }
            .toolbar-btn .label { display: none; }
            .toolbar-btn .icon { font-size: 20px; }
            .toolbar-group label { display: none; }
            .cursor-display { min-width: 110px; font-size: 9px; }
        }
        
        @media (max-height: 450px) and (orientation: landscape) {
            :root { --toolbar-height: 44px; --toolbar2-height: 38px; --status-height: 28px; }
            .toolbar-btn { min-height: 36px; padding: 3px 6px; }
            .toolbar-btn .label { display: none; }
            .pm-btn { width: 28px; height: 28px; }
            .modal-panel { max-height: 55vh; }
        }

        /* Auth Screen Styles */
        .auth-screen {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }
        .auth-screen.hidden { display: none; }
        .auth-container {
            background: var(--bg-panel);
            border-radius: 16px;
            padding: 32px;
            width: 90%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 1px solid var(--border);
            position: relative;
        }
        .auth-lang-selector {
            display: flex;
            justify-content: center;
            gap: 6px;
            margin-bottom: 16px;
        }
        .auth-lang-btn {
            background: var(--bg-dark);
            border: 2px solid transparent;
            border-radius: 6px;
            padding: 4px 6px;
            cursor: pointer;
            opacity: 0.6;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .auth-lang-btn:hover {
            opacity: 1;
            background: var(--bg-hover);
        }
        .auth-lang-btn.active {
            opacity: 1;
            border-color: var(--primary);
            background: var(--bg-hover);
        }
        .auth-logo {
            text-align: center;
            margin-bottom: 24px;
        }
        .auth-logo img { height: 50px; }
        .auth-title {
            text-align: center;
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text);
        }
        .auth-subtitle {
            text-align: center;
            color: var(--text-muted);
            margin-bottom: 24px;
            font-size: 14px;
        }
        .auth-tabs {
            display: flex;
            margin-bottom: 24px;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--border);
        }
        .auth-tab {
            flex: 1;
            padding: 12px;
            text-align: center;
            background: var(--bg-dark);
            color: var(--text-muted);
            cursor: pointer;
            border: none;
            font-size: 14px;
            transition: all 0.2s;
        }
        .auth-tab.active {
            background: var(--primary);
            color: white;
        }
        .auth-form { display: none; }
        .auth-form.active { display: block; }
        .auth-field {
            margin-bottom: 16px;
        }
        .auth-field label {
            display: block;
            margin-bottom: 6px;
            font-size: 13px;
            color: var(--text-muted);
        }
        .auth-field input,
        .auth-field select {
            width: 100%;
            padding: 12px 14px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--bg-dark);
            color: var(--text);
            font-size: 14px;
            transition: border-color 0.2s;
        }
        .auth-field select {
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 32px;
            cursor: pointer;
        }
        .auth-field input:focus,
        .auth-field select:focus {
            outline: none;
            border-color: var(--primary);
        }
        .auth-field-row {
            display: flex;
            gap: 12px;
        }
        .auth-field-row .auth-field { flex: 1; }
        .auth-btn {
            width: 100%;
            padding: 14px;
            border: none;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            margin-top: 8px;
        }
        .auth-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(74, 144, 217, 0.4);
        }
        .auth-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }
        .auth-link {
            text-align: center;
            margin-top: 16px;
            font-size: 13px;
            color: var(--text-muted);
        }
        .auth-link a {
            color: var(--primary);
            text-decoration: none;
            cursor: pointer;
        }
        .auth-link a:hover { text-decoration: underline; }

        /* Checkbox fields for registration */
        .auth-checkbox {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            margin: 12px 0;
            font-size: 13px;
            color: var(--text-muted);
        }
        .auth-checkbox input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin-top: 2px;
            accent-color: var(--primary);
            cursor: pointer;
            flex-shrink: 0;
        }
        .auth-checkbox label {
            cursor: pointer;
            line-height: 1.4;
        }
        .auth-checkbox a {
            color: var(--primary);
            text-decoration: underline;
            cursor: pointer;
        }
        .auth-checkbox.disabled {
            opacity: 0.6;
        }
        .auth-checkbox.disabled input[type="checkbox"] {
            cursor: not-allowed;
        }
        .auth-checkbox .required-star {
            color: var(--danger);
        }

        /* Terms Modal */
        .terms-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 40000;
            padding: 20px;
        }
        .terms-modal-overlay.visible { display: flex; }
        .terms-modal {
            background: var(--bg-panel);
            border-radius: 12px;
            width: 100%;
            max-width: 800px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        }
        .terms-modal-header {
            padding: 20px 24px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .terms-modal-header h2 {
            color: var(--text);
            font-size: 20px;
            margin: 0;
        }
        .terms-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 24px;
            cursor: pointer;
            padding: 5px;
        }
        .terms-modal-close:hover { color: var(--text); }
        .terms-modal-content {
            padding: 24px;
            overflow-y: auto;
            flex: 1;
            color: var(--text);
            font-size: 14px;
            line-height: 1.6;
        }
        .terms-modal-content h3 {
            color: var(--accent);
            margin-top: 24px;
            margin-bottom: 12px;
            font-size: 16px;
        }
        .terms-modal-content h3:first-child {
            margin-top: 0;
        }
        .terms-modal-content p {
            margin-bottom: 12px;
        }
        .terms-modal-content ul {
            margin: 12px 0;
            padding-left: 24px;
        }
        .terms-modal-content li {
            margin-bottom: 8px;
        }

        /* About Modal */
        .about-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 40000;
            padding: 20px;
        }
        .about-modal-overlay.visible { display: flex; }
        .about-modal {
            background: linear-gradient(135deg, #2a2a3a 0%, #1a1a2a 100%);
            border-radius: 16px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 25px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1);
            overflow: hidden;
        }
        .about-modal-header {
            padding: 16px 20px;
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(255,255,255,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .about-modal-header h2 {
            color: var(--text);
            font-size: 16px;
            margin: 0;
            font-weight: 500;
        }
        .about-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 22px;
            cursor: pointer;
            padding: 5px;
            line-height: 1;
            transition: color 0.2s;
        }
        .about-modal-close:hover { color: var(--text); }
        .about-modal-content {
            padding: 30px 24px;
            text-align: center;
            color: var(--text);
        }
        .about-logo {
            margin-bottom: 16px;
        }
        .about-logo img {
            width: 64px;
            height: 64px;
        }
        .about-logo-fallback {
            font-size: 48px;
            display: block;
        }
        .about-logo img + .about-logo-fallback {
            display: none;
        }
        .about-app-name {
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 4px;
            letter-spacing: 0.5px;
        }
        .about-subtitle {
            font-size: 13px;
            color: var(--text-muted);
            margin-bottom: 8px;
        }
        .about-version {
            font-size: 14px;
            color: var(--text);
            margin-bottom: 20px;
            padding: 6px 16px;
            background: rgba(0,0,0,0.2);
            border-radius: 20px;
            display: inline-block;
        }
        .about-company {
            font-size: 13px;
            color: var(--text);
            line-height: 1.7;
            margin-bottom: 16px;
            padding: 16px;
            background: rgba(0,0,0,0.15);
            border-radius: 10px;
        }
        .about-company strong {
            color: var(--accent);
            font-size: 14px;
        }
        .about-company a {
            color: var(--accent);
            text-decoration: none;
        }
        .about-company a:hover {
            text-decoration: underline;
        }
        .about-copyright {
            font-size: 11px;
            color: var(--text-muted);
            margin-bottom: 20px;
        }
        .about-actions {
            margin-bottom: 16px;
        }
        .about-btn {
            background: linear-gradient(135deg, var(--accent), #1e90ff);
            border: none;
            color: white;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
            box-shadow: 0 4px 15px rgba(0,180,216,0.3);
        }
        .about-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0,180,216,0.4);
        }
        .about-legal-notice {
            font-size: 10px;
            color: var(--text-muted);
            line-height: 1.5;
            padding: 12px;
            background: rgba(255,200,0,0.1);
            border-radius: 8px;
            border: 1px solid rgba(255,200,0,0.2);
        }

        /* Feedback Modal */
        .feedback-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 40000;
            padding: 20px;
        }
        .feedback-modal-overlay.visible { display: flex; }
        .feedback-modal {
            background: linear-gradient(135deg, #2a2a3a 0%, #1a1a2a 100%);
            border-radius: 16px;
            width: 100%;
            max-width: 460px;
            box-shadow: 0 25px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1);
            overflow: hidden;
        }
        .feedback-modal-header {
            padding: 14px 20px;
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(255,255,255,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .feedback-modal-header h2 {
            color: var(--text);
            font-size: 15px;
            margin: 0;
            font-weight: 500;
        }
        .feedback-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 22px;
            cursor: pointer;
            padding: 5px;
            line-height: 1;
            transition: color 0.2s;
        }
        .feedback-modal-close:hover { color: var(--text); }
        .feedback-modal-content {
            padding: 18px 22px;
            color: var(--text);
        }
        .feedback-type-selector { margin-bottom: 14px; }
        .feedback-type-buttons { display: flex; gap: 8px; }
        .feedback-type-btn {
            flex: 1;
            padding: 9px 12px;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 8px;
            background: rgba(0,0,0,0.2);
            color: var(--text);
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
            text-align: center;
        }
        .feedback-type-btn.active {
            border-color: var(--accent);
            background: rgba(0,180,216,0.15);
        }
        .feedback-type-btn:hover { border-color: var(--accent); }
        .feedback-field { margin-bottom: 12px; }
        .feedback-field label {
            display: block;
            font-size: 12px;
            color: var(--text-muted);
            margin-bottom: 5px;
        }
        .feedback-field textarea,
        .feedback-field input {
            width: 100%;
            padding: 9px 11px;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 8px;
            background: rgba(0,0,0,0.3);
            color: var(--text);
            font-size: 13px;
            font-family: inherit;
            resize: vertical;
            box-sizing: border-box;
        }
        .feedback-field textarea:focus,
        .feedback-field input:focus {
            outline: none;
            border-color: var(--accent);
        }
        .feedback-meta {
            font-size: 10px;
            color: var(--text-muted);
            margin-bottom: 14px;
            padding: 7px 10px;
            background: rgba(0,0,0,0.15);
            border-radius: 6px;
            line-height: 1.6;
        }
        .feedback-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        .feedback-cancel-btn {
            padding: 9px 16px;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 8px;
            background: transparent;
            color: var(--text);
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
        }
        .feedback-cancel-btn:hover {
            border-color: rgba(255,255,255,0.3);
        }
        .feedback-submit-btn {
            padding: 9px 18px;
            border: none;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--accent), #1e90ff);
            color: white;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            box-shadow: 0 4px 15px rgba(0,180,216,0.3);
            transition: all 0.2s;
        }
        .feedback-submit-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(0,180,216,0.4);
        }
        .feedback-submit-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }
        .feedback-message {
            margin-top: 10px;
            font-size: 13px;
            text-align: center;
            min-height: 20px;
        }
        .feedback-message.success { color: #2ecc71; }
        .feedback-message.error { color: #e74c3c; }

        /* Data Warning Modal (first connection) */
        .warning-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 45000;
            padding: 20px;
        }
        .warning-modal-overlay.visible { display: flex; }
        .warning-modal {
            background: var(--bg-panel);
            border-radius: 12px;
            width: 100%;
            max-width: 500px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 2px solid var(--warning, var(--warning));
        }
        .warning-modal-header {
            padding: 20px 24px;
            border-bottom: 1px solid var(--border);
            text-align: center;
        }
        .warning-modal-header h2 {
            color: var(--warning, var(--warning));
            font-size: 20px;
            margin: 0;
        }
        .warning-modal-body {
            padding: 24px;
            text-align: center;
        }
        .warning-modal-icon {
            font-size: 48px;
            margin-bottom: 16px;
        }
        .warning-modal-text {
            color: var(--text);
            font-size: 15px;
            line-height: 1.6;
            margin-bottom: 24px;
        }
        .warning-modal-btn {
            background: var(--warning, var(--warning));
            color: #000;
            border: none;
            padding: 14px 32px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .warning-modal-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 20px rgba(243, 156, 18, 0.4);
        }

        /* Disconnect modal specific styles */
        .disconnect-modal {
            border-color: var(--danger, var(--danger));
        }
        .disconnect-modal .warning-modal-header h2 {
            color: var(--danger, var(--danger));
        }
        .disconnect-icon {
            color: var(--danger, var(--danger));
        }
        .disconnect-btn {
            background: var(--danger, var(--danger));
            color: #fff;
        }
        .disconnect-btn:hover {
            box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
        }

        /* License Conflict Modal specific styles */
        .license-conflict-modal {
            border-color: var(--accent, var(--info));
            max-width: 480px;
        }
        .license-conflict-modal .warning-modal-header h2 {
            color: var(--accent, var(--info));
        }
        .license-icon {
            color: var(--accent, var(--info));
        }
        .license-session-info {
            background: rgba(52, 152, 219, 0.1);
            border: 1px solid rgba(52, 152, 219, 0.3);
            border-radius: 8px;
            padding: 16px;
            margin: 16px 0;
        }
        .session-device {
            font-size: 18px;
            font-weight: 600;
            color: var(--text);
            margin-bottom: 4px;
        }
        .session-time {
            font-size: 14px;
            color: var(--text-muted);
        }
        .license-conflict-question {
            font-size: 14px;
            color: var(--text-muted);
            margin-top: 16px;
        }
        .license-conflict-buttons {
            display: flex;
            gap: 12px;
            justify-content: center;
        }
        .license-cancel-btn {
            background: var(--bg-secondary, var(--bg-secondary));
            color: var(--text);
            border: 1px solid var(--border);
        }
        .license-cancel-btn:hover {
            background: var(--bg-hover, #333);
            box-shadow: none;
        }
        .license-takeover-btn {
            background: var(--accent, var(--info));
            color: #fff;
        }
        .license-takeover-btn:hover {
            box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
        }

        /* Connection Attempt Notification (for first user) */
        .connection-attempt-notification {
            position: fixed;
            top: 20px;
            right: 20px;
            background: var(--bg-panel);
            border: 2px solid var(--warning, var(--warning));
            border-radius: 12px;
            padding: 16px 20px;
            display: none;
            align-items: flex-start;
            gap: 12px;
            max-width: 380px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.4);
            z-index: 50000;
            animation: slideInRight 0.3s ease-out;
        }
        .connection-attempt-notification.visible {
            display: flex;
        }
        @keyframes slideInRight {
            from {
                transform: translateX(100%);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }
        .connection-attempt-notification .notification-icon {
            font-size: 28px;
            flex-shrink: 0;
        }
        .connection-attempt-notification .notification-content {
            flex: 1;
        }
        .connection-attempt-notification .notification-title {
            font-weight: 600;
            color: var(--warning, var(--warning));
            margin-bottom: 4px;
        }
        .connection-attempt-notification .notification-text {
            font-size: 13px;
            color: var(--text);
            line-height: 1.5;
        }
        .connection-attempt-notification .notification-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 20px;
            cursor: pointer;
            padding: 0;
            line-height: 1;
        }
        .connection-attempt-notification .notification-close:hover {
            color: var(--text);
        }

        .auth-error {
            background: rgba(192, 57, 43, 0.2);
            border: 1px solid var(--danger);
            color: var(--danger);
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 16px;
            font-size: 13px;
            display: none;
        }
        .auth-error.visible { display: block; }
        .auth-success {
            background: rgba(64, 217, 144, 0.2);
            border: 1px solid var(--success);
            color: var(--success);
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 16px;
            font-size: 13px;
            display: none;
        }
        .auth-success.visible { display: block; }
        .auth-back {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 13px;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .auth-back:hover { color: var(--text); }
        /* Menu utilisateur intégré à la toolbar */
        .user-menu-toolbar {
            position: relative;
            flex-shrink: 0;
        }
        .user-btn-toolbar {
            min-width: auto;
            padding: 4px 12px;
        }
        .user-btn-toolbar .label {
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .user-dropdown {
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 4px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 10px;
            min-width: 200px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.6);
            display: none;
            z-index: 10001;
            overflow: hidden;
        }
        .user-dropdown.visible { display: block; }
        .user-dropdown-header {
            padding: 14px 16px;
            background: linear-gradient(to bottom, #3a3a3a, #2d2d2d);
            border-bottom: 1px solid var(--border);
            font-size: 12px;
            color: var(--text-muted);
        }
        .user-dropdown-header strong {
            display: block;
            color: var(--text);
            font-size: 14px;
            margin-bottom: 2px;
        }
        .user-dropdown-item {
            padding: 14px 16px;
            cursor: pointer;
            font-size: 14px;
            color: var(--text);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background 0.15s;
        }
        .user-dropdown-item:last-child { border-bottom: none; }
        .user-dropdown-item:hover { background: var(--bg-dark); }
        .user-dropdown-item.danger { color: var(--danger); }
        .user-dropdown-item.danger:hover { background: rgba(231, 76, 60, 0.15); }

        /* Profile Modal */
        .profile-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.7);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 20000;
        }
        .profile-modal-overlay.visible { display: flex; }
        .profile-modal {
            background: var(--bg-panel);
            border-radius: 16px;
            width: 90%;
            max-width: 450px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 1px solid var(--border);
            overflow: hidden;
        }
        .profile-modal-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            padding: 20px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .profile-modal-header h2 {
            margin: 0;
            font-size: 18px;
            color: white;
        }
        .profile-modal-close {
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            opacity: 0.8;
        }
        .profile-modal-close:hover { opacity: 1; }
        .profile-modal-body {
            padding: 24px;
        }
        .profile-field {
            margin-bottom: 16px;
        }
        .profile-field label {
            display: block;
            margin-bottom: 6px;
            font-size: 13px;
            color: var(--text-muted);
        }
        .profile-field input,
        .profile-field select {
            width: 100%;
            padding: 12px 14px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--bg-dark);
            color: var(--text);
            font-size: 14px;
            box-sizing: border-box;
        }
        .profile-field select {
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 36px;
            cursor: pointer;
        }
        .profile-field select option {
            background: var(--bg-dark, #1a1a2e);
            color: var(--text, #e0e0e0);
            padding: 8px;
        }
        .profile-field input:focus,
        .profile-field select:focus {
            outline: none;
            border-color: var(--primary);
        }
        .profile-field input:disabled,
        .profile-field select:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }
        .profile-field-row {
            display: flex;
            gap: 12px;
        }
        .profile-field-row .profile-field { flex: 1; }
        .profile-btn {
            width: 100%;
            padding: 14px;
            border: none;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 8px;
        }
        .profile-btn:hover {
            opacity: 0.9;
        }
        .profile-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }
        .profile-message {
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 16px;
            font-size: 13px;
            display: none;
        }
        .profile-message.success {
            background: rgba(64, 217, 144, 0.2);
            border: 1px solid var(--success);
            color: var(--success);
            display: block;
        }
        .profile-message.error {
            background: rgba(192, 57, 43, 0.2);
            border: 1px solid var(--danger);
            color: var(--danger);
            display: block;
        }

        /* IA Detection Button - active only when detections exist */
        .ia-detect-btn.active {
            background: linear-gradient(to bottom, #2a8a5a, #1a6a4a) !important;
            border-color: #3aa06a !important;
        }
        .ia-detect-btn.active:hover {
            background: linear-gradient(to bottom, #3a9a6a, #2a7a5a) !important;
        }
        .ia-detect-btn.loading {
            opacity: 0.7;
            pointer-events: none;
        }

        /* IA Detection Settings Panel */
        .ia-detect-panel {
            position: absolute;
            top: 100%;
            right: 0;
            background: rgba(30, 30, 40, 0.98);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 8px;
            padding: 15px;
            min-width: 220px;
            display: none;
            z-index: 1000;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        }
        .ia-detect-panel.visible {
            display: block;
        }
        .ia-detect-panel h4 {
            color: #4CAF50;
            margin-bottom: 12px;
            font-size: 14px;
        }
        .ia-detect-modes {
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 5px;
            padding: 8px;
            margin-bottom: 10px;
            background: rgba(0,0,0,0.2);
        }
        .ia-detect-option {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
            cursor: pointer;
            color: #ccc;
            transition: color 0.2s;
        }
        .ia-detect-option:hover {
            color: #fff;
        }
        .ia-detect-option input[type="radio"] {
            accent-color: #4CAF50;
        }
        .ia-detect-option.selected {
            color: #4CAF50;
        }
        .ia-detect-run {
            width: 100%;
            margin-top: 12px;
            padding: 10px;
            background: linear-gradient(to bottom, #4CAF50, #388E3C);
            border: none;
            border-radius: 5px;
            color: white;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s;
        }
        .ia-detect-run:hover {
            background: linear-gradient(to bottom, #5CBF60, #43A047);
        }
        .ia-detect-run:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .ia-detect-status {
            font-size: 11px;
            color: #888;
            margin-top: 8px;
            text-align: center;
        }

        /* Admin Panel Styles */
        .admin-btn {
            background: linear-gradient(to bottom, #8a2a5a, #6a1a4a) !important;
            border-color: #a03a6a !important;
        }
        .admin-btn:hover {
            background: linear-gradient(to bottom, #9a3a6a, #7a2a5a) !important;
        }
        .admin-panel-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.85);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 30000;
            padding: 20px;
        }
        .admin-panel-overlay.visible { display: flex; }
        .admin-panel {
            background: var(--bg-panel);
            border-radius: 16px;
            width: 95%;
            max-width: 1400px;
            max-height: 90vh;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 2px solid #a03a6a;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .admin-panel-header {
            background: linear-gradient(135deg, #8a2a5a 0%, #6a1a4a 100%);
            padding: 16px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }
        .admin-panel-header h2 {
            margin: 0;
            font-size: 18px;
            color: white;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .admin-panel-close {
            background: none;
            border: none;
            color: white;
            font-size: 28px;
            cursor: pointer;
            opacity: 0.8;
            line-height: 1;
        }
        .admin-panel-close:hover { opacity: 1; }
        .admin-panel-toolbar {
            background: var(--bg-toolbar);
            padding: 12px 16px;
            display: flex;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        .admin-panel-toolbar .admin-stat {
            background: var(--bg-dark);
            padding: 8px 14px;
            border-radius: 6px;
            font-size: 13px;
            color: var(--text-muted);
        }
        .admin-panel-toolbar .admin-stat strong {
            color: var(--primary);
            font-size: 16px;
        }
        .admin-download-btn {
            padding: 10px 16px;
            background: linear-gradient(135deg, var(--success) 0%, #2a8a5a 100%);
            border: none;
            border-radius: 6px;
            color: white;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-left: auto;
        }
        .admin-download-btn:hover {
            opacity: 0.9;
        }
        .admin-email-pref {
            display: flex;
            align-items: center;
            margin-left: 12px;
        }
        .admin-checkbox-label {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            padding: 8px 14px;
            background: var(--bg-dark);
            border-radius: 6px;
            font-size: 13px;
            color: var(--text-muted);
            transition: all 0.2s;
        }
        .admin-checkbox-label:hover {
            background: var(--bg-secondary);
        }
        .admin-checkbox-label input[type="checkbox"] {
            width: 16px;
            height: 16px;
            cursor: pointer;
            accent-color: var(--primary);
        }
        .admin-checkbox-label span {
            white-space: nowrap;
        }
        .admin-panel-body {
            flex: 1;
            overflow-y: auto;
            padding: 0;
        }
        .admin-users-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
            table-layout: fixed;
        }
        .admin-users-table th {
            background: var(--bg-toolbar);
            padding: 12px 10px;
            text-align: left;
            font-weight: 600;
            color: var(--text);
            border-bottom: 2px solid var(--border);
            position: sticky;
            top: 0;
            z-index: 1;
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
        }
        .admin-users-table th:hover {
            background: var(--bg-hover);
        }
        .admin-users-table th .sort-icon {
            margin-left: 5px;
            opacity: 0.3;
        }
        .admin-users-table th.sorted .sort-icon {
            opacity: 1;
        }
        .admin-users-table th.sorted.asc .sort-icon::after {
            content: '▲';
        }
        .admin-users-table th.sorted.desc .sort-icon::after {
            content: '▼';
        }
        .admin-users-table th:not(.sorted) .sort-icon::after {
            content: '⇅';
        }
        .admin-users-table td {
            padding: 12px 10px;
            border-bottom: 1px solid var(--border);
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 200px;
        }
        .admin-users-table tr:hover td {
            background: rgba(74, 144, 217, 0.1);
        }
        .admin-users-table .user-email {
            color: var(--primary);
            font-weight: 500;
            max-width: 220px;
        }
        .admin-users-table .user-date {
            color: var(--text-muted);
            font-size: 12px;
            max-width: 130px;
        }
        .admin-badge {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
        }
        .admin-badge.admin {
            background: rgba(138, 42, 90, 0.3);
            color: #d070a0;
        }
        .admin-badge.user {
            background: rgba(74, 144, 217, 0.2);
            color: var(--primary);
        }
        .admin-loading {
            text-align: center;
            padding: 40px;
            color: var(--text-muted);
        }
        .admin-error {
            text-align: center;
            padding: 40px;
            color: var(--danger);
        }
        @media (max-width: 600px) {
            .admin-panel {
                width: 100%;
                max-height: 100vh;
                border-radius: 0;
            }
            .admin-users-table th, .admin-users-table td {
                padding: 10px 8px;
                font-size: 12px;
            }
            .admin-panel-toolbar {
                flex-direction: column;
                align-items: stretch;
            }
            .admin-download-btn {
                margin-left: 0;
                justify-content: center;
            }
        }

        /* ============== ADMIN DASHBOARD ============== */
        .admin-tabs {
            display: flex;
            background: var(--bg-toolbar);
            border-bottom: 2px solid var(--border);
            flex-shrink: 0;
        }
        .admin-tab {
            padding: 12px 24px;
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
            margin-bottom: -2px;
        }
        .admin-tab:hover {
            color: var(--text);
            background: var(--bg-hover);
        }
        .admin-tab.active {
            color: #d070a0;
            border-bottom-color: #a03a6a;
            background: var(--bg-dark);
        }
        .admin-tab-content {
            display: none;
            flex: 1;
            overflow-y: auto;
            padding: 20px;
        }
        .admin-tab-content.active {
            display: block;
        }

        /* Stats Grid */
        .admin-stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
            margin-bottom: 24px;
        }
        .admin-stat-card {
            background: var(--bg-dark);
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            border: 1px solid var(--border);
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .admin-stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.3);
        }
        .admin-stat-card.online {
            border-color: var(--success);
            background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), transparent);
        }
        .admin-stat-card.pro {
            border-color: var(--warning);
            background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), transparent);
        }
        .admin-stat-card.new {
            border-color: #9b59b6;
            background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), transparent);
        }
        .admin-stat-icon {
            font-size: 28px;
            margin-bottom: 8px;
        }
        .admin-stat-value {
            font-size: 36px;
            font-weight: 700;
            color: var(--text);
            line-height: 1.2;
        }
        .admin-stat-label {
            font-size: 13px;
            color: var(--text-muted);
            margin-top: 4px;
        }
        .admin-stat-change {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 8px;
        }
        .admin-stat-change.positive {
            color: var(--success);
        }

        /* Online Dot Animation */
        .online-dot {
            display: inline-block;
            width: 12px;
            height: 12px;
            background: var(--success);
            border-radius: 50%;
            animation: pulse-online 2s infinite;
        }
        @keyframes pulse-online {
            0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
            50% { box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); }
        }

        /* Admin Section */
        .admin-section {
            background: var(--bg-dark);
            border-radius: 12px;
            border: 1px solid var(--border);
            margin-bottom: 24px;
            overflow: hidden;
        }
        .admin-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: var(--bg-toolbar);
            border-bottom: 1px solid var(--border);
        }
        .admin-section-header h3 {
            margin: 0;
            font-size: 15px;
            color: var(--text);
        }
        .admin-section-count {
            background: var(--success);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 600;
        }

        /* Online Users List */
        .admin-online-list {
            max-height: 300px;
            overflow-y: auto;
        }
        .admin-online-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 20px;
            border-bottom: 1px solid var(--border);
            transition: background 0.2s;
        }
        .admin-online-item:last-child {
            border-bottom: none;
        }
        .admin-online-item:hover {
            background: var(--bg-hover);
        }
        .admin-online-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #8a2a5a, #a03a6a);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 600;
            font-size: 14px;
            flex-shrink: 0;
        }
        .admin-online-info {
            flex: 1;
            min-width: 0;
        }
        .admin-online-name {
            font-weight: 500;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .admin-online-company {
            font-weight: 400;
            color: var(--text-muted);
            font-size: 13px;
        }
        .admin-online-email {
            font-size: 12px;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .admin-online-device {
            font-size: 12px;
            color: var(--text-muted);
            text-align: right;
            white-space: nowrap;
        }
        .admin-online-duration {
            font-size: 12px;
            color: var(--success);
            font-weight: 500;
        }
        .admin-online-empty {
            padding: 40px;
            text-align: center;
            color: var(--text-muted);
        }

        .admin-section h3 {
            margin: 0 0 16px 0;
            font-size: 16px;
            font-weight: 600;
            color: var(--text);
        }

        /* Charts Row */
        .admin-charts-row {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
        }
        .admin-charts-row.two-cols {
            grid-template-columns: 2fr 1fr;
        }
        .admin-chart-container {
            background: var(--bg-dark);
            border-radius: 12px;
            border: 1px solid var(--border);
            padding: 20px;
        }
        .admin-chart-container h3 {
            margin: 0 0 16px 0;
            font-size: 14px;
            color: var(--text-muted);
        }
        .admin-chart-container canvas {
            max-height: 200px;
        }

        /* Top Users Table Ranking */
        .admin-users-table .rank-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            font-weight: bold;
            font-size: 13px;
        }
        .admin-users-table .rank-1 {
            background: linear-gradient(135deg, #FFD700, #FFA500);
            color: #000;
        }
        .admin-users-table .rank-2 {
            background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
            color: #000;
        }
        .admin-users-table .rank-3 {
            background: linear-gradient(135deg, #CD7F32, #8B4513);
            color: #fff;
        }
        .admin-users-table .rank-other {
            background: var(--bg-lighter);
            color: var(--text-muted);
        }

        @media (max-width: 900px) {
            .admin-charts-row {
                grid-template-columns: 1fr;
            }
        }

        /* Alerts */
        .admin-alerts {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 20px;
        }
        .admin-alert {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 14px;
        }
        .admin-alert.warning {
            background: rgba(243, 156, 18, 0.15);
            border: 1px solid rgba(243, 156, 18, 0.3);
            color: var(--warning);
        }
        .admin-alert.danger {
            background: rgba(231, 76, 60, 0.15);
            border: 1px solid rgba(231, 76, 60, 0.3);
            color: var(--danger);
        }
        .admin-alert.critical {
            background: rgba(231, 76, 60, 0.25);
            border: 1px solid rgba(231, 76, 60, 0.5);
            color: #ff6b6b;
            animation: pulse-alert 1s infinite;
        }
        @keyframes pulse-alert {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        /* Filters */
        .admin-filters select {
            padding: 8px 12px;
            background: var(--bg-dark);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text);
            font-size: 13px;
            cursor: pointer;
        }
        .admin-filters select:focus {
            outline: none;
            border-color: var(--primary);
        }

        /* Status Badge in Table */
        .status-online {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .status-online::before {
            content: '';
            width: 8px;
            height: 8px;
            background: var(--success);
            border-radius: 50%;
            animation: pulse-online 2s infinite;
        }
        .status-offline::before {
            content: '';
            width: 8px;
            height: 8px;
            background: var(--text-muted);
            border-radius: 50%;
            opacity: 0.5;
        }

        /* Subscription Status Badges */
        .admin-badge.pro {
            background: rgba(243, 156, 18, 0.2);
            color: var(--warning);
        }
        .admin-badge.free {
            background: rgba(127, 140, 141, 0.2);
            color: #95a5a6;
        }
        .admin-badge.active {
            background: rgba(46, 204, 113, 0.2);
            color: var(--success);
        }
        .admin-badge.inactive {
            background: rgba(231, 76, 60, 0.2);
            color: var(--danger);
        }
        .admin-badge.expiring {
            background: rgba(243, 156, 18, 0.2);
            color: var(--warning);
        }

        /* Responsive Admin Dashboard */
        @media (max-width: 900px) {
            .admin-stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .admin-charts-row {
                grid-template-columns: 1fr;
            }
        }
        @media (max-width: 600px) {
            .admin-stats-grid {
                grid-template-columns: 1fr;
            }
            .admin-tab {
                padding: 10px 16px;
                font-size: 13px;
            }
            .admin-tab-content {
                padding: 12px;
            }
        }

        /* ============== IA-ADMIN MODULE ============== */
        .ia-admin-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.95);
            display: none;
            z-index: 40000;
            flex-direction: column;
        }
        .ia-admin-overlay.visible { display: flex; }
        .ia-admin-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 20px;
            background: linear-gradient(135deg, #1a3a5c 0%, #0d1f30 100%);
            border-bottom: 2px solid #2a5a8a;
        }
        .ia-admin-header h2 {
            margin: 0;
            font-size: 18px;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .ia-admin-header .model-version {
            font-size: 12px;
            background: #2a5a8a;
            padding: 3px 8px;
            border-radius: 4px;
            color: #8cf;
        }
        .ia-admin-close {
            background: none;
            border: none;
            color: #fff;
            font-size: 28px;
            cursor: pointer;
            opacity: 0.7;
            padding: 0 10px;
        }
        .ia-admin-close:hover { opacity: 1; }
        .ia-admin-toolbar {
            display: flex;
            gap: 15px;
            padding: 10px 20px;
            background: #1a1a1a;
            border-bottom: 1px solid #333;
            flex-wrap: wrap;
            align-items: center;
        }
        .ia-admin-toolbar .ia-stat {
            display: flex;
            flex-direction: column;
            font-size: 11px;
            color: #888;
        }
        .ia-admin-toolbar .ia-stat strong {
            font-size: 16px;
            color: #4a90d9;
        }
        .ia-admin-toolbar .ia-stat.success strong { color: var(--success); }
        .ia-admin-toolbar .ia-stat.warning strong { color: #f1c40f; }
        .ia-admin-toolbar .ia-stat.danger strong { color: var(--danger); }
        .ia-admin-btn {
            padding: 8px 15px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            transition: all 0.2s;
        }
        .ia-admin-btn.primary { background: #4a90d9; color: #fff; }
        .ia-admin-btn.primary:hover { background: #5aa0e9; }
        .ia-admin-btn.success { background: #27ae60; color: #fff; }
        .ia-admin-btn.success:hover { background: var(--success); }
        .ia-admin-btn.secondary { background: #444; color: #ddd; }
        .ia-admin-btn.secondary:hover { background: #555; }
        .last-trainings-container {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            margin-left: auto;
            padding: 4px 10px;
            background: rgba(155, 89, 182, 0.1);
            border: 1px solid rgba(155, 89, 182, 0.2);
            border-radius: 5px;
        }
        .last-trainings-container .lts-title {
            font-size: 10px;
            color: #9b59b6;
            font-weight: 600;
        }
        .last-trainings-list {
            display: flex;
            gap: 8px;
        }
        .lts-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 8px;
            background: rgba(0,0,0,0.2);
            border-radius: 4px;
            font-size: 10px;
        }
        .lts-item.latest { background: rgba(155, 89, 182, 0.2); border: 1px solid rgba(155, 89, 182, 0.4); }
        .lts-item .lts-icon { font-size: 12px; }
        .lts-item .lts-date { color: #888; font-size: 9px; }
        .lts-item .lts-metric {
            display: flex;
            flex-direction: column;
            align-items: center;
            line-height: 1.1;
        }
        .lts-item .lts-metric small { font-size: 8px; color: #666; }
        .lts-item .lts-metric strong { font-size: 11px; color: var(--success); }
        .lts-item .lts-metric.small { min-width: 28px; }
        .lts-item .lts-metric.small strong { font-size: 10px; color: var(--info); }
        .lts-item .lts-trend { font-size: 10px; margin-left: -4px; }
        .lts-item .lts-trend.up { color: var(--success); }
        .lts-item .lts-trend.down { color: var(--danger); }
        .lts-item .lts-trend.same { color: #888; }
        .lts-item .lts-status {
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 9px;
            font-weight: 600;
            text-transform: uppercase;
        }
        .lts-item .lts-status.completed { background: rgba(46, 204, 113, 0.2); color: var(--success); }
        .lts-item .lts-status.pending { background: rgba(241, 196, 15, 0.2); color: #f1c40f; }
        .lts-item .lts-status.failed { background: rgba(231, 76, 60, 0.2); color: var(--danger); }
        .ia-admin-content {
            flex: 1;
            display: flex;
            overflow: hidden;
        }
        .ia-admin-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .ia-triple-view {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 10px;
            overflow-y: auto;
        }
        .ia-view-panel {
            background: #1a1a1a;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            border: 2px solid #333;
            min-height: 400px;
            flex-shrink: 0;
        }
        .ia-view-panel.expert { border-color: #4a90d9; }
        .ia-view-panel.yolo { border-color: #e67e22; }
        .ia-view-panel.unet { border-color: #9b59b6; }
        .ia-view-header {
            padding: 8px 12px;
            font-weight: 600;
            font-size: 13px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
        }
        .ia-view-panel.expert .ia-view-header { background: rgba(74, 144, 217, 0.2); color: #4a90d9; }
        .ia-view-panel.yolo .ia-view-header { background: rgba(230, 126, 34, 0.2); color: #e67e22; }
        .ia-view-panel.unet .ia-view-header { background: rgba(155, 89, 182, 0.2); color: #9b59b6; }
        .ia-class-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 3px;
            flex: 1;
            margin: 0 10px;
        }
        .ia-class-btn {
            padding: 2px 6px;
            font-size: 10px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            color: #ccc;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }
        .ia-class-btn:hover {
            background: rgba(230, 126, 34, 0.3);
            border-color: #e67e22;
        }
        .ia-class-btn.active {
            background: #e67e22;
            border-color: #e67e22;
            color: #fff;
        }
        .ia-header-params {
            display: flex;
            gap: 8px;
            align-items: center;
            flex: 1;
            margin: 0 10px;
        }
        .ia-header-params label {
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 10px;
            color: #aaa;
            font-weight: normal;
        }
        .ia-header-params label sub {
            font-size: 8px;
        }
        .ia-header-params input[type="number"] {
            width: 50px;
            padding: 2px 4px;
            font-size: 11px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            color: #fff;
        }
        .ia-header-params button {
            padding: 2px 5px;
            font-size: 10px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            color: #4a90d9;
            cursor: pointer;
        }
        .ia-header-params button:hover {
            background: rgba(74, 144, 217, 0.3);
        }
        .ia-view-canvas-container {
            flex: 1;
            position: relative;
            overflow: hidden;
            background: #0a0a0a;
        }
        .ia-view-canvas-container canvas {
            position: absolute;
            top: 0; left: 0;
            width: 100%;
            height: 100%;
            object-fit: contain;
        }
        .ia-view-info {
            padding: 6px 12px;
            font-size: 11px;
            color: #888;
            background: #111;
            display: flex;
            justify-content: space-between;
        }
        .ia-sidebar {
            width: 280px;
            background: #1e1e1e;
            border-left: 1px solid #333;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .ia-sidebar-section {
            border-bottom: 1px solid #333;
        }
        .ia-sidebar-title {
            padding: 10px 15px;
            font-weight: 600;
            font-size: 12px;
            color: #aaa;
            background: #252525;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .ia-sidebar-content {
            padding: 10px 15px;
        }
        .ia-param-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 12px;
        }
        .ia-param-row label { color: #888; }
        .ia-param-row input, .ia-param-row select {
            width: 80px;
            padding: 4px 8px;
            background: #333;
            border: 1px solid #444;
            border-radius: 4px;
            color: #fff;
            font-size: 12px;
        }
        .ia-annotation-item {
            background: #252525;
            border-radius: 5px;
            padding: 8px 10px;
            margin-bottom: 6px;
            font-size: 11px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-left: 3px solid #4a90d9;
        }
        .ia-annotation-item .coords { color: #aaa; }
        .ia-annotation-item .velocity { color: #4a90d9; font-weight: 600; }
        .ia-annotation-item .delete-btn {
            background: none;
            border: none;
            color: var(--danger);
            cursor: pointer;
            font-size: 14px;
            padding: 0 5px;
        }
        @media (max-width: 768px) {
            .ia-sidebar { width: 100%; max-height: 200px; }
            .ia-admin-content { flex-direction: column; }
        }
        .ia-admin-sidebar {
            width: 280px;
            background: #1e1e1e;
            border-right: 1px solid #333;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }
        .ia-admin-sidebar h3 {
            padding: 12px 15px;
            margin: 0;
            font-size: 13px;
            color: #aaa;
            background: #252525;
            border-bottom: 1px solid #333;
        }
        .ia-file-list {
            border-bottom: 1px solid #333;
        }
        .ia-annotations-list {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 0;
            overflow: hidden;
        }
        .ia-file-items {
            padding: 10px;
            max-height: 150px;
            overflow-y: auto;
        }
        .ia-annotations {
            padding: 10px;
            max-height: 500px;
            overflow-y: auto;
        }
        .ia-file-empty, .ia-annotation-empty, .ia-class-empty {
            color: #666;
            font-size: 12px;
            text-align: center;
            padding: 10px;
        }
        .ia-classes-list {
            margin-top: 10px;
        }
        .ia-classes-list h3 {
            color: var(--warning);
            font-size: 13px;
            margin: 0 0 8px 0;
            padding: 8px 10px;
            background: #252525;
            border-radius: 5px 5px 0 0;
        }
        .ia-classes {
            padding: 5px 10px;
            max-height: 250px;
            overflow-y: auto;
            background: #1a1a1a;
            border-radius: 0 0 5px 5px;
        }
        .ia-class-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 8px;
            border-bottom: 1px solid #333;
            font-size: 12px;
        }
        .ia-class-item:last-child {
            border-bottom: none;
        }
        .ia-class-item span {
            color: #ccc;
        }
        .ia-class-item strong {
            color: var(--warning);
            font-weight: 600;
        }
        .ia-file-item {
            background: #252525;
            border-radius: 5px;
            padding: 8px 10px;
            margin-bottom: 6px;
            font-size: 11px;
            cursor: pointer;
            transition: background 0.2s;
        }
        .ia-file-item:hover { background: #333; }
        .ia-file-item.selected { background: #3a5a8a; border-left: 3px solid #4a90d9; }
        .ia-class-select {
            padding: 4px 8px;
            background: #333;
            border: 1px solid #444;
            border-radius: 4px;
            color: #fff;
            font-size: 11px;
            margin-left: 5px;
        }
        .ia-view-canvas-wrapper {
            flex: 1;
            background: #0a0a0a;
            min-height: 200px;
            /* Pas de max-height pour afficher 100% de la hauteur */
            overflow-x: auto;  /* Scroll horizontal si image large */
            overflow-y: visible; /* Hauteur complète visible */
            position: relative;
            /* Scrollbar stylée */
            scrollbar-width: thin;
            scrollbar-color: #666 #1a1a1a;
        }
        /* Webkit scrollbars (Chrome, Edge, Safari) */
        .ia-view-canvas-wrapper::-webkit-scrollbar {
            width: 12px;
            height: 12px;
        }
        .ia-view-canvas-wrapper::-webkit-scrollbar-track {
            background: #1a1a1a;
            border-radius: 6px;
        }
        .ia-view-canvas-wrapper::-webkit-scrollbar-thumb {
            background: #555;
            border-radius: 6px;
            border: 2px solid #1a1a1a;
        }
        .ia-view-canvas-wrapper::-webkit-scrollbar-thumb:hover {
            background: #777;
        }
        .ia-view-canvas-wrapper::-webkit-scrollbar-corner {
            background: #1a1a1a;
        }
        .ia-view-canvas-wrapper canvas:first-child {
            display: block;
        }
        .ia-overlay-canvas {
            position: absolute;
            top: 0;
            left: 0;
            pointer-events: auto;
            cursor: crosshair;
        }
        .ia-view-tools {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            background: #1a1a1a;
            border-top: 1px solid #333;
        }
        .ia-tool-btn {
            width: 32px;
            height: 32px;
            border: 1px solid #444;
            border-radius: 6px;
            background: var(--bg-secondary);
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .ia-tool-btn:hover {
            background: #3a3a3a;
            border-color: #666;
        }
        .ia-tool-btn.active {
            background: #4a90d9;
            border-color: #5aa0e9;
        }
        .ia-view-panel.yolo .ia-tool-btn.active {
            background: #e67e22;
            border-color: var(--warning);
        }
        .ia-view-panel.unet .ia-tool-btn.active {
            background: #9b59b6;
            border-color: #a66bbe;
        }
        .ia-view-tools input[type="range"] {
            width: 80px;
            accent-color: #9b59b6;
        }

        /* ============== TRAINING PAGE ============== */
        .training-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.98);
            z-index: 50000;
            overflow: auto;
        }
        .training-overlay.visible { display: block; }
        .training-container {
            max-width: 1400px;
            margin: 20px auto;
            background: #1a1a1a;
            border-radius: 12px;
            overflow: hidden;
        }
        .training-header {
            background: linear-gradient(135deg, #9b59b6, #8e44ad);
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .training-header h2 {
            margin: 0;
            color: #fff;
            font-size: 24px;
        }
        .training-close {
            background: rgba(255,255,255,0.2);
            border: none;
            color: #fff;
            font-size: 28px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
        }
        .training-close:hover { background: rgba(255,255,255,0.3); }
        .training-content {
            display: flex;
            min-height: 600px;
        }
        .training-sidebar {
            width: 300px;
            background: #222;
            border-right: 1px solid #333;
            padding: 20px;
        }
        .training-sidebar h3 {
            color: #9b59b6;
            font-size: 14px;
            margin: 0 0 15px 0;
            padding-bottom: 10px;
            border-bottom: 1px solid #333;
        }
        .train-stat-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 20px;
        }
        .train-stat-item {
            background: var(--bg-secondary);
            padding: 12px;
            border-radius: 8px;
            text-align: center;
        }
        .train-stat-item span {
            display: block;
            font-size: 11px;
            color: #888;
            margin-bottom: 4px;
        }
        .train-stat-item strong {
            font-size: 24px;
            color: #9b59b6;
        }
        .train-class-list {
            max-height: none;
            overflow-y: visible;
            margin-bottom: 20px;
        }
        .train-class-item, .train-image-item {
            display: flex;
            justify-content: space-between;
            padding: 8px 12px;
            background: var(--bg-secondary);
            border-radius: 5px;
            margin-bottom: 5px;
            font-size: 12px;
        }
        .train-class-item strong { color: #e67e22; }
        .train-image-item small { color: #666; }
        .train-image-item .delete-btn {
            background: var(--danger);
            color: white;
            border: none;
            border-radius: 3px;
            padding: 2px 6px;
            cursor: pointer;
            font-size: 10px;
            margin-left: 8px;
        }
        .train-image-item .delete-btn:hover {
            background: #c0392b;
        }
        .train-empty {
            color: #666;
            font-size: 12px;
            text-align: center;
            padding: 20px;
        }
        .training-main {
            flex: 1;
            padding: 25px;
        }
        .training-section {
            background: #252525;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
        }
        .training-section h3 {
            color: #fff;
            margin: 0 0 10px 0;
            font-size: 16px;
        }
        .training-section p {
            color: #888;
            font-size: 13px;
            margin: 0 0 15px 0;
        }
        .training-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        .train-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            font-size: 13px;
            cursor: pointer;
            background: #3a3a3a;
            color: #fff;
            transition: all 0.2s;
        }
        .train-btn:hover { background: #4a4a4a; }
        .train-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .train-btn.primary { background: #9b59b6; }
        .train-btn.primary:hover { background: #a66bbe; }
        .train-btn.secondary { background: #34495e; }
        .train-btn.secondary:hover { background: #4a6278; }
        .train-btn.success { background: #27ae60; }
        .train-btn.success:hover { background: var(--success); }
        .code-block {
            background: #1a1a1a;
            border: 1px solid #333;
            border-radius: 6px;
            padding: 15px;
            margin-bottom: 15px;
            overflow-x: auto;
        }
        .code-block code {
            font-family: 'Monaco', 'Consolas', monospace;
            font-size: 12px;
            color: var(--success);
            white-space: pre;
        }
        .model-upload {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        .model-upload span {
            color: #888;
            font-size: 12px;
        }
        .training-history {
            max-height: 300px;
            overflow-y: auto;
        }
        .training-history-item {
            background: #1e1e1e;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 10px;
            border-left: 3px solid #666;
        }
        .training-history-item.success { border-left-color: #27ae60; }
        .training-history-item.error { border-left-color: var(--danger); }
        .training-history-item.pending { border-left-color: var(--warning); }
        .training-history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            font-size: 13px;
        }
        .training-status {
            font-size: 11px;
            padding: 2px 8px;
            border-radius: 4px;
            background: #333;
            color: #aaa;
        }
        .training-history-details {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
        }
        .training-metric {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .metric-label {
            font-size: 10px;
            color: #888;
            text-transform: uppercase;
        }
        .metric-value {
            font-size: 14px;
            font-weight: bold;
            color: #4ecdc4;
        }
        .training-error {
            margin-top: 8px;
            padding: 8px;
            background: rgba(231, 76, 60, 0.1);
            border-radius: 4px;
            font-size: 11px;
            color: var(--danger);
        }

        /* ============== VALIDATION TAB ============== */
        .training-tabs {
            display: flex;
            gap: 0;
            border-bottom: 2px solid var(--border);
            margin-bottom: 15px;
        }
        .training-tab {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 20px;
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
        }
        .training-tab:hover {
            color: var(--text);
            background: rgba(255,255,255,0.05);
        }
        .training-tab.active {
            color: var(--primary);
        }
        .training-tab.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            right: 0;
            height: 2px;
            background: var(--primary);
        }
        .training-tab .tab-icon {
            font-size: 16px;
        }
        .validation-badge {
            background: var(--danger);
            color: #fff;
            font-size: 11px;
            font-weight: bold;
            padding: 2px 6px;
            border-radius: 10px;
            min-width: 20px;
            text-align: center;
        }
        .training-tab-content {
            display: none;
            flex: 1;
            flex-direction: column;
        }
        .training-tab-content.active {
            display: flex;
        }

        /* Validation Header */
        .validation-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            background: rgba(0,0,0,0.2);
            border-radius: 8px;
            margin-bottom: 15px;
        }
        .validation-stats-bar {
            display: flex;
            gap: 20px;
        }
        .validation-stat {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 13px;
        }
        .validation-stat.pending { color: var(--warning); }
        .validation-stat.validated { color: #27ae60; }
        .validation-stat.rejected { color: var(--danger); }
        .validation-filters select {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 13px;
            cursor: pointer;
        }

        /* Validation Container */
        .validation-container {
            display: flex;
            gap: 20px;
            flex: 1;
            min-height: 0;
        }
        .validation-sessions-list {
            width: 300px;
            flex-shrink: 0;
            background: rgba(0,0,0,0.15);
            border-radius: 8px;
            padding: 10px;
            overflow-y: auto;
            max-height: 500px;
        }
        .validation-session-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px;
            background: var(--bg-panel);
            border-radius: 6px;
            margin-bottom: 8px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.2s;
        }
        .validation-session-item:hover {
            border-color: var(--primary);
        }
        .validation-session-item.selected {
            border-color: var(--primary);
            background: rgba(74, 144, 217, 0.1);
        }
        .validation-session-item.validated {
            border-left: 3px solid #27ae60;
        }
        .validation-session-item.rejected {
            border-left: 3px solid var(--danger);
        }
        .validation-session-item.pending {
            border-left: 3px solid var(--warning);
        }
        .session-thumbnail {
            width: 50px;
            height: 40px;
            background: #333;
            border-radius: 4px;
            overflow: hidden;
            flex-shrink: 0;
        }
        .session-thumbnail img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .session-info {
            flex: 1;
            min-width: 0;
        }
        .session-name {
            font-size: 12px;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            margin-bottom: 3px;
        }
        .session-meta {
            font-size: 10px;
            color: var(--text-muted);
        }
        .session-rejection-reason {
            font-size: 10px;
            color: var(--danger);
            margin-top: 3px;
            font-style: italic;
            max-width: 200px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .session-count {
            background: var(--primary);
            color: #fff;
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 10px;
        }

        /* Validation Preview */
        .validation-preview {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: rgba(0,0,0,0.15);
            border-radius: 8px;
            padding: 15px;
            min-width: 0;
        }
        .preview-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 15px;
        }
        .preview-header h4 {
            font-size: 16px;
            margin: 0;
        }
        .preview-info {
            display: flex;
            gap: 15px;
            font-size: 12px;
            color: var(--text-muted);
        }
        .preview-canvas-container {
            position: relative;
            background: #1a1a1a;
            border-radius: 8px;
            overflow: auto;
            flex: 1;
            min-height: 350px;
            max-height: 500px;
        }
        #validationCanvas {
            display: block;
            min-width: 100%;
            height: auto;
        }
        .preview-loading {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.7);
            color: var(--text-muted);
            gap: 10px;
        }
        .preview-loading .spinner {
            width: 30px;
            height: 30px;
            border: 3px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Preview Annotations List */
        .preview-annotations {
            margin: 15px 0;
            max-height: 150px;
            overflow-y: auto;
        }
        .annotation-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px;
            background: var(--bg-panel);
            border-radius: 4px;
            margin-bottom: 5px;
        }
        .annotation-item:hover {
            background: rgba(255,255,255,0.1);
        }
        .annotation-item input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
        }
        .annotation-class {
            font-size: 12px;
            font-weight: 500;
            flex: 1;
        }
        .annotation-status {
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 4px;
        }
        .annotation-status.pending { background: rgba(243, 156, 18, 0.2); color: var(--warning); }
        .annotation-status.validated { background: rgba(39, 174, 96, 0.2); color: #27ae60; }
        .annotation-status.rejected { background: rgba(231, 76, 60, 0.2); color: var(--danger); }
        .annotation-rejection-reason {
            font-size: 9px;
            color: var(--danger);
            font-style: italic;
            margin-top: 2px;
            width: 100%;
        }

        /* Preview Actions */
        .preview-actions {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: auto;
            padding-top: 15px;
            border-top: 1px solid var(--border);
        }
        .preview-actions .action-row {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        .preview-actions .action-row.individual {
            padding-top: 10px;
            border-top: 1px dashed var(--border);
        }
        .train-btn.danger {
            background: linear-gradient(to bottom, #c0392b, #a93226);
            border-color: var(--danger);
        }
        .train-btn.danger:hover {
            background: linear-gradient(to bottom, var(--danger), #c0392b);
        }
        .train-btn.secondary {
            background: linear-gradient(to bottom, #555, #444);
            border-color: #666;
        }
        .train-btn.secondary:hover {
            background: linear-gradient(to bottom, #666, #555);
        }

        /* Validation Viewer Modal */
        .validation-viewer-modal {
            position: absolute;
            top: 60px;
            left: 10px;
            right: 10px;
            bottom: 10px;
            background: var(--bg-panel);
            border-radius: 12px;
            border: 1px solid var(--border);
            z-index: 100;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 40px rgba(0,0,0,0.5);
        }
        .viewer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            border-bottom: 1px solid var(--border);
            background: rgba(0,0,0,0.2);
            border-radius: 12px 12px 0 0;
        }
        .viewer-header h4 {
            margin: 0;
            font-size: 14px;
            color: var(--text);
        }
        .viewer-close-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 20px;
            cursor: pointer;
            padding: 5px 10px;
            border-radius: 4px;
        }
        .viewer-close-btn:hover {
            background: rgba(255,255,255,0.1);
            color: var(--text);
        }
        .viewer-content {
            flex: 1;
            display: flex;
            overflow: hidden;
        }
        .viewer-canvas-wrapper {
            flex: 1;
            overflow: auto;
            background: #111;
            padding: 10px;
            position: relative;
        }
        .viewer-zoom-controls {
            position: sticky;
            top: 5px;
            left: 5px;
            z-index: 10;
            display: flex;
            gap: 8px;
            align-items: center;
            background: rgba(30,30,30,0.95);
            padding: 8px 14px;
            border-radius: 8px;
            width: fit-content;
            margin-bottom: 10px;
            border: 1px solid #555;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }
        .viewer-zoom-controls .zoom-btn {
            width: 32px;
            height: 32px;
            background: rgba(60,60,60,0.9);
            border: 1px solid #666;
            border-radius: 6px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s;
        }
        .viewer-zoom-controls .zoom-btn:hover {
            background: rgba(80,80,80,0.9);
            border-color: #888;
        }
        .viewer-zoom-controls span {
            font-size: 13px;
            font-weight: 500;
            color: #ddd;
            min-width: 50px;
            text-align: center;
        }
        #viewerCanvas {
            display: block;
            transform-origin: top left;
            transition: transform 0.15s ease;
        }
        .viewer-loading {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.85);
            color: var(--text-muted);
            gap: 15px;
            font-size: 13px;
            z-index: 10;
        }
        .viewer-spinner {
            width: 40px;
            height: 40px;
            border: 4px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        .viewer-sidebar {
            width: 350px;
            display: flex;
            flex-direction: column;
            border-left: 1px solid var(--border);
            background: rgba(0,0,0,0.15);
        }
        .viewer-annotations-list {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }
        .viewer-annotation-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px;
            background: var(--bg-panel);
            border-radius: 6px;
            margin-bottom: 6px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.15s;
        }
        .viewer-annotation-item:hover {
            background: rgba(255,255,255,0.1);
        }
        .viewer-annotation-item.selected {
            border-color: var(--primary);
            background: rgba(99, 102, 241, 0.15);
        }
        .viewer-annotation-item .ann-number {
            background: var(--primary);
            color: white;
            font-size: 11px;
            font-weight: 600;
            min-width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .viewer-annotation-item .ann-class {
            flex: 1;
            font-size: 12px;
        }
        .viewer-annotation-item .ann-status {
            font-size: 10px;
            padding: 3px 8px;
            border-radius: 10px;
        }
        .viewer-annotation-item .ann-status.pending { background: rgba(243, 156, 18, 0.2); color: var(--warning); }
        .viewer-annotation-item .ann-status.validated { background: rgba(39, 174, 96, 0.2); color: #27ae60; }
        .viewer-annotation-item .ann-status.rejected { background: rgba(231, 76, 60, 0.2); color: var(--danger); }
        .ann-rejection-reason {
            font-size: 9px;
            color: var(--danger);
            font-style: italic;
            width: 100%;
            margin-top: 2px;
            padding-left: 28px;
        }
        .viewer-select-all {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px;
            border-bottom: 1px solid var(--border);
            background: rgba(0,0,0,0.2);
        }
        .viewer-select-all label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            cursor: pointer;
        }
        .viewer-select-all input[type="checkbox"] {
            width: 16px;
            height: 16px;
        }
        #viewerSelectedCount {
            font-size: 11px;
            color: var(--text-muted);
        }
        .viewer-annotation-item input[type="checkbox"] {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
        }
        .viewer-annotation-item .ann-actions {
            display: flex;
            gap: 4px;
            margin-left: auto;
        }
        .viewer-annotation-item .ann-validate-btn,
        .viewer-annotation-item .ann-reject-btn {
            width: 24px;
            height: 24px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s;
        }
        .viewer-annotation-item .ann-validate-btn {
            background: rgba(39, 174, 96, 0.2);
            color: #27ae60;
        }
        .viewer-annotation-item .ann-validate-btn:hover {
            background: #27ae60;
            color: white;
        }
        .viewer-annotation-item .ann-reject-btn {
            background: rgba(231, 76, 60, 0.2);
            color: var(--danger);
        }
        .viewer-annotation-item .ann-reject-btn:hover {
            background: var(--danger);
            color: white;
        }
        .viewer-actions {
            padding: 10px;
            border-top: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .viewer-actions-individual {
            display: flex;
            gap: 6px;
        }
        .viewer-actions-individual .train-btn {
            flex: 1;
            font-size: 11px;
            padding: 8px 6px;
        }
        .viewer-actions-session {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding-top: 10px;
            border-top: 1px dashed var(--border);
        }
        .viewer-actions-session .train-btn {
            width: 100%;
        }
        .train-btn.small {
            font-size: 11px;
            padding: 6px 10px;
        }

        /* ============== SUBSCRIPTION / PREMIUM ============== */
        .toolbar-btn.premium-locked {
            position: relative;
            opacity: 0.6;
        }
        .toolbar-btn.premium-locked::after, .toolbar-btn.premium-feature::after {
            content: '👑';
            position: absolute;
            top: 2px;
            right: 2px;
            font-size: 10px;
        }
        .toolbar-btn.premium-feature { position: relative; }
        .toolbar-btn.premium-locked:hover {
            background: linear-gradient(to bottom, #8a6a2a, #6a5a1a) !important;
        }
        .voie-btn.premium-locked {
            position: relative;
            opacity: 0.6;
        }
        .voie-btn.premium-locked::after, .voie-btn.premium-feature::after {
            content: '👑';
            position: absolute;
            top: -5px;
            right: -5px;
            font-size: 8px;
        }
        .voie-btn.premium-feature { position: relative; }

        /* Bannière essai gratuit */
        .trial-banner {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, var(--success) 0%, #27ae60 100%);
            color: #fff;
            padding: 10px 20px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 500;
            box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
            z-index: 1000;
            display: none;
            text-align: center;
            max-width: 90%;
        }
        .trial-banner.visible { display: block; }
        .trial-banner-close {
            position: absolute;
            top: 4px;
            right: 8px;
            background: none;
            border: none;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            opacity: 0.7;
        }
        .trial-banner-close:hover { opacity: 1; }

        /* Modal Upgrade */
        .upgrade-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 35000;
            padding: 20px;
        }
        .upgrade-modal-overlay.visible { display: flex; }
        .upgrade-modal {
            background: var(--bg-panel);
            border-radius: 16px;
            width: 100%;
            max-width: 500px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 2px solid var(--accent);
            overflow: hidden;
        }
        .upgrade-modal-header {
            background: linear-gradient(135deg, #d99040 0%, #b87030 100%);
            padding: 20px 24px;
            text-align: center;
        }
        .upgrade-modal-header h2 {
            color: white;
            font-size: 24px;
            margin-bottom: 5px;
        }
        .upgrade-modal-header p {
            color: rgba(255,255,255,0.9);
            font-size: 14px;
        }
        .upgrade-modal-body {
            padding: 24px;
        }
        .upgrade-feature-list {
            list-style: none;
            margin-bottom: 20px;
            max-height: 280px;
            overflow-y: auto;
            padding-right: 8px;
        }
        .upgrade-feature-list li {
            padding: 8px 0;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .upgrade-feature-list li:last-child {
            border-bottom: none;
        }
        .upgrade-feature-list .icon {
            font-size: 20px;
        }
        .upgrade-price {
            text-align: center;
            margin: 20px 0;
            padding: 15px;
            background: rgba(217, 144, 64, 0.1);
            border-radius: 8px;
            border: 1px solid var(--accent);
        }
        .upgrade-price .amount {
            font-size: 36px;
            font-weight: 700;
            color: var(--accent);
        }
        .upgrade-price .period {
            color: var(--text-muted);
            font-size: 14px;
        }
        .upgrade-modal-actions {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }
        .upgrade-btn {
            flex: 1;
            padding: 14px 20px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .upgrade-btn.primary {
            background: linear-gradient(135deg, #d99040 0%, #b87030 100%);
            color: white;
        }
        .upgrade-btn.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 20px rgba(217, 144, 64, 0.4);
        }
        .upgrade-btn.secondary {
            background: var(--bg-toolbar);
            color: var(--text);
            border: 1px solid var(--border);
        }
        .upgrade-btn.secondary:hover {
            background: var(--bg-hover);
        }
        .upgrade-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none !important;
            box-shadow: none !important;
        }

        /* Billing form styles */
        .billing-form-title {
            margin: 0 0 8px 0;
            font-size: 18px;
            font-weight: 600;
            color: var(--text);
        }
        .billing-form-subtitle {
            margin: 0 0 20px 0;
            font-size: 14px;
            color: var(--text-muted);
        }
        .billing-readonly-notice {
            margin: 0 0 16px 0;
            padding: 12px 16px;
            background-color: rgba(59, 130, 246, 0.15);
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 8px;
            font-size: 13px;
            color: #93c5fd;
            line-height: 1.5;
        }
        .billing-readonly-notice .notice-icon {
            margin-right: 8px;
        }
        .billing-readonly-notice strong {
            color: #bfdbfe;
        }
        .billing-form {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        .billing-form .form-row {
            display: flex;
            gap: 16px;
        }
        .billing-form .form-group {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .billing-form .form-group.full-width {
            flex: 100%;
        }
        .billing-form label {
            font-size: 13px;
            font-weight: 500;
            color: var(--text-muted);
        }
        .billing-form input,
        .billing-form select {
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: var(--bg-toolbar);
            color: var(--text);
            font-size: 14px;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .billing-form input:focus,
        .billing-form select:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(217, 144, 64, 0.15);
        }
        .billing-form input::placeholder {
            color: var(--text-muted);
            opacity: 0.6;
        }
        .billing-form input:invalid:not(:placeholder-shown) {
            border-color: #e74c3c;
        }

        /* Plans selection */
        .upgrade-plans-container {
            margin-bottom: 20px;
        }
        .upgrade-plans-loading {
            text-align: center;
            padding: 20px;
            color: var(--text-muted);
        }
        .upgrade-plans-grid {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }
        .upgrade-plan-card {
            flex: 1;
            min-width: 200px;
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--bg-toolbar);
        }
        .upgrade-plan-card:hover {
            border-color: var(--accent);
            background: rgba(217, 144, 64, 0.05);
        }
        .upgrade-plan-card.selected {
            border-color: var(--accent);
            background: rgba(217, 144, 64, 0.1);
            box-shadow: 0 0 0 3px rgba(217, 144, 64, 0.2);
        }
        .upgrade-plan-card .plan-name {
            font-weight: 600;
            font-size: 16px;
            margin-bottom: 8px;
            color: var(--text);
        }
        .upgrade-plan-card .plan-price {
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
        }
        .upgrade-plan-card .plan-price-period {
            font-size: 14px;
            color: var(--text-muted);
            font-weight: normal;
        }
        .upgrade-plan-card .plan-description {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 8px;
        }
        .upgrade-plans-error {
            text-align: center;
            padding: 20px;
            color: var(--danger);
            background: rgba(231, 76, 60, 0.1);
            border-radius: 8px;
        }

        /* Subscription status in user menu */
        .subscription-status {
            padding: 10px 15px;
            margin: 10px 15px;
            border-radius: 8px;
            font-size: 12px;
            text-align: center;
        }
        .subscription-status.free {
            background: rgba(100, 100, 100, 0.2);
            border: 1px solid var(--border);
            color: var(--text-muted);
        }
        .subscription-status.pro {
            background: rgba(217, 144, 64, 0.2);
            border: 1px solid var(--accent);
            color: var(--accent);
        }
        .subscription-status .plan-name {
            font-weight: 600;
            font-size: 14px;
        }
        .manage-subscription-btn {
            display: block;
            margin: 10px 15px;
            padding: 10px;
            background: transparent;
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text);
            font-size: 13px;
            cursor: pointer;
            text-align: center;
            transition: all 0.2s;
        }
        .manage-subscription-btn:hover {
            background: var(--bg-hover);
            border-color: var(--accent);
        }

        /* ============== SUBSCRIPTION DETAILS MODAL ============== */
        .subscription-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10001;
            padding: 20px;
        }
        .subscription-modal-overlay.visible { display: flex; }
        .subscription-modal {
            background: var(--bg-panel);
            border-radius: 16px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            width: 100%;
            max-width: 480px;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            animation: modalSlideIn 0.3s ease-out;
        }
        @keyframes modalSlideIn {
            from { opacity: 0; transform: translateY(-20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .subscription-modal-close {
            position: absolute;
            top: 16px;
            right: 16px;
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 24px;
            cursor: pointer;
            transition: color 0.2s;
            z-index: 1;
        }
        .subscription-modal-close:hover { color: var(--text); }
        .subscription-modal-header {
            padding: 24px 24px 16px;
            border-bottom: 1px solid var(--border);
            text-align: center;
        }
        .subscription-modal-header h2 {
            margin: 0;
            font-size: 22px;
            color: var(--text);
        }
        .subscription-modal-content {
            padding: 24px;
        }
        .subscription-status-card {
            background: linear-gradient(135deg, rgba(217, 144, 64, 0.2), rgba(217, 144, 64, 0.1));
            border: 1px solid var(--accent);
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            margin-bottom: 24px;
        }
        .subscription-status-card .status-badge {
            display: inline-block;
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 12px;
        }
        .subscription-status-card .status-badge.active {
            background: rgba(46, 204, 113, 0.2);
            color: #2ecc71;
            border: 1px solid rgba(46, 204, 113, 0.3);
        }
        .subscription-status-card .status-badge.expired {
            background: rgba(231, 76, 60, 0.2);
            color: #e74c3c;
            border: 1px solid rgba(231, 76, 60, 0.3);
        }
        .subscription-status-card .status-badge.inactive {
            background: rgba(100, 100, 100, 0.2);
            color: var(--text-muted);
            border: 1px solid var(--border);
        }
        .subscription-status-card .plan-name {
            font-size: 24px;
            font-weight: 700;
            color: var(--accent);
        }
        .subscription-details {
            background: var(--bg-toolbar);
            border-radius: 10px;
            padding: 16px;
            margin-bottom: 20px;
        }
        .subscription-details .detail-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid var(--border);
        }
        .subscription-details .detail-row:last-child {
            border-bottom: none;
        }
        .subscription-details .detail-label {
            color: var(--text-muted);
            font-size: 14px;
        }
        .subscription-details .detail-value {
            color: var(--text);
            font-weight: 600;
            font-size: 14px;
        }
        .subscription-info-box {
            background: rgba(59, 130, 246, 0.1);
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 10px;
            padding: 16px;
            font-size: 13px;
            color: #93c5fd;
            line-height: 1.6;
        }
        .subscription-info-box p {
            margin: 0 0 8px;
        }
        .subscription-info-box p:last-child {
            margin: 0;
        }
        .subscription-info-box strong {
            color: #bfdbfe;
        }
        .subscription-modal-actions {
            padding: 16px 24px 24px;
            display: flex;
            justify-content: center;
        }
        .subscription-btn {
            padding: 12px 32px;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
        }
        .subscription-btn.primary {
            background: var(--accent);
            color: white;
        }
        .subscription-btn.primary:hover {
            background: #c4822f;
            transform: translateY(-1px);
        }

        /* ============== REALTIME NOTIFICATIONS ============== */
        .notification-container {
            position: fixed;
            top: 70px;
            right: 20px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-width: 350px;
        }
        .notification-toast {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px 16px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            animation: slideIn 0.3s ease-out;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }
        .notification-toast.success { border-left: 4px solid var(--success); }
        .notification-toast.warning { border-left: 4px solid var(--accent); }
        .notification-toast.error { border-left: 4px solid var(--danger); }
        .notification-toast.info { border-left: 4px solid var(--primary); }
        .notification-toast .icon { font-size: 20px; }
        .notification-toast .content { flex: 1; }
        .notification-toast .title { font-weight: bold; font-size: 13px; margin-bottom: 4px; }
        .notification-toast .message { font-size: 12px; color: var(--text-muted); }
        .notification-toast .close-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 16px;
            padding: 0;
        }
        @keyframes slideIn {
            from { transform: translateX(100%); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }
        @keyframes slideOut {
            from { transform: translateX(0); opacity: 1; }
            to { transform: translateX(100%); opacity: 0; }
        }

        /* Progress bar for parsing/IA */
        .progress-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.7);
            z-index: 9999;
            display: none;
            justify-content: center;
            align-items: center;
        }
        .progress-overlay.visible { display: flex; }
        .progress-box {
            background: var(--bg-panel);
            border-radius: 12px;
            padding: 30px 40px;
            text-align: center;
            min-width: 300px;
        }
        .progress-box .title { font-size: 16px; font-weight: bold; margin-bottom: 15px; }
        .progress-box .progress-bar {
            height: 8px;
            background: var(--bg-dark);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 10px;
        }
        .progress-box .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--accent));
            border-radius: 4px;
            transition: width 0.3s ease;
            width: 0%;
        }
        .progress-box .progress-text { font-size: 12px; color: var(--text-muted); }

        /* ================================================
           DRAWING TOOL PANEL
           ================================================ */
        .toolbar-btn.drawing {
            background: linear-gradient(to bottom, #8a2a6a, #7a1a5a) !important;
            border-color: #c060a0 !important;
            animation: pulse 1s ease-in-out infinite;
        }

        .drawing-panel.modal-panel {
            position: fixed;
            border: 2px solid #9b59b6;
            min-width: 240px;
            max-width: 280px;
            top: 150px;
            right: 20px;
            left: auto;
            bottom: auto;
            z-index: 300;
        }
        .drawing-panel h3 {
            color: #9b59b6;
            cursor: move;
            margin: 0 0 12px 0;
            font-size: 14px;
            padding: 8px;
            margin: -14px -14px 12px -14px;
            background: rgba(155, 89, 182, 0.2);
            border-radius: 10px 10px 0 0;
            user-select: none;
        }

        .drawing-tools {
            display: flex;
            gap: 6px;
            margin-bottom: 12px;
            padding-bottom: 10px;
            border-bottom: 1px solid #444;
        }

        .drawing-tool-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #404040;
            border: 1px solid #555;
            border-radius: 6px;
            cursor: pointer;
            color: #ddd;
            font-size: 18px;
            transition: all 0.15s;
        }

        .drawing-tool-btn:hover {
            background: #505050;
            border-color: #666;
        }

        .drawing-tool-btn.active {
            background: linear-gradient(to bottom, #2a5a8a, #1a4a7a);
            border-color: var(--primary);
            color: #fff;
        }

        .drawing-options {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 12px;
            padding-bottom: 10px;
            border-bottom: 1px solid #444;
        }

        .drawing-option-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .drawing-option-row label {
            font-size: 11px;
            color: #ccc;
            width: 60px;
        }

        .drawing-option-row input[type="color"] {
            width: 36px;
            height: 28px;
            padding: 0;
            border: 1px solid #555;
            border-radius: 4px;
            cursor: pointer;
            background: transparent;
        }

        .drawing-option-row input[type="range"] {
            flex: 1;
            height: 6px;
            background: #404040;
            border-radius: 3px;
            -webkit-appearance: none;
            appearance: none;
        }

        .drawing-option-row input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            background: var(--primary);
            border-radius: 50%;
            cursor: pointer;
        }

        .drawing-option-row span {
            font-size: 11px;
            color: var(--primary);
            font-weight: bold;
            min-width: 16px;
            text-align: center;
        }

        .line-style-btns {
            display: flex;
            gap: 6px;
        }

        .line-style-btn {
            padding: 4px 10px;
            background: #353535;
            border: 1px solid #555;
            border-radius: 4px;
            color: #aaa;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.15s;
        }

        .line-style-btn:hover {
            background: #454545;
            border-color: #666;
        }

        .line-style-btn.active {
            background: linear-gradient(to bottom, #2a5a8a, #1a4a7a);
            border-color: var(--primary);
            color: #fff;
        }

        #lineStyleRow {
            display: none;
        }

        #lineStyleRow.visible {
            display: flex;
        }

        .drawing-actions {
            display: flex;
            gap: 8px;
        }

        .drawing-actions .btn {
            flex: 1;
            padding: 8px;
            font-size: 11px;
        }

        /* Drawing mode cursor - bright red crosshair for visibility */
        .drawing-mode, .drawing-mode canvas {
            cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M16 0v32M0 16h32' stroke='white' stroke-width='4'/%3E%3Cpath d='M16 0v32M0 16h32' stroke='%23ff0000' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='5' fill='none' stroke='white' stroke-width='3'/%3E%3Ccircle cx='16' cy='16' r='5' fill='none' stroke='%23ff0000' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, crosshair !important;
        }

        .drawing-mode.text-tool, .drawing-mode.text-tool canvas {
            cursor: text !important;
        }

        /* Text input overlay for drawing text */
        .drawing-text-input {
            position: absolute;
            background: rgba(0,0,0,0.8);
            border: 2px solid var(--primary);
            border-radius: 4px;
            padding: 8px;
            z-index: 300;
        }

        .drawing-text-input input {
            background: transparent;
            border: none;
            color: #fff;
            font-size: 14px;
            outline: none;
            min-width: 150px;
        }

        .drawing-text-input-buttons {
            display: flex;
            gap: 6px;
            margin-top: 6px;
        }

        .drawing-text-input-buttons button {
            flex: 1;
            padding: 4px 8px;
            font-size: 11px;
            border-radius: 4px;
            cursor: pointer;
        }

        .drawing-text-input-buttons .confirm {
            background: var(--primary);
            border: none;
            color: #fff;
        }

        .drawing-text-input-buttons .cancel {
            background: transparent;
            border: 1px solid #555;
            color: #ccc;
        }

        /* GPS Map Modal Overlay */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            justify-content: center;
            align-items: center;
        }

        .modal-overlay.visible {
            display: flex;
        }

        .modal-overlay .modal-content {
            background: var(--bg-panel);
            border-radius: 12px;
            max-width: 90vw;
            max-height: 90vh;
            overflow: hidden;
            box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
        }

        .modal-overlay .modal-content.modal-large {
            width: 800px;
        }

        .modal-overlay .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            background: var(--bg-secondary);
        }

        .modal-overlay .modal-header h2 {
            margin: 0;
            font-size: 18px;
            color: var(--text);
        }

        .modal-overlay .modal-close {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 24px;
            cursor: pointer;
            padding: 0;
            line-height: 1;
        }

        .modal-overlay .modal-close:hover {
            color: var(--text);
        }

        /* GPS Map Container */
        .gps-map-container {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
            background: #222;
        }

        #gpsMap {
            width: 100%;
            height: 500px;
            background: #1a1a1a;
        }

        .gps-map-info {
            padding: 12px;
            background: #2a2a2a;
            border-top: 1px solid #444;
            font-size: 13px;
            color: #888;
            text-align: center;
        }

        .gps-map-info span {
            margin: 0 8px;
        }

        /* GPS button in file list */
        .file-gps-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 4px;
            font-size: 14px;
            opacity: 0.7;
            transition: opacity 0.2s, transform 0.2s;
        }

        .file-gps-btn:hover {
            opacity: 1;
            transform: scale(1.2);
        }

        /* Leaflet custom styles */
        .leaflet-container {
            font-family: inherit;
        }

        .gps-start-marker {
            background-color: #28a745 !important;
            border: 2px solid #fff;
            border-radius: 50%;
            width: 14px !important;
            height: 14px !important;
            margin-left: -7px !important;
            margin-top: -7px !important;
        }

        .gps-end-marker {
            background-color: #dc3545 !important;
            border: 2px solid #fff;
            border-radius: 50%;
            width: 14px !important;
            height: 14px !important;
            margin-left: -7px !important;
            margin-top: -7px !important;
        }

        .gps-separator-marker {
            background-color: #ff9500 !important;
            border: 2px solid #fff;
            border-radius: 50%;
            width: 12px !important;
            height: 12px !important;
            margin-left: -6px !important;
            margin-top: -6px !important;
            box-shadow: 0 0 6px rgba(255, 149, 0, 0.6);
        }

        /* GPS Segments info (multi-segment) */
        .gps-segments-info {
            padding: 8px 12px;
            background: rgba(255, 107, 0, 0.1);
            border-top: 1px solid rgba(255, 107, 0, 0.2);
            border-bottom: 1px solid rgba(255, 107, 0, 0.2);
            max-height: 100px;
            overflow-y: auto;
        }

        .gps-segment-stat {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 11px;
            color: #b3b3b3;
            padding: 3px 0;
        }

        .gps-segment-badge {
            background: #ff6b00;
            color: white;
            font-size: 9px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 3px;
            white-space: nowrap;
        }

        .gps-segment-name {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: #999;
        }

        .gps-segment-length {
            white-space: nowrap;
            color: #ccc;
        }

        /* GPS Badge in file list */
        .file-gps-badge {
            display: inline-flex;
            align-items: center;
            background: linear-gradient(135deg, #28a745, #20c997);
            color: white;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 4px;
            margin-left: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .file-gps-badge:hover {
            background: linear-gradient(135deg, #218838, #1ca885);
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
        }

        .file-gps-badge.active {
            background: linear-gradient(135deg, #ff6b00, #ff8c33);
            box-shadow: 0 0 8px rgba(255, 107, 0, 0.5);
        }

        /* GPS Side Panel - Hidden by default with smooth animation */
        .gps-side-panel {
            position: fixed;
            top: 50px;
            right: 0;
            width: 400px;
            height: calc(100vh - 50px);
            background: var(--bg-secondary, #1e1e2d);
            border-left: 1px solid var(--border, #333);
            z-index: 1500;
            transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.4s ease;
            display: flex;
            flex-direction: column;
            box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
            transform: translateX(100%);
            opacity: 0;
            pointer-events: none;
            overscroll-behavior: contain;
        }

        .gps-side-panel.open {
            transform: translateX(0);
            opacity: 1;
            pointer-events: auto;
        }

        .gps-side-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: var(--bg-tertiary, #252538);
            border-bottom: 1px solid var(--border, #333);
        }

        .gps-side-panel-header h3 {
            margin: 0;
            font-size: 14px;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .gps-side-panel-header-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .gps-recenter-btn {
            background: rgba(77, 171, 247, 0.15);
            border: 1px solid rgba(77, 171, 247, 0.3);
            color: #4dabf7;
            font-size: 18px;
            cursor: pointer;
            padding: 2px 8px;
            border-radius: 50%;
            transition: all 0.2s;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
        }

        .gps-recenter-btn:hover {
            background: rgba(77, 171, 247, 0.4);
            color: #fff;
            border-color: #4dabf7;
            transform: scale(1.1);
        }

        .gps-side-panel-close {
            background: transparent;
            border: none;
            color: #888;
            font-size: 20px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .gps-side-panel-close:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.1);
        }

        .gps-side-panel-info {
            display: flex;
            justify-content: space-around;
            padding: 10px 16px;
            background: rgba(0, 0, 0, 0.2);
            border-bottom: 1px solid var(--border, #333);
            font-size: 12px;
            color: #aaa;
        }

        .gps-side-panel-info span {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .gps-side-panel-coords {
            padding: 8px 16px;
            background: rgba(0, 0, 0, 0.15);
            border-bottom: 1px solid var(--border, #333);
            font-size: 11px;
            color: #888;
            font-family: monospace;
            text-align: center;
        }

        .gps-side-panel-coords .coord-label {
            color: #666;
            margin-right: 4px;
        }

        .gps-side-panel-coords .coord-value {
            color: #4dabf7;
        }

        /* Map style selector */
        .gps-style-selector-container {
            padding: 6px 12px;
            background: rgba(0, 0, 0, 0.2);
            border-bottom: 1px solid var(--border, #333);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .gps-map-style-selector {
            flex: 1;
            padding: 5px 8px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            color: #ccc;
            font-size: 11px;
            cursor: pointer;
            outline: none;
            transition: all 0.2s ease;
        }

        .gps-map-style-selector:hover {
            background: rgba(255, 255, 255, 0.15);
            border-color: rgba(255, 255, 255, 0.3);
        }

        .gps-map-style-selector:focus {
            border-color: #ff6b00;
            box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.2);
        }

        .gps-map-style-selector option {
            background: #1a1a2e;
            color: #ccc;
            padding: 4px;
        }

        .gps-side-map-container {
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }

        #gpsSideMap {
            width: 100%;
            height: 100%;
            touch-action: none; /* Prevent page scroll when panning map */
        }

        /* GPS panel resize handle */
        .gps-resize-handle {
            display: none; /* Hidden by default, shown only on desktop when panel is open */
        }

        @media (min-width: 900px) {
            .gps-side-panel.open .gps-resize-handle {
                display: block;
                position: absolute;
                left: -8px;
                top: 0;
                bottom: 0;
                width: 16px;
                cursor: ew-resize;
                background: transparent;
                z-index: 100;
                transition: background 0.2s;
            }

            .gps-resize-handle:hover,
            .gps-resize-handle.dragging {
                background: linear-gradient(90deg, transparent, rgba(77, 171, 247, 0.3), transparent);
            }

            .gps-resize-handle::before {
                content: '';
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
                width: 4px;
                height: 50px;
                background: rgba(255, 255, 255, 0.2);
                border-radius: 2px;
                transition: all 0.2s;
            }

            .gps-resize-handle:hover::before,
            .gps-resize-handle.dragging::before {
                background: #4dabf7;
                height: 80px;
                box-shadow: 0 0 8px rgba(77, 171, 247, 0.5);
            }
        }

        /* GPS cursor marker on map */
        .gps-cursor-marker {
            background-color: #4dabf7 !important;
            border: 3px solid #fff;
            border-radius: 50%;
            width: 16px !important;
            height: 16px !important;
            margin-left: -8px !important;
            margin-top: -8px !important;
            box-shadow: 0 0 10px rgba(77, 171, 247, 0.8), 0 0 20px rgba(77, 171, 247, 0.4);
            animation: gps-pulse 1.5s ease-out infinite;
        }

        @keyframes gps-pulse {
            0% {
                box-shadow: 0 0 10px rgba(77, 171, 247, 0.8), 0 0 20px rgba(77, 171, 247, 0.4);
            }
            50% {
                box-shadow: 0 0 15px rgba(77, 171, 247, 1), 0 0 30px rgba(77, 171, 247, 0.6);
            }
            100% {
                box-shadow: 0 0 10px rgba(77, 171, 247, 0.8), 0 0 20px rgba(77, 171, 247, 0.4);
            }
        }

        /* Mobile responsive - GPS panel as fullscreen overlay */
        @media (max-width: 768px) {
            .gps-side-panel {
                position: fixed !important;
                top: 50px !important;
                right: 0 !important;
                width: 100% !important;
                height: calc(100vh - 50px) !important;
                transform: translateX(100%);
            }

            .gps-side-panel.open {
                transform: translateX(0);
            }
        }

        /* ============================================================
           DELETE ACCOUNT MODAL
           ============================================================ */

        .delete-account-modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.8);
            z-index: 30000;
            justify-content: center;
            align-items: center;
        }

        .delete-account-modal-overlay.visible {
            display: flex;
        }

        .delete-account-dialog {
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 24px;
            max-width: 450px;
            width: 90%;
            text-align: center;
        }

        .delete-account-dialog h3 {
            color: var(--danger);
            margin-bottom: 16px;
        }

        .delete-account-dialog p {
            color: #ccc;
            margin-bottom: 16px;
            font-size: 14px;
        }

        .delete-account-dialog ul {
            text-align: left;
            color: #aaa;
            font-size: 13px;
            margin-bottom: 20px;
            padding-left: 20px;
        }

        .delete-account-dialog .confirm-hint {
            color: var(--warning);
            margin-bottom: 20px;
            font-size: 13px;
        }

        .delete-account-dialog input[type="email"] {
            width: 100%;
            padding: 12px;
            background: #333;
            border: 1px solid #555;
            border-radius: 6px;
            color: #fff;
            margin-bottom: 16px;
        }

        .delete-account-dialog .btn-group {
            display: flex;
            gap: 12px;
            justify-content: center;
        }

        .delete-account-dialog .btn {
            padding: 10px 24px;
        }

        .delete-account-dialog .btn-danger {
            background: var(--danger);
            color: #fff;
            border: none;
            border-radius: 6px;
            cursor: pointer;
        }

        .delete-account-dialog .btn-danger:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* ============================================================
           MIGRATION PANEL
           ============================================================ */

        .migration-panel-wrapper {
            position: relative;
        }

        .migration-panel {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background: var(--bg-secondary);
            border: 1px solid #555;
            border-radius: 8px;
            padding: 12px;
            min-width: 280px;
            z-index: 200;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        }

        .migration-panel h4 {
            margin: 0 0 10px 0;
            font-size: 13px;
            color: #fff;
        }

        .migration-panel p {
            font-size: 11px;
            color: #aaa;
            margin-bottom: 12px;
        }

        .migration-panel .migration-fields {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .migration-panel .migration-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .migration-panel .migration-row label {
            font-size: 11px;
            color: #ccc;
            width: 90px;
        }

        .migration-panel .migration-velocity {
            font-size: 12px;
            color: var(--info);
            font-weight: bold;
        }

        .migration-panel .migration-epsr {
            font-size: 10px;
            color: #888;
        }

        .migration-panel input[type="number"] {
            width: 70px;
            padding: 4px;
            background: #333;
            border: 1px solid #555;
            border-radius: 4px;
            color: #fff;
            font-size: 11px;
        }

        .migration-panel .migration-actions {
            display: flex;
            gap: 8px;
            margin-top: 12px;
        }

        .migration-panel .migration-actions .btn {
            padding: 8px;
            font-size: 12px;
        }

        .migration-panel .migration-actions .btn-primary {
            flex: 1;
        }

        /* ============================================================
           GAIN EXPONENTIEL PANEL
           ============================================================ */

        .expgain-wrapper {
            position: relative;
        }

        .expgain-panel {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background: var(--bg-secondary);
            border: 1px solid #555;
            border-radius: 8px;
            padding: 12px;
            min-width: 220px;
            z-index: 200;
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        }

        .expgain-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .expgain-row:last-child {
            margin-bottom: 0;
        }

        .expgain-row label {
            width: 50px;
            font-size: 11px;
            color: #ccc;
        }

        .expgain-row input[type="range"] {
            flex: 1;
        }

        .expgain-row span {
            width: 40px;
            text-align: right;
            font-size: 11px;
            color: var(--info);
            font-weight: bold;
        }

        /* ============================================================
           FILTERS SIDE PANEL
           ============================================================ */

        .filters-side-panel {
            position: fixed;
            top: calc(var(--toolbar-height) + var(--toolbar2-height));
            right: 0;
            width: 360px;
            height: calc(100vh - var(--toolbar-height) - var(--toolbar2-height) - var(--status-height));
            background: var(--bg-secondary);
            border-left: 1px solid var(--border);
            z-index: 1400;
            display: flex;
            flex-direction: column;
            box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
            transform: translateX(100%);
            opacity: 0;
            pointer-events: none;
            transition: transform 0.3s ease, opacity 0.3s ease;
        }

        .filters-side-panel.open {
            transform: translateX(0);
            opacity: 1;
            pointer-events: auto;
        }

        .filters-side-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: var(--bg-tertiary);
            border-bottom: 1px solid var(--border);
        }

        .filters-side-panel-header h3 {
            margin: 0;
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
        }

        .filters-side-panel-close {
            background: none;
            border: none;
            color: #888;
            font-size: 20px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .filters-side-panel-close:hover {
            background: rgba(255,255,255,0.1);
            color: #fff;
        }

        .filters-side-panel-content {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
        }

        .filter-section {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 12px;
        }

        .filter-section.filter-coming-soon {
            opacity: 0.5;
            border-style: dashed;
        }

        .filter-header {
            display: flex;
            align-items: center;
            margin-bottom: 8px;
        }

        .filter-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
        }

        .filter-toggle input[type="checkbox"] {
            width: 16px;
            height: 16px;
            cursor: pointer;
        }

        .filter-name {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
        }

        .filter-description {
            font-size: 11px;
            color: var(--text-muted);
            margin-bottom: 12px;
            line-height: 1.4;
        }

        .filter-controls {
            display: none;
        }

        .filter-section.active .filter-controls {
            display: block;
        }

        .filter-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
        }

        .filter-row:last-child {
            margin-bottom: 0;
        }

        .filter-row label {
            font-size: 11px;
            color: #aaa;
            width: 90px;
            flex-shrink: 0;
        }

        .filter-row input[type="range"] {
            flex: 1;
        }

        .filter-row span {
            width: 30px;
            text-align: right;
            font-size: 12px;
            color: var(--info);
            font-weight: bold;
        }

        .filter-row select {
            flex: 1;
            padding: 6px 8px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            font-size: 11px;
            cursor: pointer;
        }

        /* Advanced Filters (V/H FFT) */

        .adv-filter-preset-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            margin-bottom: 8px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 8px;
        }

        .adv-filter-preset-bar label {
            font-size: 11px;
            color: #aaa;
            white-space: nowrap;
        }

        .adv-filter-preset-select {
            flex: 1;
            background: var(--bg-secondary);
            color: var(--text);
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 4px 6px;
            font-size: 11px;
            cursor: pointer;
        }

        .adv-filter-preset-select:focus {
            border-color: var(--info);
            outline: none;
        }

        .adv-filter-section {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 8px 10px;
            margin-bottom: 8px;
        }

        .adv-filter-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            user-select: none;
        }

        .adv-filter-toggle input[type="checkbox"] {
            width: 14px;
            height: 14px;
            cursor: pointer;
            accent-color: var(--info);
        }

        .adv-filter-name {
            font-size: 12px;
            font-weight: 600;
            color: var(--text);
            flex: 1;
        }

        .adv-filter-hint {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: rgba(255,255,255,0.08);
            color: #888;
            font-size: 10px;
            cursor: help;
            flex-shrink: 0;
        }

        .adv-filter-hint:hover {
            background: var(--info);
            color: #fff;
        }

        .adv-filter-controls {
            display: none;
            padding-top: 8px;
            margin-top: 6px;
            border-top: 1px solid var(--border);
        }

        .adv-filter-section.active .adv-filter-controls {
            display: block;
        }

        .adv-filter-desc {
            font-size: 10px;
            color: #888;
            margin: 0 0 8px 0;
            line-height: 1.4;
            padding: 4px 6px;
            background: rgba(255,255,255,0.03);
            border-radius: 4px;
            border-left: 2px solid var(--info);
        }

        .adv-filter-desc strong {
            color: #bbb;
        }

        .adv-filter-row {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
        }

        .adv-filter-row:last-child {
            margin-bottom: 0;
        }

        .adv-filter-row > label {
            font-size: 11px;
            color: #999;
            width: 72px;
            flex-shrink: 0;
        }

        .adv-filter-row-radio {
            gap: 12px;
        }

        .adv-filter-row-radio label {
            font-size: 11px;
            color: #aaa;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            width: auto;
        }

        .adv-filter-row-radio input[type="radio"] {
            width: 12px;
            height: 12px;
            accent-color: var(--info);
        }

        .adv-filter-input {
            width: 54px;
            padding: 3px 5px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            font-size: 12px;
            text-align: center;
        }

        .adv-filter-input-sm {
            width: 42px;
        }

        .adv-filter-input:focus {
            border-color: var(--info);
            outline: none;
        }

        .adv-filter-slider {
            flex: 1;
            height: 4px;
            accent-color: var(--info);
            cursor: pointer;
        }

        .adv-filter-unit {
            font-size: 10px;
            color: #666;
            width: 28px;
            flex-shrink: 0;
        }

        .adv-filter-step {
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 3px;
            color: var(--text);
            font-size: 11px;
            width: 22px;
            height: 22px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .adv-filter-step:hover {
            background: var(--info);
            color: #fff;
        }

        /* Preview section */
        .adv-filter-preview-section {
            margin-top: 10px;
            border-top: 1px solid var(--border);
            padding-top: 10px;
        }

        .adv-filter-preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .adv-filter-preview-header span {
            font-size: 12px;
            font-weight: 600;
            color: var(--text);
        }

        .adv-filter-preview-header .btn-xs {
            font-size: 14px;
            padding: 2px 6px;
            line-height: 1;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            cursor: pointer;
        }

        .adv-filter-preview-header .btn-xs:hover {
            background: var(--info);
            color: #fff;
        }

        .adv-filter-preview-container {
            position: relative;
            border: 1px solid var(--border);
            border-radius: 6px;
            overflow: hidden;
            background: #111;
            cursor: ew-resize;
        }

        #filterPreviewCanvas {
            display: block;
            width: 100%;
            height: auto;
        }

        .adv-filter-preview-divider {
            position: absolute;
            top: 0;
            left: 50%;
            width: 3px;
            height: 100%;
            background: #ffd600;
            cursor: ew-resize;
            z-index: 2;
            transform: translateX(-1px);
        }

        /* Visible grip handle */
        .adv-filter-preview-divider::before {
            content: '';
            position: absolute;
            top: 50%;
            left: -6px;
            width: 15px;
            height: 24px;
            background: rgba(255, 214, 0, 0.7);
            border-radius: 3px;
            transform: translateY(-50%);
        }

        /* Invisible wide hit area for easier clicking */
        .adv-filter-preview-divider::after {
            content: '';
            position: absolute;
            top: 0;
            left: -15px;
            width: 33px;
            height: 100%;
            cursor: ew-resize;
        }

        .adv-filter-preview-labels {
            display: flex;
            justify-content: space-between;
            padding: 3px 8px;
            font-size: 10px;
            color: #888;
            background: rgba(0,0,0,0.4);
        }

        /* Detached floating preview */
        .adv-filter-preview-floating {
            position: fixed;
            z-index: 2000;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 8px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            padding: 0;
            overflow: hidden;
            resize: both;
            min-width: 400px;
            min-height: 280px;
        }

        .adv-filter-preview-floating .adv-filter-preview-float-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 10px;
            background: var(--bg-panel);
            cursor: move;
            user-select: none;
            border-bottom: 1px solid var(--border);
        }

        .adv-filter-preview-floating .adv-filter-preview-float-header span {
            font-size: 12px;
            font-weight: 600;
            color: var(--text);
        }

        .adv-filter-preview-float-close {
            background: none;
            border: none;
            color: #888;
            font-size: 16px;
            cursor: pointer;
            padding: 0 4px;
        }

        .adv-filter-preview-float-close:hover {
            color: #fff;
        }

        .adv-filter-preview-floating canvas {
            display: block;
            width: 100%;
            height: calc(100% - 56px);
        }

        .adv-filter-preview-floating .adv-filter-preview-divider {
            height: calc(100% - 56px);
            top: 30px;
        }

        .adv-filter-preview-floating .adv-filter-preview-labels {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
        }

        /* Progress bar */
        .adv-filter-progress {
            margin-top: 10px;
            padding: 8px 0;
        }

        .adv-filter-progress-track {
            width: 100%;
            height: 6px;
            background: var(--bg-tertiary);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 4px;
        }

        .adv-filter-progress-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, var(--info), #4fc3f7);
            border-radius: 3px;
            transition: width 0.3s ease;
        }

        .adv-filter-progress-fill.indeterminate {
            width: 30% !important;
            animation: adv-filter-progress-slide 1.2s ease-in-out infinite;
        }

        @keyframes adv-filter-progress-slide {
            0% { margin-left: 0%; }
            50% { margin-left: 70%; }
            100% { margin-left: 0%; }
        }

        .adv-filter-progress-text {
            font-size: 10px;
            color: #aaa;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        /* Action buttons */
        .adv-filter-actions {
            display: flex;
            gap: 6px;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid var(--border);
        }

        .adv-filter-actions .btn {
            flex: 1;
            font-size: 11px;
            padding: 6px 8px;
        }

        @media (max-width: 768px) {
            .filters-side-panel {
                width: 100%;
                top: 50px;
                height: calc(100vh - 50px);
            }
        }

        /* ============================================================
           TRAINING SECTIONS (temporairement masquées)
           ============================================================ */

        .training-section.hidden {
            display: none;
        }

        .model-upload-cloud {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 12px;
        }

        .model-upload-row {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .model-upload-row input[type="file"] {
            display: none;
        }

        .model-upload-row .model-filename {
            color: #888;
            font-size: 12px;
        }

        .model-upload-status {
            margin-top: 10px;
            font-size: 12px;
            color: #888;
        }

        /* ============================================================
           VIEW 3D CONTROLS
           ============================================================ */

        #picking3DView {
            display: none;
        }

        .view3d-container {
            width: 100%;
            height: 350px;
            background: #111;
            border-radius: 8px;
            position: relative;
            overflow: hidden;
        }

        .view3d-fullscreen-btn {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 32px;
            height: 32px;
            background: rgba(50,50,50,0.8);
            border: 1px solid #555;
            border-radius: 4px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            z-index: 10;
        }

        .view3d-refresh-btn {
            position: absolute;
            top: 8px;
            right: 48px;
            width: 32px;
            height: 32px;
            background: rgba(50,50,50,0.8);
            border: 1px solid #555;
            border-radius: 4px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            z-index: 10;
        }

        .view3d-refresh-btn:hover {
            background: rgba(70,70,70,0.9);
            border-color: #3498db;
        }

        .view3d-floating-controls {
            display: none;
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(30,30,30,0.95);
            padding: 16px 28px;
            border-radius: 12px;
            border: 1px solid #666;
            z-index: 10;
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
        }

        .view3d-floating-controls .controls-row {
            display: flex;
            align-items: center;
            gap: 20px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .view3d-floating-controls .preset-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .view3d-floating-controls .divider {
            width: 1px;
            height: 36px;
            background: #555;
        }

        .view3d-floating-controls .transparency-group {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .view3d-floating-controls .transparency-group label {
            font-size: 14px;
            color: #ddd;
            font-weight: 500;
        }

        .view3d-floating-controls .transparency-group input[type="range"] {
            width: 160px;
            cursor: pointer;
            height: 8px;
        }

        .view3d-floating-controls .transparency-group .value {
            font-size: 14px;
            color: #aaa;
            width: 45px;
        }

        .view3d-floating-controls .capture-btn {
            padding: 10px 20px;
            background: var(--primary);
            border: none;
            border-radius: 8px;
            color: #fff;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.15s;
        }

        .view3d-gizmo {
            display: none;
            position: absolute;
            top: 60px;
            right: 20px;
            z-index: 10;
        }

        .view3d-gizmo canvas {
            cursor: pointer;
        }

        .view3d-controls {
            display: flex;
            gap: 12px;
            margin-top: 8px;
            align-items: center;
            flex-wrap: wrap;
        }

        .view3d-controls .control-group {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .view3d-controls .control-group label {
            font-size: 11px;
            color: #aaa;
        }

        .view3d-controls .control-group input[type="number"] {
            width: 55px;
            padding: 4px;
            background: #333;
            border: 1px solid #555;
            border-radius: 4px;
            color: #fff;
            font-size: 11px;
        }

        .view3d-controls .control-group input[type="range"] {
            width: 80px;
            cursor: pointer;
        }

        .view3d-controls .control-group .value {
            font-size: 10px;
            color: #888;
            width: 30px;
        }

        .view3d-export-btns {
            margin-top: 8px;
            gap: 6px;
        }

        .view3d-export-btns .btn-primary {
            flex: 2;
        }

        .view3d-export-btns .btn-secondary {
            flex: 1;
        }

        /* ============================================================
           IA DETECTION FILTER PANEL
           ============================================================ */

        .ia-detect-filter-panel {
            width: 300px;
            max-height: 450px;
        }

        .ia-confidence-section {
            background: rgba(255,255,255,0.05);
            padding: 10px;
            border-radius: 8px;
            margin-bottom: 12px;
        }

        .ia-confidence-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .ia-confidence-header .label {
            font-size: 12px;
            color: #aaa;
        }

        .ia-confidence-header .value {
            font-size: 14px;
            font-weight: bold;
            color: #4ecdc4;
        }

        .ia-confidence-section input[type="range"] {
            width: 100%;
            accent-color: #4ecdc4;
        }

        .ia-color-filters {
            display: flex;
            gap: 6px;
            margin-top: 10px;
        }

        .ia-color-filters .btn {
            flex: 1;
            padding: 5px 8px;
            font-size: 11px;
            border: none;
            color: #fff;
            border-radius: 4px;
        }

        .ia-color-filters .btn-red { background: var(--danger); }
        .ia-color-filters .btn-orange { background: var(--warning); }
        .ia-color-filters .btn-green { background: #27ae60; }

        .ia-classes-label {
            font-size: 12px;
            color: #aaa;
            margin-bottom: 6px;
        }

        .ia-classes-content {
            max-height: 250px;
            overflow-y: auto;
        }

        .ia-filter-actions {
            margin-top: 12px;
            display: flex;
            gap: 8px;
        }

        .ia-filter-actions .btn {
            flex: 1;
            padding: 6px;
        }

        .ia-export-section {
            margin-top: 12px;
            border-top: 1px solid #333;
            padding-top: 12px;
        }

        .ia-export-section .btn {
            width: 100%;
            padding: 8px;
        }

        /* ============================================================
           UTILITY CLASSES
           ============================================================ */

        .scrollbar-hidden {
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .scrollbar-hidden::-webkit-scrollbar {
            display: none;
        }

        /* ============================================================
           C-SCAN SPLIT PANEL (vertical, à droite du B-scan)
           ============================================================ */
        .cscan-split-handle {
            width: 6px;
            background: #2a2a3e;
            cursor: col-resize;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            border-left: 1px solid #0f3460;
            border-right: 1px solid #0f3460;
        }
        .cscan-split-handle:hover { background: #3a3a5e; }
        .cscan-split-grip {
            width: 2px;
            height: 40px;
            background: #666;
            border-radius: 1px;
        }
        .cscan-split-panel {
            width: 50%;
            display: flex;
            flex-direction: column;
            background: #1a1a2e;
            min-width: 200px;
            overflow: hidden;
            color: #e0e0e0;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            flex-shrink: 0;
        }
        .cscan-split-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 2px 10px;
            background: #16213e;
            border-bottom: 1px solid #0f3460;
            min-height: 28px;
            flex-shrink: 0;
        }
        .cscan-split-header-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .cscan-split-title {
            font-size: 13px;
            font-weight: 600;
            color: #e94560;
        }
        .cscan-split-header-right {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .cscan-hdr-btn {
            background: none;
            border: 1px solid transparent;
            color: #aaa;
            font-size: 16px;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
            line-height: 1;
            transition: all 0.15s;
        }
        .cscan-hdr-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
        .cscan-hdr-btn:disabled { opacity: 0.3; cursor: not-allowed; }
        .cscan-hdr-btn.cscan-close-btn { font-size: 20px; }
        .cscan-hdr-btn.cscan-close-btn:hover { color: #e94560; }
        .cscan-split-body {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
        }
        .cscan-inner-handle {
            height: 5px;
            background: #2a2a3e;
            cursor: row-resize;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .cscan-inner-handle:hover { background: #3a3a5e; }
        .cscan-inner-grip {
            width: 30px;
            height: 2px;
            background: #555;
            border-radius: 1px;
        }
        .cscan-compact-bar {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            background: #16213e;
            border-top: 1px solid #0f3460;
            flex-shrink: 0;
            font-size: 11px;
            color: #aaa;
            flex-wrap: wrap;
        }
        .cscan-compact-bar label {
            white-space: nowrap;
            font-weight: 600;
        }
        .cscan-compact-bar input[type="range"] {
            flex: 1;
            min-width: 60px;
            max-width: 140px;
            accent-color: #e94560;
            height: 16px;
        }
        .cscan-compact-val {
            font-size: 12px;
            font-weight: 700;
            color: #e94560;
            min-width: 45px;
            text-align: center;
        }
        .cscan-compact-sep {
            color: #333;
            font-size: 14px;
        }
        .cscan-anim-btn {
            background: #1a1a2e;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            color: #e0e0e0;
            font-size: 10px;
            width: 22px;
            height: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            transition: background 0.2s;
        }
        .cscan-anim-btn:hover:not(:disabled) {
            background: #0f3460;
        }
        .cscan-anim-btn:disabled {
            opacity: 0.4;
            cursor: default;
        }
        .cscan-anim-btn.playing {
            background: #e94560;
            color: #fff;
            border-color: #e94560;
        }
        .cscan-compact-select {
            background: #1a1a2e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 2px 6px;
            font-size: 11px;
            cursor: pointer;
        }
        /* Colormap picker custom */
        .cscan-cmap-picker {
            position: relative;
        }
        .cscan-cmap-btn {
            display: flex;
            align-items: center;
            gap: 4px;
            background: #1a1a2e;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 2px 6px;
            cursor: pointer;
            color: #e0e0e0;
        }
        .cscan-cmap-btn:hover {
            border-color: rgba(255,255,255,0.3);
        }
        .cscan-cmap-preview {
            border-radius: 2px;
            height: 12px;
            width: 60px;
        }
        .cscan-cmap-name {
            font-size: 11px;
            white-space: nowrap;
        }
        .cscan-cmap-arrow {
            font-size: 9px;
            color: #888;
        }
        .cscan-cmap-dropdown {
            display: none;
            position: absolute;
            bottom: 100%;
            left: 0;
            margin-bottom: 4px;
            background: #1a1a2e;
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 6px;
            padding: 4px;
            z-index: 100;
            box-shadow: 0 -4px 16px rgba(0,0,0,0.5);
            min-width: 150px;
        }
        .cscan-cmap-dropdown.open {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .cscan-cmap-option {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            border: none;
            background: none;
            color: #ccc;
            width: 100%;
            text-align: left;
        }
        .cscan-cmap-option:hover {
            background: rgba(255,255,255,0.08);
        }
        .cscan-cmap-option.active {
            background: rgba(93,173,226,0.15);
            color: #5dade2;
        }
        .cscan-cmap-option canvas {
            border-radius: 2px;
            height: 14px;
            width: 70px;
            flex-shrink: 0;
        }
        .cscan-cmap-option span {
            font-size: 11px;
            white-space: nowrap;
        }
        .cscan-compact-invert {
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 11px;
            color: #aaa;
            cursor: pointer;
            white-space: nowrap;
        }
        .cscan-compact-invert input[type="checkbox"] {
            width: 13px;
            height: 13px;
            margin: 0;
        }

        .cscan-status {
            font-size: 12px;
            color: #888;
            background: rgba(255,255,255,0.05);
            padding: 2px 8px;
            border-radius: 10px;
        }

        .cscan-section {
            padding: 10px 12px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .cscan-section h4 {
            margin: 0 0 8px 0;
            font-size: 12px;
            font-weight: 600;
            color: #aaa;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .cscan-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .cscan-empty-msg {
            font-size: 12px;
            color: #666;
            text-align: center;
            padding: 20px 10px;
        }

        /* Zone inférieure C-Scan : panneau build + canvas */
        .cscan-bottom-area {
            flex: 1;
            display: flex;
            flex-direction: row;
            overflow: hidden;
        }
        .cscan-build-panel {
            width: 220px;
            flex-shrink: 0;
            background: #16213e;
            border-left: 1px solid #0f3460;
            display: flex;
            flex-direction: column;
            padding: 8px;
            gap: 8px;
            overflow-y: auto;
        }
        /* Coordonnées curseur */
        .cscan-coord-display {
            background: #0d1b3e;
            border: 1px solid #1a3a6e;
            border-radius: 6px;
            padding: 6px 8px;
            display: flex;
            flex-direction: column;
            gap: 3px;
        }
        .cscan-coord-row {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .cscan-coord-label {
            font-size: 10px;
            font-weight: 700;
            color: #e94560;
            width: 28px;
            text-align: right;
            letter-spacing: 0.5px;
        }
        .cscan-coord-value {
            flex: 1;
            font-size: 13px;
            font-weight: 600;
            color: #e0e0e0;
            font-family: 'Consolas', 'Monaco', monospace;
            text-align: right;
        }
        .cscan-coord-unit {
            font-size: 10px;
            color: #667;
            width: 20px;
        }

        .cscan-build-section {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }
        .cscan-build-section h4 {
            margin: 0;
            font-size: 10px;
            color: #888;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .cscan-build-opt {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 11px;
            color: #ccc;
            cursor: pointer;
            white-space: nowrap;
        }
        .cscan-build-opt input[type="checkbox"] {
            width: 13px;
            height: 13px;
            margin: 0;
        }
        .cscan-vert-slider {
            width: 100%;
            accent-color: #e94560;
            height: 16px;
        }
        .cscan-slider-val {
            display: block;
            text-align: center;
            font-size: 11px;
            font-weight: 700;
            color: #e94560;
        }
        .cscan-build-panel .cscan-build-btn {
            margin-top: auto;
            font-size: 11px;
            padding: 8px 6px;
            width: 100%;
        }
        .cscan-build-btn-small {
            margin-top: auto;
            font-size: 11px;
            font-weight: 600;
            padding: 6px 10px;
            width: 100%;
            background: #e94560;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: filter 0.15s, background 0.15s;
        }
        .cscan-build-btn-small:hover { background: #d63851; filter: brightness(1.1); }
        .cscan-build-btn-small:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
        /* Polylignes */
        .cscan-polyline-controls {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }
        .cscan-poly-btn {
            flex: 1;
            min-width: 55px;
            padding: 4px 6px;
            font-size: 10px;
            background: #1a1a2e;
            color: #ccc;
            border: 1px solid #0f3460;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.2s;
        }
        .cscan-poly-btn:hover:not(:disabled) {
            background: #0f3460;
            color: #fff;
        }
        .cscan-poly-btn:disabled {
            opacity: 0.4;
            cursor: default;
        }
        .cscan-poly-btn.active {
            background: #e94560;
            color: #fff;
            border-color: #e94560;
        }
        .cscan-poly-delete {
            flex: 0;
            min-width: 30px;
        }
        .cscan-polyline-list {
            max-height: 120px;
            overflow-y: auto;
            margin: 4px 0;
        }
        .cscan-polyline-item {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 3px 4px;
            font-size: 10px;
            color: #ccc;
            cursor: pointer;
            border-radius: 3px;
            transition: background 0.15s;
        }
        .cscan-polyline-item:hover {
            background: rgba(255,255,255,0.05);
        }
        .cscan-polyline-item.active {
            background: rgba(233, 69, 96, 0.2);
            color: #fff;
        }
        .cscan-polyline-item .poly-color-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        /* Zone canvas C-scan */
        .cscan-canvas-wrapper {
            flex: 1;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #111;
            overflow: hidden;
        }
        #cscanCanvas {
            max-width: 100%;
            max-height: 100%;
            image-rendering: pixelated;
        }
        .cscan-cursor-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 3;
        }
        .cscan-no-data {
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: #555;
            font-size: 14px;
        }
        .cscan-no-data p { margin: 0; }

        /* Zone supérieure C-Scan : plan view + paramètres inline */
        .cscan-top-area {
            display: flex;
            flex-direction: row;
            height: 35%;
            min-height: 80px;
            flex-shrink: 0;
            overflow: hidden;
        }
        .cscan-planview-area {
            flex: 1;
            background: #111;
            position: relative;
            overflow: hidden;
            min-width: 0;
        }
        .cscan-planview-area canvas {
            width: 100%;
            height: 100%;
            cursor: grab;
        }
        .cscan-planview-area canvas:active {
            cursor: grabbing;
        }
        /* Options d'affichage plan view (overlay en bas à gauche) */
        .cscan-planview-options {
            position: absolute;
            bottom: 4px;
            left: 4px;
            display: flex;
            gap: 8px;
            background: rgba(0,0,0,0.6);
            border-radius: 4px;
            padding: 2px 8px;
            z-index: 2;
        }
        .cscan-pv-opt {
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 10px;
            color: #aaa;
            cursor: pointer;
            white-space: nowrap;
        }
        .cscan-pv-opt input[type="checkbox"] {
            width: 12px;
            height: 12px;
            margin: 0;
        }
        .cscan-inline-settings {
            width: 220px;
            flex-shrink: 0;
            background: #16213e;
            border-left: 1px solid #0f3460;
            display: none;
            flex-direction: column;
            overflow: hidden;
        }
        .cscan-inline-settings.visible {
            display: flex;
        }
        .cscan-inline-settings-scroll {
            overflow-y: auto;
            flex: 1;
            padding: 4px 0;
        }
        .cscan-inline-settings .cscan-section {
            padding: 6px 10px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .cscan-inline-settings .cscan-section h4 {
            margin: 0 0 4px 0;
            font-size: 10px;
        }
        .cscan-inline-settings .cscan-field {
            margin-bottom: 4px;
        }
        .cscan-inline-settings .cscan-field label {
            font-size: 10px;
        }
        .cscan-inline-settings .cscan-field input,
        .cscan-inline-settings .cscan-field select {
            font-size: 11px;
            padding: 3px 6px;
        }
        .cscan-inline-settings .cscan-hint {
            font-size: 10px;
            margin: 2px 0;
        }
        .cscan-inline-settings .cscan-checkbox {
            font-size: 11px;
        }
        .cscan-inline-settings .cscan-grid-type-btns {
            margin-bottom: 6px;
        }
        .cscan-inline-settings .cscan-type-btn {
            padding: 3px 2px;
            font-size: 10px;
        }
        .cscan-inline-settings .cscan-manual-columns {
            gap: 2px;
        }
        .cscan-inline-settings .cscan-dnd-list {
            max-height: 25vh;
        }

        .cscan-grid-type-btns {
            display: flex;
            gap: 4px;
            margin-bottom: 10px;
        }
        .cscan-type-btn {
            flex: 1;
            padding: 5px 4px;
            font-size: 11px;
            background: rgba(255,255,255,0.05);
            color: #ccc;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .cscan-type-btn:hover { background: rgba(255,255,255,0.1); }
        .cscan-type-btn.active {
            background: rgba(233, 69, 96, 0.2);
            border-color: #e94560;
            color: #e94560;
            font-weight: 600;
        }

        .cscan-hint {
            font-size: 11px;
            color: #777;
            margin: 0;
            line-height: 1.4;
        }
        .cscan-auto-groups {
            margin-top: 8px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .cscan-auto-group {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 8px;
            background: rgba(255,255,255,0.04);
            border-radius: 4px;
            font-size: 12px;
        }
        .cscan-auto-label {
            font-weight: 600;
            min-width: 40px;
        }
        .cscan-auto-count {
            font-weight: 700;
            font-size: 14px;
            color: #fff;
            min-width: 24px;
            text-align: center;
        }
        .cscan-auto-files {
            font-size: 10px;
            color: #888;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
        }
        .cscan-field {
            margin-top: 8px;
        }
        .cscan-field label {
            display: block;
            font-size: 11px;
            color: #aaa;
            margin-bottom: 3px;
        }
        .cscan-field input, .cscan-field select {
            width: 100%;
            padding: 5px 8px;
            font-size: 12px;
            background: #1a1a2e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            box-sizing: border-box;
        }
        .cscan-select {
            width: 100%;
            padding: 5px 8px;
            font-size: 12px;
            background: #1a1a2e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
        }

        .cscan-checkbox {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #ccc;
            margin-bottom: 4px;
            cursor: pointer;
        }
        .cscan-checkbox input { accent-color: #e94560; }

        .cscan-actions {
            padding: 12px;
        }
        .cscan-build-btn {
            width: 100%;
            padding: 10px;
            font-size: 14px;
            font-weight: 600;
            background: linear-gradient(to bottom, #e94560, #c0392b);
            border: none;
            color: white;
            border-radius: 6px;
            cursor: pointer;
            transition: filter 0.15s;
        }
        .cscan-build-btn:hover { filter: brightness(1.1); }
        .cscan-build-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

        /* Drag & Drop zones (mode manuel) */
        .cscan-dnd-container {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 8px;
        }
        .cscan-dnd-zone {
            border: 1px dashed rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 4px;
            min-height: 40px;
        }
        .cscan-dnd-zone.drag-over {
            border-color: #e94560;
            background: rgba(233, 69, 96, 0.1);
        }
        .cscan-dnd-label {
            font-size: 9px;
            color: #999;
            text-transform: uppercase;
            margin-bottom: 3px;
            font-weight: 600;
            letter-spacing: 0.3px;
        }
        .cscan-dnd-list {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .cscan-dnd-targets {
            display: flex;
            gap: 6px;
        }
        .cscan-dnd-targets .cscan-dnd-zone { flex: 1; }
        .cscan-dnd-x { border-color: rgba(52, 152, 219, 0.4); }
        .cscan-dnd-y { border-color: rgba(46, 204, 113, 0.4); }
        .cscan-dnd-item {
            padding: 3px 6px;
            font-size: 12px;
            font-weight: 500;
            color: #e0e0e0;
            background: rgba(255,255,255,0.06);
            border-radius: 3px;
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .cscan-dnd-item:active { cursor: grabbing; }
        .cscan-dnd-item.selected {
            background: rgba(233, 69, 96, 0.3);
            border: 1px solid #e94560;
        }

        /* Mode manuel : colonnes X/Y avec boutons flèches */
        .cscan-manual-columns {
            display: flex;
            gap: 2px;
            margin-top: 8px;
            align-items: stretch;
        }
        .cscan-manual-col {
            flex: 1;
            min-width: 0;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 4px;
            padding: 3px;
            display: flex;
            flex-direction: column;
        }
        .cscan-manual-col:first-child { border-color: rgba(52, 152, 219, 0.4); }
        .cscan-manual-col:last-child { border-color: rgba(46, 204, 113, 0.4); }
        .cscan-manual-col .cscan-dnd-list {
            flex: 1;
            max-height: 50vh;
            overflow-y: auto;
        }
        .cscan-manual-arrows {
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 4px;
            padding: 0 1px;
            flex-shrink: 0;
        }
        .cscan-arrow-btn {
            padding: 3px 4px;
            font-size: 10px;
            font-weight: 600;
            background: rgba(255,255,255,0.08);
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            cursor: pointer;
            white-space: nowrap;
            transition: background 0.15s;
        }
        .cscan-arrow-btn:hover { background: rgba(233, 69, 96, 0.3); }
        .cscan-col-count {
            font-size: 9px;
            color: #aaa;
            font-weight: 400;
        }
        .cscan-selectable-list .cscan-dnd-item {
            cursor: pointer;
        }

        /* Responsive */
        @media (max-width: 900px) {
            .cscan-inline-settings {
                width: 180px;
            }
            .cscan-compact-bar {
                flex-wrap: wrap;
            }
        }

        /* ============================================================
           DEPTH CARTOGRAPHY SPLIT PANEL
           ============================================================ */
        .dcarto-split-handle {
            width: 6px;
            background: #2a2a3e;
            cursor: col-resize;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            border-left: 1px solid #0f3460;
            border-right: 1px solid #0f3460;
        }
        .dcarto-split-handle:hover { background: #3a3a5e; }
        .dcarto-split-grip {
            width: 2px;
            height: 40px;
            background: #666;
            border-radius: 1px;
        }
        .dcarto-split-panel {
            width: 50%;
            display: flex;
            flex-direction: column;
            background: #1a1a2e;
            min-width: 200px;
            overflow: hidden;
            color: #e0e0e0;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            flex-shrink: 0;
        }
        .dcarto-split-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 2px 10px;
            background: #16213e;
            border-bottom: 1px solid #0f3460;
            min-height: 28px;
            flex-shrink: 0;
        }
        .dcarto-split-header-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .dcarto-split-title {
            font-size: 13px;
            font-weight: 600;
            color: #2ecc71;
        }
        .dcarto-split-header-right {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .dcarto-hdr-btn {
            background: none;
            border: 1px solid transparent;
            color: #aaa;
            font-size: 16px;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
            line-height: 1;
            transition: all 0.15s;
        }
        .dcarto-hdr-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
        .dcarto-hdr-btn:disabled { opacity: 0.3; cursor: not-allowed; }
        .dcarto-hdr-btn.dcarto-close-btn { font-size: 20px; }
        .dcarto-hdr-btn.dcarto-close-btn:hover { color: #e94560; }

        .dcarto-split-body {
            flex: 1;
            display: flex;
            flex-direction: row;
            overflow: hidden;
        }

        /* Config panel (gauche) */
        .dcarto-config-area {
            width: 230px;
            flex-shrink: 0;
            background: #16213e;
            border-right: 1px solid #0f3460;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .dcarto-config-scroll {
            overflow-y: auto;
            flex: 1;
            padding: 4px 0;
        }
        .dcarto-section {
            padding: 8px 10px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .dcarto-section h4 {
            margin: 0 0 6px 0;
            font-size: 10px;
            font-weight: 600;
            color: #aaa;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .dcarto-radio {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 12px;
            color: #ccc;
            cursor: pointer;
            margin-bottom: 3px;
        }
        .dcarto-radio input[type="radio"] {
            margin: 0;
            accent-color: #2ecc71;
        }
        .dcarto-field {
            display: flex;
            flex-direction: column;
            gap: 2px;
            margin-bottom: 6px;
        }
        .dcarto-field label {
            font-size: 10px;
            color: #999;
        }
        .dcarto-field input,
        .dcarto-field select {
            background: #0d1b3e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 4px 6px;
            font-size: 12px;
        }
        .dcarto-select {
            background: #0d1b3e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 4px;
            padding: 4px 6px;
            font-size: 12px;
            width: 100%;
            cursor: pointer;
        }
        .dcarto-opt {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 11px;
            color: #ccc;
            cursor: pointer;
            margin-bottom: 3px;
        }
        .dcarto-opt input[type="checkbox"] {
            width: 13px;
            height: 13px;
            margin: 0;
            accent-color: #2ecc71;
        }
        .dcarto-source-info {
            font-size: 10px;
            color: #888;
            padding: 3px 0;
        }
        .dcarto-profiles-list {
            max-height: 150px;
            overflow-y: auto;
            margin-top: 6px;
        }
        .dcarto-profile-item {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 3px 4px;
            font-size: 10px;
            color: #ccc;
            border-bottom: 1px solid rgba(255,255,255,0.03);
        }
        .dcarto-profile-dir {
            font-size: 9px;
            font-weight: 700;
            padding: 1px 4px;
            border-radius: 3px;
            flex-shrink: 0;
        }
        .dcarto-dir-x { background: rgba(52,152,219,0.2); color: #5dade2; }
        .dcarto-dir-y { background: rgba(46,204,113,0.2); color: #2ecc71; }
        .dcarto-profile-name {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .dcarto-profile-ifaces {
            font-size: 9px;
            color: #777;
            flex-shrink: 0;
        }
        .dcarto-profile-pos {
            width: 45px;
            background: #0d1b3e;
            color: #e0e0e0;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 3px;
            padding: 2px 4px;
            font-size: 10px;
            text-align: right;
        }
        .dcarto-profile-unit {
            font-size: 9px;
            color: #666;
        }
        .dcarto-no-profiles {
            font-size: 11px;
            color: #555;
            text-align: center;
            padding: 12px;
        }
        .dcarto-gen-btn {
            margin: 8px 10px;
            font-size: 12px;
            font-weight: 600;
            padding: 8px 12px;
            background: #2ecc71;
            color: #fff;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: filter 0.15s, background 0.15s;
        }
        .dcarto-gen-btn:hover { background: #27ae60; filter: brightness(1.1); }

        /* Canvas zone (droite) */
        .dcarto-canvas-area {
            flex: 1;
            display: flex;
            flex-direction: row;
            overflow: hidden;
            position: relative;
        }
        .dcarto-canvas-wrapper {
            flex: 1;
            position: relative;
            background: #111;
            overflow: hidden;
        }
        #dcartoCanvas, .dcarto-overlay {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
        }
        .dcarto-overlay {
            pointer-events: all;
            z-index: 3;
        }
        .dcarto-no-data {
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: #555;
            font-size: 14px;
        }
        .dcarto-no-data p { margin: 0; }

        /* Légende */
        .dcarto-legend {
            width: 50px;
            flex-shrink: 0;
            display: flex;
            flex-direction: row;
            align-items: stretch;
            padding: 10px 4px;
            gap: 4px;
        }
        .dcarto-legend-bar {
            width: 18px;
            border-radius: 3px;
            border: 1px solid rgba(255,255,255,0.1);
        }
        .dcarto-legend-labels {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            font-size: 9px;
            color: #aaa;
        }

        /* Barre info en bas */
        .dcarto-bottom-bar {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 4px 10px;
            background: #16213e;
            border-top: 1px solid #0f3460;
            flex-shrink: 0;
            font-size: 11px;
            color: #aaa;
            flex-wrap: wrap;
        }
        .dcarto-coord-display {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .dcarto-coord-label {
            font-size: 10px;
            font-weight: 700;
            color: #2ecc71;
        }
        .dcarto-coord-value {
            font-size: 12px;
            font-weight: 600;
            color: #e0e0e0;
            font-family: 'Consolas', 'Monaco', monospace;
            min-width: 35px;
            text-align: right;
        }
        .dcarto-coord-unit {
            font-size: 9px;
            color: #667;
        }
        .dcarto-coord-sep {
            color: #333;
            margin: 0 2px;
        }
        .dcarto-stats {
            flex: 1;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }
        .dcarto-stat-row {
            display: inline-flex;
            gap: 4px;
            font-size: 10px;
            color: #999;
        }
        .dcarto-stat-row strong {
            color: #e0e0e0;
        }

        /* Responsive Cartographie */
        @media (max-width: 900px) {
            .dcarto-config-area {
                width: 180px;
            }
            .dcarto-bottom-bar {
                flex-wrap: wrap;
            }
        }

        /* ============== LANGUAGE DROPDOWN ============== */
        .lang-dropdown-container {
            position: relative;
            display: inline-block;
        }
        .lang-dropdown {
            display: none;
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 4px;
            background: var(--bg-dark, #1a1a2e);
            border: 1px solid var(--border, #333);
            border-radius: 8px;
            padding: 4px;
            z-index: 1000;
            min-width: 140px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
        }
        .lang-dropdown.visible {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .lang-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            border: none;
            background: transparent;
            color: var(--text, #e0e0e0);
            cursor: pointer;
            border-radius: 6px;
            font-size: 13px;
            white-space: nowrap;
            transition: background 0.15s;
        }
        .lang-dropdown-item:hover {
            background: var(--bg-hover, #2a2a4a);
        }
        .lang-dropdown-item.active {
            background: var(--primary, #4a6cf7);
            color: #fff;
        }
        .lang-dropdown-item svg {
            flex-shrink: 0;
        }

        /* ============== RESELLER PANEL ============== */
        .reseller-panel-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.7);
            z-index: 2000;
            justify-content: center;
            align-items: center;
        }
        .reseller-panel-overlay.visible {
            display: flex;
        }
        .reseller-panel {
            background: var(--bg-secondary, #16213e);
            border: 1px solid var(--border, #333);
            border-radius: 12px;
            width: 90vw;
            max-width: 1000px;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .reseller-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border, #333);
        }
        .reseller-panel-header h2 {
            margin: 0;
            font-size: 18px;
            color: var(--text, #e0e0e0);
        }
        .reseller-panel-close {
            background: none;
            border: none;
            color: var(--text-muted, #888);
            font-size: 24px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 6px;
        }
        .reseller-panel-close:hover {
            background: var(--bg-hover, #2a2a4a);
            color: var(--text, #e0e0e0);
        }
        .reseller-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 12px;
            padding: 16px 20px;
        }
        .reseller-stat-card {
            background: var(--bg-dark, #1a1a2e);
            border-radius: 8px;
            padding: 14px;
            text-align: center;
        }
        .reseller-stat-card .stat-value {
            font-size: 24px;
            font-weight: 700;
            color: var(--primary, #4a6cf7);
        }
        .reseller-stat-card .stat-label {
            font-size: 11px;
            color: var(--text-muted, #888);
            margin-top: 4px;
        }
        .reseller-clients-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }
        .reseller-clients-table th {
            background: var(--bg-dark, #1a1a2e);
            padding: 8px 10px;
            text-align: left;
            color: var(--text-muted, #888);
            font-weight: 500;
            font-size: 11px;
            text-transform: uppercase;
            border-bottom: 1px solid var(--border, #333);
            position: sticky;
            top: 0;
            z-index: 1;
        }
        .reseller-clients-table td {
            padding: 8px 10px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            color: var(--text, #e0e0e0);
        }
        .reseller-clients-table tr:hover td {
            background: var(--bg-hover, #2a2a4a);
        }
        .reseller-panel-body {
            overflow-y: auto;
            flex: 1;
            padding: 0 20px 16px;
        }
        .reseller-commission-box {
            background: var(--bg-dark, #1a1a2e);
            border-radius: 8px;
            padding: 16px;
            margin: 12px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .reseller-commission-box .commission-rate {
            font-size: 28px;
            font-weight: 700;
            color: #27ae60;
        }
        .reseller-commission-box .commission-label {
            font-size: 12px;
            color: var(--text-muted, #888);
        }

        /* Reseller detail modal (admin view) - must be above admin panel (z-index 30000) */
        .reseller-detail-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.6);
            z-index: 31000;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* Reseller button in toolbar */
        #resellerBtn {
            background: linear-gradient(135deg, #b8860b, #daa520) !important;
            border: 1px solid #daa520 !important;
            color: #fff !important;
        }
        #resellerBtn:hover {
            background: linear-gradient(135deg, #daa520, #ffd700) !important;
            filter: brightness(1.1);
        }
        #resellerBtn .icon {
            font-size: 18px;
        }
        #resellerBtn .label {
            color: #fff !important;
            font-weight: 600;
        }

        /* ============== ADMIN RESELLERS TAB ============== */
        .admin-reseller-form {
            background: var(--bg-dark, #1a1a2e);
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 16px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: flex-end;
        }
        .admin-reseller-form .form-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .admin-reseller-form label {
            font-size: 11px;
            color: var(--text-muted, #888);
            text-transform: uppercase;
        }
        .admin-reseller-form input,
        .admin-reseller-form select {
            background: var(--bg-secondary, #16213e);
            border: 1px solid var(--border, #333);
            color: var(--text, #e0e0e0);
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 13px;
        }
        .admin-reseller-form select {
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 8px center;
            padding-right: 28px;
            cursor: pointer;
        }
        .admin-reseller-form select option {
            background: var(--bg-secondary, #16213e);
            color: var(--text, #e0e0e0);
        }
        .admin-reseller-form button {
            padding: 6px 14px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
        }
        .admin-reseller-form .btn-save {
            background: var(--primary, #4a6cf7);
            color: #fff;
        }
        .admin-reseller-form .btn-save:hover {
            filter: brightness(1.1);
        }
        .admin-reseller-form .btn-delete {
            background: #e74c3c;
            color: #fff;
        }
        .admin-reseller-total {
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            border: 1px solid var(--border, #333);
            border-radius: 8px;
            padding: 16px;
            margin-top: 16px;
            text-align: center;
        }
        .admin-reseller-total .total-value {
            font-size: 20px;
            font-weight: 700;
            color: #27ae60;
        }
        .plan-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 600;
        }
        .plan-badge.pro {
            background: rgba(74, 108, 247, 0.2);
            color: #4a6cf7;
        }
        .plan-badge.free {
            background: rgba(136, 136, 136, 0.2);
            color: #888;
        }
        .status-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 600;
        }
        .status-badge.active {
            background: rgba(39, 174, 96, 0.2);
            color: #27ae60;
        }
        .status-badge.inactive {
            background: rgba(136, 136, 136, 0.2);
            color: #888;
        }
