        /* Tema Dr. Iunes Feiz Limissuri */
        :root {
            --primary: #60a5fa;
            --primary-dark: #2563eb;
            --accent: #facc15;
            --bg-viewer: #0f172a;
            --bg-side: #020617;
            --bg-toolbar: rgba(2, 6, 23, 0.95);
            --border-viewer: #1e293b;
            --text-viewer: #f8fafc;
            --text-muted: #64748b;
            --viewport-bg: #000000;
            --glass-bg: rgba(15, 23, 42, 0.7);
            --glass-border: rgba(255, 255, 255, 0.1);

        html, body {
            overscroll-behavior: none;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Proteção Universal de Seleção e Foco para Campos de Entrada */
        input, textarea, select, [contenteditable="true"], .rm-input, .zf-input {
            -webkit-user-select: text !important;
            user-select: text !important;
        }

        /* Utility Colors from Global System */
            --success: #059669;
            --warning: #d97706;
            --danger: #dc2626;
            --gray: #6b7280;
            --light-gray: #cbd5e1;
        }

        body.dark-mode-viewer {
            --bg-viewer: #1e293b;
            --bg-side: #0f172a;
            --bg-toolbar: rgba(30, 41, 59, 0.95);
            --border-viewer: #334155;
            --text-viewer: #f1f5f9;
            --text-muted: #94a3b8;
        }

        /* Tema Docteur Alain Rahmouni */
        body.theme-olive {
            --primary: #6ea389; /* Brightened Sage/Pine */
            --primary-dark: #475f56;
            --bg-viewer: #090e0b;
            --bg-side: #050806;
            --bg-toolbar: rgba(5, 8, 6, 0.95);
            --border-viewer: #141c17;
            --text-viewer: #ecfdf5;
            --text-muted: #849b8f;
        }

        /* Tema Docteur Andre Gaston - Blended Gray for Elegance */
        body.theme-gray {
            --primary: #6b7280; /* Cool gray 500 */
            --primary-dark: #4b5563; /* Cool gray 600 */
            --bg-viewer: #0c0d10; /* Very dark grayish blue */
            --bg-side: #060709; /* Deepest background */
            --bg-toolbar: rgba(6, 7, 9, 0.96);
            --border-viewer: #1f2228; /* Subtle dark border */
            --text-viewer: #f3f4f6; /* Off-white */
            --text-muted: #9ca3af; /* Muted gray */
            --accent: #d1d5db; /* Light gray accent */
        }

        /* Purple Theme - Desaturated & Discrete Navy-Purple */
        body.theme-purple {
            --primary: #9d8ec2; /* Brightened Navy Plum */
            --primary-dark: #524763;
            --bg-viewer: #0e0d12;
            --bg-side: #08070a;
            --bg-toolbar: rgba(8, 7, 10, 0.95);
            --border-viewer: #16141c;
            --text-viewer: #f5f3ff;
            --text-muted: #807a8f;
        }

        /* Light Theme - Deeply Dimmed for maximum comfort */
        body.theme-light {
            --primary: #0284c7;
            --primary-dark: #0369a1;
            --bg-viewer: #cbd5e1; /* Cinza Base (Slate 300) */
            --bg-side: #94a3b8; /* Cinza Escurecido Lateral (Slate 400) */
            --bg-toolbar: rgba(148, 163, 184, 0.96);
            --border-viewer: #64748b;
            --text-viewer: #0f172a;
            --text-muted: #334155;
            --viewport-bg: #64748b; /* Fundo do exame bem escuro (Slate 500) */
            --glass-bg: rgba(148, 163, 184, 0.85);
            --glass-border: rgba(0, 0, 0, 0.15);
        }

        /* Tema Dr. José Antonio Bastos de Carvalho */
        body.theme-gold {
            --primary: #c5a059;
            --primary-dark: #967d4a;
            --bg-viewer: #1c1917;
            --bg-side: #292524;
            --bg-toolbar: rgba(41, 37, 36, 0.95);
            --border-viewer: #44403c;
            --text-viewer: #fdfaf6;
            --text-muted: #d6d3d1;
            --viewport-bg: #1c1917;
            --glass-bg: rgba(41, 37, 36, 0.7);
            --glass-border: rgba(255, 255, 255, 0.05);
        }

        /* Rock Vein Theme - Elegant Stone */
        body.theme-rock-vein {
            --primary: #8b5a51; /* Muted terracotta/stone */
            --primary-dark: #663f38;
            --bg-viewer: #141312; /* Very dark warm gray */
            --bg-side: #0e0d0c; /* Deeper warm black */
            --bg-toolbar: rgba(14, 13, 12, 0.96);
            --border-viewer: #282523; /* Subtle warm border */
            --text-viewer: #eae6e1; /* Soft warm white */
            --text-muted: #8b8580; /* Muted stone gray */
            --accent: #b38a58; /* Muted gold/copper */
            --viewport-bg: #000000;
            --glass-bg: rgba(14, 13, 12, 0.85);
            --glass-border: rgba(139, 90, 81, 0.2);
            --success: #a38c59; /* Elegant muted gold */
        }

        /* Dr. Enéas Carneiro Theme - Elegant Vintage Olive & Gold */
        body.theme-eneas {
            --primary: #4d7c0f; /* Refined Olive Green */
            --primary-dark: #365314; /* Deep Forest/Olive */
            --bg-viewer: #181a18; /* Very dark olive-tinted charcoal */
            --bg-side: #0e0f0e; /* Deepest vintage charcoal */
            --bg-toolbar: rgba(24, 26, 24, 0.96);
            --border-viewer: #2c332c; /* Soft olive-gray border */
            --text-viewer: #fef0c7; /* Warm vintage cream */
            --text-muted: #8c9b88; /* Muted greenish-gray, much more harmonious */
            --accent: #d97706; /* Distinguished amber/gold for active states */
            --viewport-bg: #000000;
            --glass-bg: rgba(24, 26, 24, 0.85);
            --glass-border: rgba(77, 124, 15, 0.25);
        }

        /* Deep OLED Absolute - Pure Focus (Perfect Black) */
        body.theme-oled {
            --primary: #64748b; /* Elegant slate gray */
            --primary-dark: #475569;
            --bg-viewer: #000000;
            --bg-side: #000000;
            --bg-toolbar: rgba(0, 0, 0, 0.98);
            --border-viewer: #1c1f24; /* Very subtle cool border */
            --text-viewer: #f8fafc;
            --text-muted: #64748b;
            --viewport-bg: #000000;
            --glass-bg: rgba(0, 0, 0, 0.85);
            --glass-border: rgba(100, 116, 139, 0.2);
            --accent: #94a3b8; /* Soft silver for accent */
        }

        /* Arctic Surgery - Glass Tech (Elegant Frost & Steel) */
        body.theme-arctic {
            --primary: #87b0c7; /* Elegant, muted frosty blue */
            --primary-dark: #56819a; /* Deeper steel blue */
            --bg-viewer: #161c22; /* Very dark, cool charcoal */
            --bg-side: #0e1216; /* Deepest icy black */
            --bg-toolbar: rgba(14, 18, 22, 0.96);
            --border-viewer: #2c3641; /* Subtle cool border */
            --text-viewer: #e2e8f0; /* Soft frosty white */
            --text-muted: #7f91a3; /* Elegant muted steel */
            --viewport-bg: #000000;
            --glass-bg: rgba(14, 18, 22, 0.85);
            --glass-border: rgba(135, 176, 199, 0.15);
            --accent: #a0c4d8; /* Soft icy highlight */
        }
/* Premium Custom Scrollbars */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.15);
            border-radius: 4px;
            border: 1px solid rgba(0,0,0,0.2);
        }

        ::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        body,
        html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-viewer);
            overflow: hidden;
            font-family: 'Inter', sans-serif;
            color: var(--text-viewer);
            transition: background 0.3s ease, color 0.3s ease;
        }

        /* Viewer Specific Styles - Professional Grade */
        .zf-viewer-container {
            display: flex;
            flex-direction: column;
            width: 100%;
            height: 100%;
            -webkit-user-select: none;
            user-select: none;
            background: var(--bg-viewer);
            box-sizing: border-box;
            overflow: hidden;
        }

                .zf-viewer-header, .zf-thumbnail-bar, .zf-sidebar-right, .zf-resizer, .zf-top-toolbar { transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

        .zf-viewer-header {
            height: 60px;
            min-height: 60px;
            max-height: 60px;
            flex-shrink: 0;
            flex-grow: 0;
            background: var(--bg-side);
            border-bottom: 1px solid var(--border-viewer);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 10000;
            position: relative;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: visible;
            box-sizing: border-box;
            flex-wrap: nowrap;
        }

        .zf-viewer-header.fullscreen-active {
            height: 60px;
            min-height: 60px;
            max-height: 60px;
            padding: 0 24px;
            background: var(--bg-viewer);
            border-bottom: 2px solid var(--primary);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
            box-sizing: border-box;
        }

        .zf-viewer-header.fullscreen-active .zf-btn-action,
        .zf-viewer-header.fullscreen-active .zf-btn-close {
            padding: 6px 14px;
            font-size: 11px;
        }

        .zf-viewer-header.fullscreen-active .zf-btn-close {
            width: 34px;
            height: 34px;
        }

        /* Header Buttons Premium */
        .zf-header-actions {
            display: flex;
            gap: 13px;
            align-items: center;
            flex-shrink: 0;
        }

        .zf-btn-action {
            background: rgba(255, 255, 255, 0.02);
            border: 0.5px solid rgba(255, 255, 255, 0.1);
            color: var(--text-viewer);
            padding: 10px 28px;
            border-radius: 30px;
            font-size: 13px;
            font-weight: 300;
            letter-spacing: 1px;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            white-space: nowrap;
            position: relative;
        }

        /* Micro-LED Verde Neon de Status (ON / Funcionando) */
        .zf-btn-action.zf-micro-led-active::after {
            content: '';
            position: absolute;
            top: 4px;
            right: 4px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background-color: #10b981;
            box-shadow: 0 0 7px rgba(16, 185, 129, 0.95);
            animation: zfMicroLedPulse 2.2s infinite ease-in-out;
            pointer-events: none;
            z-index: 10;
        }

        @keyframes zfMicroLedPulse {
            0%, 100% {
                transform: scale(1);
                opacity: 0.90;
                box-shadow: 0 0 6px rgba(16, 185, 129, 0.90);
            }
            50% {
                transform: scale(1.22);
                opacity: 1;
                box-shadow: 0 0 10px rgba(16, 185, 129, 1);
            }
        }

        .zf-btn-action:hover {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        }

        /* Botões do Cabeçalho Padrão (Tema Default - Dr. Iunes Feiz Limissuri) */
        .zf-btn-action.zf-btn-header-ingest,
        .zf-btn-action.zf-btn-header-close {
            background: rgba(96, 165, 250, 0.06);
            border: 1px solid rgba(96, 165, 250, 0.20);
            color: var(--text-viewer);
            padding: 8px 18px;
            border-radius: 22px;
            min-width: 48px;
            height: 35px;
            box-sizing: border-box;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
            transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .zf-btn-action.zf-btn-header-ingest i,
        .zf-btn-action.zf-btn-header-close i {
            font-size: 17.5px;
            line-height: 1;
            color: var(--text-viewer);
            opacity: 0.88;
            transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
        }

        .zf-btn-action.zf-btn-header-ingest:hover {
            background: var(--primary, #2563eb);
            border-color: var(--primary, #60a5fa);
            color: #ffffff;
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
        }

        .zf-btn-action.zf-btn-header-ingest:hover i {
            color: #ffffff;
            opacity: 1;
            transform: scale(1.1);
        }

        .zf-btn-action.zf-btn-header-ingest:active {
            transform: translateY(0);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* Botão Novo Estudo / Limpar (Vermelho com toque elegante) */
        .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #f87171;
            padding: 8px 18px;
            border-radius: 22px;
            min-width: 48px;
            height: 35px;
            box-sizing: border-box;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            box-shadow: 0 2px 6px rgba(239, 68, 68, 0.1);
            transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .zf-btn-action.zf-btn-header-danger i {
            font-size: 17.5px;
            line-height: 1;
            color: #f87171;
            transition: transform 0.2s ease, color 0.2s ease;
        }

        .zf-btn-action.zf-btn-header-danger:hover {
            background: rgba(239, 68, 68, 0.35);
            border-color: rgba(239, 68, 68, 0.75);
            color: #ffffff;
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
        }

        .zf-btn-action.zf-btn-header-danger:hover i {
            color: #ffffff;
            transform: scale(1.1);
        }

        .zf-btn-action.zf-btn-header-danger:active {
            transform: translateY(0);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* Botão Reset de Emergência (Âmbar / Dourado com toque elegante) */
        .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.14);
            border: 1px solid rgba(245, 158, 11, 0.38);
            color: #fbbf24;
            padding: 8px 18px;
            border-radius: 22px;
            min-width: 48px;
            height: 35px;
            box-sizing: border-box;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            box-shadow: 0 2px 6px rgba(245, 158, 11, 0.1);
            transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .zf-btn-action.zf-btn-header-warning i {
            font-size: 17.5px;
            line-height: 1;
            color: #fbbf24;
            transition: transform 0.2s ease, color 0.2s ease;
        }

        .zf-btn-action.zf-btn-header-warning:hover {
            background: rgba(245, 158, 11, 0.35);
            border-color: rgba(245, 158, 11, 0.75);
            color: #ffffff;
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
        }

        .zf-btn-action.zf-btn-header-warning:hover i {
            color: #ffffff;
            transform: scale(1.1);
        }

        .zf-btn-action.zf-btn-header-warning:active {
            transform: translateY(0);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* Botão Fechar Viewer (Pílula com hover vermelho/rose) */
        .zf-btn-action.zf-btn-header-close:hover {
            background: rgba(244, 63, 94, 0.25);
            border-color: rgba(244, 63, 94, 0.6);
            color: #f43f5e;
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
        }

        .zf-btn-action.zf-btn-header-close:hover i {
            color: #f43f5e;
            opacity: 1;
            transform: scale(1.1);
        }

        .zf-btn-action.zf-btn-header-close:active {
            transform: translateY(0);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* ---------------------------------------------------------
           1. Tema Dr. Alain Rahmouni (theme-olive)
           --------------------------------------------------------- */
        body.theme-olive .zf-btn-action.zf-btn-header-ingest,
        body.theme-olive .zf-btn-action.zf-btn-header-close {
            background: rgba(110, 163, 137, 0.09);
            border: 1px solid rgba(110, 163, 137, 0.24);
            color: #ecfdf5;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-olive .zf-btn-action.zf-btn-header-ingest i,
        body.theme-olive .zf-btn-action.zf-btn-header-close i {
            color: #a7f3d0;
        }
        body.theme-olive .zf-btn-action.zf-btn-header-ingest:hover {
            background: #475f56;
            border-color: #6ea389;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(110, 163, 137, 0.32);
        }
        body.theme-olive .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.11);
            border: 1px solid rgba(239, 68, 68, 0.32);
            color: #fca5a5;
        }
        body.theme-olive .zf-btn-action.zf-btn-header-warning {
            background: rgba(217, 119, 6, 0.14);
            border: 1px solid rgba(217, 119, 6, 0.38);
            color: #fde68a;
        }

        /* ---------------------------------------------------------
           2. Tema Dr. André Gaston (theme-gray)
           --------------------------------------------------------- */
        body.theme-gray .zf-btn-action.zf-btn-header-ingest,
        body.theme-gray .zf-btn-action.zf-btn-header-close {
            background: rgba(156, 163, 175, 0.07);
            border: 1px solid rgba(156, 163, 175, 0.20);
            color: #f3f4f6;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-gray .zf-btn-action.zf-btn-header-ingest i,
        body.theme-gray .zf-btn-action.zf-btn-header-close i {
            color: #e5e7eb;
        }
        body.theme-gray .zf-btn-action.zf-btn-header-ingest:hover {
            background: #4b5563;
            border-color: #9ca3af;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(107, 114, 128, 0.35);
        }
        body.theme-gray .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.10);
            border: 1px solid rgba(239, 68, 68, 0.30);
            color: #f87171;
        }
        body.theme-gray .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.12);
            border: 1px solid rgba(245, 158, 11, 0.32);
            color: #fbbf24;
        }

        /* ---------------------------------------------------------
           3. Tema Navy Purple (theme-purple)
           --------------------------------------------------------- */
        body.theme-purple .zf-btn-action.zf-btn-header-ingest,
        body.theme-purple .zf-btn-action.zf-btn-header-close {
            background: rgba(157, 142, 194, 0.10);
            border: 1px solid rgba(157, 142, 194, 0.25);
            color: #f5f3ff;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-purple .zf-btn-action.zf-btn-header-ingest i,
        body.theme-purple .zf-btn-action.zf-btn-header-close i {
            color: #ddd6fe;
        }
        body.theme-purple .zf-btn-action.zf-btn-header-ingest:hover {
            background: #524763;
            border-color: #9d8ec2;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(157, 142, 194, 0.35);
        }
        body.theme-purple .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.11);
            border: 1px solid rgba(239, 68, 68, 0.32);
            color: #fca5a5;
        }
        body.theme-purple .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.13);
            border: 1px solid rgba(245, 158, 11, 0.34);
            color: #fde047;
        }

        /* ---------------------------------------------------------
           4. Tema Dr. José Antônio Bastos de Carvalho (theme-gold)
           --------------------------------------------------------- */
        body.theme-gold .zf-btn-action.zf-btn-header-ingest,
        body.theme-gold .zf-btn-action.zf-btn-header-close {
            background: rgba(197, 160, 89, 0.10);
            border: 1px solid rgba(197, 160, 89, 0.26);
            color: #fdfaf6;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-gold .zf-btn-action.zf-btn-header-ingest i,
        body.theme-gold .zf-btn-action.zf-btn-header-close i {
            color: #fef3c7;
        }
        body.theme-gold .zf-btn-action.zf-btn-header-ingest:hover {
            background: #967d4a;
            border-color: #c5a059;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(197, 160, 89, 0.38);
        }
        body.theme-gold .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #fca5a5;
        }
        body.theme-gold .zf-btn-action.zf-btn-header-warning {
            background: rgba(197, 160, 89, 0.18);
            border: 1px solid rgba(197, 160, 89, 0.45);
            color: #fde68a;
        }

        /* ---------------------------------------------------------
           5. Tema Rock Vein (theme-rock-vein)
           --------------------------------------------------------- */
        body.theme-rock-vein .zf-btn-action.zf-btn-header-ingest,
        body.theme-rock-vein .zf-btn-action.zf-btn-header-close {
            background: rgba(139, 90, 81, 0.11);
            border: 1px solid rgba(139, 90, 81, 0.28);
            color: #eae6e1;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-rock-vein .zf-btn-action.zf-btn-header-ingest i,
        body.theme-rock-vein .zf-btn-action.zf-btn-header-close i {
            color: #f5ece7;
        }
        body.theme-rock-vein .zf-btn-action.zf-btn-header-ingest:hover {
            background: #663f38;
            border-color: #8b5a51;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(139, 90, 81, 0.35);
        }
        body.theme-rock-vein .zf-btn-action.zf-btn-header-danger {
            background: rgba(220, 38, 38, 0.12);
            border: 1px solid rgba(220, 38, 38, 0.35);
            color: #fca5a5;
        }
        body.theme-rock-vein .zf-btn-action.zf-btn-header-warning {
            background: rgba(179, 138, 88, 0.16);
            border: 1px solid rgba(179, 138, 88, 0.40);
            color: #fed7aa;
        }

        /* ---------------------------------------------------------
           6. Tema Dr. Enéas Carneiro (theme-eneas)
           --------------------------------------------------------- */
        body.theme-eneas .zf-btn-action.zf-btn-header-ingest,
        body.theme-eneas .zf-btn-action.zf-btn-header-close {
            background: rgba(77, 124, 15, 0.12);
            border: 1px solid rgba(77, 124, 15, 0.30);
            color: #fef0c7;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-eneas .zf-btn-action.zf-btn-header-ingest i,
        body.theme-eneas .zf-btn-action.zf-btn-header-close i {
            color: #ecfccb;
        }
        body.theme-eneas .zf-btn-action.zf-btn-header-ingest:hover {
            background: #365314;
            border-color: #65a30d;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(77, 124, 15, 0.35);
        }
        body.theme-eneas .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #fca5a5;
        }
        body.theme-eneas .zf-btn-action.zf-btn-header-warning {
            background: rgba(217, 119, 6, 0.18);
            border: 1px solid rgba(217, 119, 6, 0.45);
            color: #fde047;
        }

        /* ---------------------------------------------------------
           7. Tema Deep OLED Absolute (theme-oled)
           --------------------------------------------------------- */
        body.theme-oled .zf-btn-action.zf-btn-header-ingest,
        body.theme-oled .zf-btn-action.zf-btn-header-close {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(100, 116, 139, 0.25);
            color: #f8fafc;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        }
        body.theme-oled .zf-btn-action.zf-btn-header-ingest i,
        body.theme-oled .zf-btn-action.zf-btn-header-close i {
            color: #f1f5f9;
        }
        body.theme-oled .zf-btn-action.zf-btn-header-ingest:hover {
            background: #334155;
            border-color: #64748b;
            color: #ffffff;
            box-shadow: 0 0 14px rgba(100, 116, 139, 0.45);
        }
        body.theme-oled .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.08);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #f87171;
        }
        body.theme-oled .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.10);
            border: 1px solid rgba(245, 158, 11, 0.35);
            color: #fbbf24;
        }

        /* ---------------------------------------------------------
           8. Tema Arctic Surgery (theme-arctic)
           --------------------------------------------------------- */
        body.theme-arctic .zf-btn-action.zf-btn-header-ingest,
        body.theme-arctic .zf-btn-action.zf-btn-header-close {
            background: rgba(135, 176, 199, 0.10);
            border: 1px solid rgba(135, 176, 199, 0.26);
            color: #e2e8f0;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        body.theme-arctic .zf-btn-action.zf-btn-header-ingest i,
        body.theme-arctic .zf-btn-action.zf-btn-header-close i {
            color: #e0f2fe;
        }
        body.theme-arctic .zf-btn-action.zf-btn-header-ingest:hover {
            background: #56819a;
            border-color: #87b0c7;
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(135, 176, 199, 0.35);
        }
        body.theme-arctic .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.35);
            color: #fca5a5;
        }
        body.theme-arctic .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.14);
            border: 1px solid rgba(245, 158, 11, 0.38);
            color: #fef08a;
        }

        /* ---------------------------------------------------------
           9. Ajustes de Alto Contraste para Tema Claro (theme-light)
           --------------------------------------------------------- */
        body.theme-light .zf-btn-action.zf-btn-header-ingest,
        body.theme-light .zf-btn-action.zf-btn-header-close {
            background: rgba(255, 255, 255, 0.68) !important;
            border: 1px solid rgba(15, 23, 42, 0.28) !important;
            color: #0f172a !important;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-ingest i,
        body.theme-light .zf-btn-action.zf-btn-header-close i {
            color: #0f172a !important;
            opacity: 1 !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-ingest:hover {
            background: #0284c7 !important;
            border-color: #0284c7 !important;
            color: #ffffff !important;
            box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-ingest:hover i {
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-danger {
            background: rgba(239, 68, 68, 0.18) !important;
            border: 1.5px solid #dc2626 !important;
            color: #991b1b !important;
            box-shadow: 0 2px 5px rgba(220, 38, 38, 0.15) !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-danger i {
            color: #dc2626 !important;
            opacity: 1 !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-danger:hover {
            background: #dc2626 !important;
            border-color: #dc2626 !important;
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-danger:hover i {
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-warning {
            background: rgba(245, 158, 11, 0.2) !important;
            border: 1.5px solid #d97706 !important;
            color: #92400e !important;
            box-shadow: 0 2px 5px rgba(217, 119, 6, 0.15) !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-warning i {
            color: #d97706 !important;
            opacity: 1 !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-warning:hover {
            background: #d97706 !important;
            border-color: #d97706 !important;
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-warning:hover i {
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-close:hover {
            background: #e11d48 !important;
            border-color: #e11d48 !important;
            color: #ffffff !important;
        }

        body.theme-light .zf-btn-action.zf-btn-header-close:hover i {
            color: #ffffff !important;
        }


        .zf-btn-close {
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--bg-viewer);
            border: 1px solid var(--border-viewer);
            color: var(--text-muted);
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .zf-btn-close:hover {
            background: #f43f5e;
            border-color: #f43f5e;
            color: #fff;
            transform: rotate(90deg);
        }

        .zf-viewer-body {
            flex: 1;
            display: flex;
            overflow: clip; /* Prevent programmatic scroll completely */
            position: relative;
            box-sizing: border-box;
            min-height: 0; /* Prevents flex blowout */
        }

        /* Resizer Handles */
        .zf-resizer {
            width: 4px;
            background: transparent;
            cursor: col-resize;
            z-index: 100;
            transition: background 0.2s, width 0.2s;
            flex-shrink: 0;
            position: relative;
        }

        .zf-resizer:hover, .zf-resizer.active {
            background: var(--primary);
            width: 4px;
            box-shadow: 0 0 10px var(--primary);
        }

        .zf-resizer::after {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            left: -4px;
            right: -4px;
        }


        /* Fast Search (Thumbnails & Tools) */
        .zf-thumb-search-container,
        .zf-tool-search-container {
            position: sticky;
            top: 0;
            z-index: 20;
            background: var(--bg-side);
            padding: 10px;
            border-bottom: 1px solid var(--border-viewer);
            transition: all 0.3s;
        }

        .zf-thumbnail-bar.dock-top .zf-thumb-search-container,
        .zf-thumbnail-bar.dock-bottom .zf-thumb-search-container,
        .zf-sidebar-right.dock-top .zf-tool-search-container,
        .zf-sidebar-right.dock-bottom .zf-tool-search-container {
            border-bottom: none;
            border-right: 1px solid var(--border-viewer);
            min-width: 150px;
        }

        .zf-thumb-search-input-wrapper,
        .zf-tool-search-input-wrapper {
            position: relative;
            width: 100%;
        }

        .zf-thumb-search-input-wrapper i,
        .zf-tool-search-input-wrapper i {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            font-size: 11px;
            transition: color 0.3s;
        }

        .zf-thumb-search-input-wrapper input,
        .zf-tool-search-input-wrapper input {
            width: 100%;
            border-radius: 6px;
            border: 1px solid var(--border-viewer);
            background: rgba(0, 0, 0, 0.3);
            color: var(--text-viewer);
            padding: 7px 10px 7px 30px;
            font-size: 11.5px;
            outline: none;
            box-sizing: border-box;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .zf-thumb-search-input-wrapper input:focus,
        .zf-tool-search-input-wrapper input:focus {
            border-color: var(--primary);
            background: rgba(0, 0, 0, 0.5);
            box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
        }
        
        .zf-thumb-search-input-wrapper input:focus + i,
        .zf-tool-search-input-wrapper input:focus + i {
            color: var(--primary);
        }

        @keyframes zfFadeInScale {
            from {
                opacity: 0;
                transform: translateY(-4px) scale(0.98);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Modality Counters Panel */
        .zf-modality-summary-panel {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
            padding: 4px;
            margin: 2px 8px 6px 8px;
            background: rgba(15, 23, 42, 0.25);
            border: 1px solid rgba(255, 255, 255, 0.04);
            border-radius: 6px;
            justify-items: center;
            align-items: center;
            animation: zfFadeInScale 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .zf-modality-chip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            font-size: 8px;
            font-weight: 700;
            font-family: 'Inter', sans-serif;
            color: rgba(226, 232, 240, 0.85);
            cursor: pointer;
            padding: 2px;
            border-radius: 4px;
            border: 1px solid transparent;
            transition: all 0.2s ease;
            width: 100%;
            box-sizing: border-box;
        }

        .zf-modality-chip:hover {
            background: rgba(255, 255, 255, 0.05);
            color: #ffffff;
        }

        .zf-modality-chip.active {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--mod-color);
            color: #ffffff;
        }

        .zf-modality-dot {
            width: 4px;
            height: 4px;
            background-color: var(--mod-color);
            border-radius: 50%;
            box-shadow: 0 0 4px var(--mod-color);
        }

        .zf-modality-name {
            opacity: 0.7;
        }

        .zf-modality-count {
            color: var(--mod-color);
            font-size: 9px;
            font-weight: 800;
            font-variant-numeric: tabular-nums;
        }




        /* Sidebar de Miniaturas (Estilo Profissional) */
        .zf-thumbnail-bar {
            background: var(--bg-side);
            border-right: 1px solid var(--border-viewer);
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding: 10px 5px;
            overflow-y: auto;
            width: var(--zf-left-sidebar-width, 150px);
            height: 100%;
            min-width: 80px;
            max-width: 500px;
            flex-shrink: 0;
            scroll-behavior: smooth;
            overscroll-behavior-y: contain;
            will-change: scroll-position;
            transition: width 0.2s ease, height 0.2s ease;
            position: relative;
            z-index: 10;
        }

        /* DOCKING: Miniaturas no Topo ou Fundo */
        .zf-thumbnail-bar.dock-top, .zf-thumbnail-bar.dock-bottom {
            flex-direction: row !important;
            width: 100% !important;
            height: var(--zf-left-sidebar-height, 180px) !important;
            min-width: unset;
            max-width: unset;
            min-height: 100px;
            max-height: 500px;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            border-right: none;
            padding: 5px 10px;
        }
        .zf-thumbnail-bar.dock-top { border-bottom: 1px solid var(--border-viewer); }
        .zf-thumbnail-bar.dock-bottom { border-top: 1px solid var(--border-viewer); }

        /* Ajuste do Handle quando no Topo/Fundo */
        .zf-thumbnail-bar.dock-top #zfThumbnailsDragHandle,
        .zf-thumbnail-bar.dock-bottom #zfThumbnailsDragHandle {
            width: 30px;
            height: 100%;
            margin-bottom: 0;
            margin-right: 10px;
            flex-direction: column;
        }

        /* Ajuste dos itens de estudo quando em row */
        .zf-thumbnail-bar.dock-top .zf-study-group,
        .zf-thumbnail-bar.dock-bottom .zf-study-group {
            display: flex;
            flex-direction: row;
            align-items: stretch;
            height: 100%;
            flex-shrink: 0;
        }

        .zf-thumbnail-bar.dock-top .zf-study-header,
        .zf-thumbnail-bar.dock-bottom .zf-study-header {
            min-width: 140px;
            max-width: 200px;
            height: calc(100% - 10px);
            margin: 0 5px;
            flex-shrink: 0;
        }

        .zf-thumbnail-bar.dock-top .zf-study-grid,
        .zf-thumbnail-bar.dock-bottom .zf-study-grid {
            display: flex !important;
            flex-direction: row !important;
            height: 100% !important;
            max-height: 100% !important;
            padding: 0 !important;
            opacity: 0;
            max-width: 0;
            gap: 8px;
            overflow: hidden;
            align-items: center;
            transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
        }

        .zf-thumbnail-bar.dock-top .zf-study-header.expanded + .zf-study-grid,
        .zf-thumbnail-bar.dock-bottom .zf-study-header.expanded + .zf-study-grid {
            opacity: 1;
            max-width: 5000px;
            padding-right: 10px !important;
        }

        .zf-thumbnail-bar.dock-top .zf-thumbnail-item,
        .zf-thumbnail-bar.dock-bottom .zf-thumbnail-item {
            height: calc(100% - 16px) !important;
            width: auto !important;
            aspect-ratio: 1 !important;
            margin: 0 !important;
            min-width: 100px;
        }

        .zf-thumbnail-bar.dock-left, .zf-thumbnail-bar.dock-right {
            flex-direction: column !important;
            width: var(--zf-left-sidebar-width, 150px) !important;
            height: 100% !important;
        }
        .zf-thumbnail-bar.dock-right { border-left: 1px solid var(--border-viewer); border-right: none; }

        .zf-thumbnail-bar::-webkit-scrollbar {
            width: 10px; /* Mais grossa para facilitar o clique */
        }
        .zf-thumbnail-bar::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05); /* Leve contraste no fundo */
            border-radius: 4px;
        }
        .zf-thumbnail-bar::-webkit-scrollbar-thumb {
            background: #6b7280; /* Cor diferenciada e sólida (cinza azulado bem visível) */
            border-radius: 4px;
            border: 2px solid transparent; /* Cria um pequeno espaço / border-box fake */
            background-clip: padding-box;
        }
        .zf-thumbnail-bar::-webkit-scrollbar-thumb:hover {
            background: var(--primary); /* Acende forte com a cor do tema ao passar o mouse */
        }

        .zf-study-header {
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid var(--border-viewer);
            border-radius: 8px;
            margin: 5px;
            background: rgba(255, 255, 255, 0.03);
            display: flex;
            flex-direction: column;
            gap: 4px;
            position: relative;
            overflow: hidden;
        }

        .zf-study-header:hover {
            background: rgba(255, 255, 255, 0.08) !important;
            border-color: var(--primary);
        }

        .zf-study-header.active {
            border-color: var(--primary);
            background: rgba(96, 165, 250, 0.1) !important;
            box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
        }

        .zf-study-patient-name {
            transition: color 0.3s;
        }

        /* Status de Cores para Pacientes */
        .status-evaluated { color: #f87171 !important; } /* Vermelho (Avaliados) */
        .status-unopened { color: #4ade80 !important; }  /* Verde (Não abertos) */
        .status-active { color: #facc15 !important; }    /* Amarelo (Ativo/Aberto) */
        .status-opened { color: #38bdf8 !important; }    /* Azul Vibrante (Já aberto mas não ativo) */

        /* Badge NOVO nos Cards de Estudo */
        .zf-new-study-badge {
            font-size: 8.5px;
            font-weight: 800;
            color: #022c22;
            background: linear-gradient(135deg, #4ade80, #22c55e);
            padding: 1px 5px;
            border-radius: 4px;
            letter-spacing: 0.4px;
            box-shadow: 0 1px 4px rgba(34, 197, 94, 0.4);
            display: inline-flex;
            align-items: center;
            vertical-align: middle;
            animation: zfBadgeGlow 2.5s infinite ease-in-out;
            margin-left: 5px;
            flex-shrink: 0;
        }

        @keyframes zfBadgeGlow {
            0%, 100% { transform: scale(1); opacity: 0.95; filter: drop-shadow(0 0 2px rgba(74, 222, 128, 0.4)); }
            50% { transform: scale(1.06); opacity: 1; filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.8)); }
        }

        .zf-study-header.new-arrival {
            animation: zfNewStudyArrivalPulse 1.8s 3 ease-in-out;
            border-color: rgba(74, 222, 128, 0.5) !important;
        }

        @keyframes zfNewStudyArrivalPulse {
            0%, 100% { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
            50% { box-shadow: 0 0 14px rgba(74, 222, 128, 0.45); }
        }

        .zf-study-header.zf-study-focus-pulse {
            animation: zfFocusPulse 2.5s ease-out !important;
            border-color: #60a5fa !important;
        }

        @keyframes zfFocusPulse {
            0% { box-shadow: 0 0 25px rgba(96, 165, 250, 0.9); transform: scale(1.02); }
            50% { box-shadow: 0 0 15px rgba(96, 165, 250, 0.5); transform: scale(1.01); }
            100% { box-shadow: 0 0 0 rgba(96, 165, 250, 0); transform: scale(1); }
        }


        .zf-study-header.expanded .zf-study-patient-name,
        .zf-study-header.active .zf-study-patient-name {
            color: var(--primary);
        }

        .zf-study-header .zf-study-chevron {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 10px;
            transition: transform 0.3s;
            opacity: 0.5;
        }

        .zf-study-header.expanded .zf-study-chevron {
            transform: rotate(180deg);
        }

        .zf-study-grid {
            grid-template-columns: 1fr;
            grid-auto-rows: max-content; /* Previne o achatamento vertical pelas trilhas do grid */
            gap: 10px;
            padding: 0 10px 0 10px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s, opacity 0.3s;
            opacity: 0;
            display: grid;
        }

        .zf-study-header.expanded + .zf-study-grid {
            max-height: 100000px; /* Suficiente para exames gigantes com zoom no máximo */
            padding: 10px;
            opacity: 1;
        }

        .zf-study-preview {
            height: 60px;
            background: #000;
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 4px;
            opacity: 0.4;
            filter: grayscale(0.8);
            transition: all 0.4s ease;
        }

        .zf-study-header.expanded .zf-study-preview,
        .zf-study-header.active .zf-study-preview,
        .zf-study-header.evaluated .zf-study-preview {
            opacity: 1;
            filter: grayscale(0);
        }

        .zf-study-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            opacity: 0.7;
        }

        .zf-study-evaluated-badge {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 24px;
            color: #ef4444; /* Vermelho vibrante */
            text-shadow: 0 0 10px rgba(0,0,0,0.8);
            pointer-events: none;
            animation: zf-eye-pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
        }

        @keyframes zf-eye-pulse {
            0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
            50% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9); }
        }

        .zf-study-delete-btn {
            position: absolute;
            top: 6px;
            left: 6px;
            z-index: 30;
            background: rgba(15, 23, 42, 0.7);
            border: 1px solid rgba(239, 68, 68, 0.5);
            color: #f87171;
            border-radius: 4px;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            font-size: 10px;
            padding: 0;
            opacity: 0;
            pointer-events: auto;
        }

        /* Revela o botão no hover do card */
        .zf-study-header:hover .zf-study-delete-btn {
            opacity: 0.75;
        }

        /* Destaque completo ao focar o botão diretamente */
        .zf-study-delete-btn:hover {
            background: #ef4444 !important;
            border-color: #ef4444 !important;
            color: #ffffff !important;
            opacity: 1 !important;
            box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
            transform: scale(1.08);
        }

        .zf-thumbnail-item {
            width: 92%;
            aspect-ratio: 1;
            margin: 0 auto;
            flex-shrink: 0;
            background: var(--bg-viewer);
            border: 1px solid var(--border-viewer);
            border-radius: 4px;
            cursor: pointer;
            position: relative;
            transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .zf-thumbnail-item:hover {
            border-color: var(--primary);
        }

        .zf-thumbnail-item.active {
            border-color: var(--primary);
            border-width: 2px;
            box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
        }

        .zf-thumbnail-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            filter: grayscale(1);
            pointer-events: none;
            /* Imagens não precisam capturar eventos de mouse parando o scroll */
        }

        /* Indicador animado de série ativa */
        .zf-thumbnail-eye {
            position: absolute;
            bottom: 5px;
            right: 5px;
            color: #ffd700;
            font-size: 14px;
            z-index: 10;
            display: none;
            pointer-events: none;
            text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
        }

        .zf-thumbnail-item.showing .zf-thumbnail-eye {
            display: block;
            animation: eye-blink 1.5s infinite alternate;
        }

        @keyframes eye-blink {
            0% {
                opacity: 0.4;
                transform: scale(0.9);
            }
            100% {
                opacity: 1;
                transform: scale(1.1);
            }
        }

        .zf-thumb-series-delete-btn {
            position: absolute;
            top: 4px;
            right: 4px;
            z-index: 25;
            background: rgba(15, 23, 42, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.15);
            color: #f87171;
            width: 20px;
            height: 20px;
            border-radius: 4px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 9px;
            opacity: 0;
            transition: all 0.2s ease;
        }

        .zf-thumbnail-item:hover .zf-thumb-series-delete-btn,
        .zf-thumbnail-item.active .zf-thumb-series-delete-btn {
            opacity: 0.85;
        }

        .zf-thumb-series-delete-btn:hover {
            opacity: 1 !important;
            background: #ef4444 !important;
            color: #ffffff !important;
            transform: scale(1.08);
        }


        .zf-thumbnail-label {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(15, 23, 42, 0.75);
            /* Mudança aqui: de rgba preto para slate translúcido */
            -webkit-backdrop-filter: blur(4px);
            backdrop-filter: blur(4px);
            color: #fff;
            font-size: 9px;
            text-align: center;
            padding: 3px 0;
        }

        .zf-main-stage {
            flex: 1;
            display: grid;
            gap: 2px;
            padding: 2px;
            background: #000;
            position: relative;
            overflow: hidden;
            overflow: clip; /* Prevent programmatic scroll completely */
            width: 100%;
            min-height: 0;
        }

        .zf-main-stage.layout-1x1 {
            grid-template-columns: 1fr;
            grid-template-rows: 1fr;
        }

        .zf-main-stage.layout-2x2 {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
        }

        .zf-main-stage.layout-3x2 {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }

        .zf-main-stage.layout-3x3 {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }

        .zf-main-stage.layout-4x4 {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(4, 1fr);
        }

        .zf-main-stage.layout-3x1 {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: 1fr;
        }

        .zf-main-stage.layout-1x3 {
            grid-template-columns: 1fr;
            grid-template-rows: repeat(3, 1fr);
        }

        .zf-main-stage.layout-2x1 {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr;
        }
        .zf-main-stage.layout-1x2 {
            grid-template-columns: 1fr;
            grid-template-rows: 1fr 1fr;
        }

        .zf-main-stage.layout-2x3 {
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }

        .zf-main-stage.layout-4x2 {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }

        .zf-main-stage.layout-2x4 {
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(4, 1fr);
        }

        .zf-main-stage.layout-5x2 {
            grid-template-columns: repeat(5, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }

        .zf-main-stage.layout-2x5 {
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(5, 1fr);
        }

        .zf-main-stage.layout-4x3 {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }

        .zf-main-stage.layout-3x4 {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(4, 1fr);
        }

        .zf-main-stage.layout-5x3 {
            grid-template-columns: repeat(5, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }

        .zf-main-stage.layout-3x5 {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(5, 1fr);
        }

        .zf-main-stage.layout-5x4 {
            grid-template-columns: repeat(5, 1fr);
            grid-template-rows: repeat(4, 1fr);
        }

        .zf-main-stage.layout-4x5 {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(5, 1fr);
        }

        .zf-main-stage.layout-5x5 {
            grid-template-columns: repeat(5, 1fr);
            grid-template-rows: repeat(5, 1fr);
        }

        .zf-main-stage.layout-6x5 {
            grid-template-columns: repeat(6, 1fr);
            grid-template-rows: repeat(5, 1fr);
        }

        .zf-main-stage.layout-5x6 {
            grid-template-columns: repeat(5, 1fr);
            grid-template-rows: repeat(6, 1fr);
        }

        .zf-main-stage.layout-6x6 {
            grid-template-columns: repeat(6, 1fr);
            grid-template-rows: repeat(6, 1fr);
        }


        .zf-viewport {
            background: #000;
            border: 1px solid #1a1a1a;
            position: relative;
            z-index: 1;
            display: block;
            /* Mudei de flex para block para inibir shrink pre-render */
            width: 100%;
            height: 100%;
            overflow: hidden;
            border-radius: 4px;
            min-width: 0;
            min-height: 0;
            container-type: size;
            container-name: viewport;
        }

        /* HARD-FORCE OVERRIDE: Obrigação física do viewport preencher o Grid sem respeitar falhas do renderizador Cornerstone */
        .zf-viewport canvas {
            width: 100% !important;
            height: 100% !important;
            object-fit: contain !important;
            /* pointer-events: auto !important; */
            cursor: inherit !important;
        }

        .zf-viewport, .zf-viewport svg {
            cursor: inherit !important;
        }

        .zf-img {
            max-width: 95%;
            max-height: 95%;
            filter: grayscale(1);
            transform-origin: center;
            pointer-events: none;
            -webkit-user-select: none;
            user-select: none;
        }

        /* Botão de Fechar Viewport */
        .zf-vp-close-btn {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 32px;
            height: 32px;
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(255, 255, 255, 0.7);
            font-size: 16px;
            cursor: pointer;
            z-index: 9999;
            opacity: 0;
            transition: all 0.2s ease;
            backdrop-filter: blur(4px);
            /* pointer-events: auto !important; */
        }

        .zf-viewport:hover .zf-vp-close-btn {
            opacity: 1;
        }

        .zf-vp-close-btn:hover {
            background: rgba(239, 68, 68, 0.8);
            color: white;
            border-color: rgba(239, 68, 68, 1);
        }

        body.mpr-active .zf-vp-close-btn,
        body.vr-active .zf-vp-close-btn {
            display: none !important;
        }


        /* Linhas de Referência (Localizers) */
        .zf-ref-line {
            position: absolute;
            pointer-events: none;
            z-index: 10;
        }

        .zf-ref-line-h {
            width: 100%;
            height: 1px;
            border-top: 1px dashed rgba(255, 255, 0, 0.4);
        }

        .zf-ref-line-v {
            height: 100%;
            width: 1px;
            border-left: 1px dashed rgba(255, 255, 0, 0.4);
        }


        .zf-viewport.active {
            border: 1px solid var(--primary);
            box-shadow: inset 0 0 10px rgba(37, 99, 235, 0.1);
        }

        /* Destaca o viewport ativo quando há mais de um em exibição (não é filho único no grid) */
        .zf-viewport.active:not(:only-child)::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 2px solid var(--primary) !important; /* Borda 2px na cor do tema atual */
            box-shadow: inset 0 0 8px rgba(37, 99, 235, 0.3), 0 0 8px rgba(37, 99, 235, 0.4);
            pointer-events: none; /* Permite cliques passarem para o Cornerstone normalmente */
            z-index: 10; /* Fica acima do Canvas e dos SVGs */
            border-radius: inherit; /* Copia o arredondamento de 4px da viewport */
        }

        .zf-viewport.zf-drop-highlight {
            border: 2px dashed var(--primary) !important;
            box-shadow: inset 0 0 30px rgba(96, 165, 250, 0.15), 0 0 15px rgba(37, 99, 235, 0.3) !important;
            transition: border 0.15s, box-shadow 0.15s;
        }

        /* --- SYNC VISUAL FEEDBACK --- */
        body.zf-global-sync-active .zf-viewport[data-active-series-uid]:not([data-active-series-uid=""]) {
            border-color: rgba(16, 185, 129, 0.5) !important; /* Esmeralda suave */
            transition: border-color 0.3s ease;
        }
        
        body.zf-global-sync-active .zf-viewport[data-active-series-uid]:not([data-active-series-uid=""])::after {
            content: '\f0c1'; /* fa-link */
            font-family: 'Font Awesome 5 Free';
            font-weight: 900;
            position: absolute;
            top: 16px;
            right: 50px;
            font-size: 14px;
            color: #10b981;
            text-shadow: 0 0 5px rgba(0,0,0,0.8);
            z-index: 1000;
            pointer-events: none;
            opacity: 0.85;
            transition: opacity 0.3s;
        }

        .zf-main-stage.zf-drop-highlight-stage {
            box-shadow: inset 0 0 50px rgba(37, 99, 235, 0.15) !important;
            transition: box-shadow 0.15s;
        }

        /* Overlays DICOM mais precisos e densos */
        .zf-overlay {
            position: absolute;
            pointer-events: none;
            color: rgba(255, 255, 255, 0.95);
            font-family: 'Consolas', 'Courier New', monospace; /* Medical standard for numbers */
            font-size: 11.5px;
            font-weight: 400;
            text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5); /* Heavy contrast for bright scans */
            padding: 12px 14px;
            z-index: 5;
            line-height: 1.4;
            letter-spacing: 0.3px;
        }

        .zf-overlay-tl {
            top: 0;
            left: 0;
        }

        .zf-overlay-tr {
            top: 36px; /* Ajustado para dar espaço ao botão de fechar */
            right: 0;
            text-align: right;
        }

        .zf-overlay-bl {
            bottom: 0;
            left: 0;
        }

        .zf-overlay-br {
            bottom: 0;
            right: 0;
            text-align: right;
        }

        .zf-overlay-name {
            color: #38bdf8;
            font-weight: 700;
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 2px;
            display: block;
        }

        .zf-overlay-label {
            color: rgba(255, 255, 255, 0.6);
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .zf-overlay-series-desc {
            color: rgba(255, 255, 255, 0.85);
            font-weight: 500;
        }

        /* Estilos Base para Overlays DICOM (Substituindo estilos inline antigos do JS) */
        .zf-overlay-inst {
            color: var(--primary);
            font-weight: 700;
            font-size: 10px;
        }

        .zf-overlay-pname {
            font-weight: 700;
            font-size: 14px; /* Reduzido de 18px para melhor legibilidade e espaço */
            margin-top: 2px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .zf-overlay-pdetails {
            font-size: 11px; /* Reduzido de 14px para manter hierarquia visual */
            opacity: 0.8;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .zf-overlay-exam-type {
            color: var(--primary);
            font-weight: 700;
            font-size: 12.5px;
            margin-top: 4px;
            text-shadow: 2px 2px 2px #000;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .zf-overlay-tr {
            text-align: right;
            top: 36px; /* Ajustado para dar espaço ao botão de fechar */
        }

        .zf-overlay-study-date {
            font-weight: 700;
            font-size: 14px;
        }

        .zf-overlay-study-time {
            font-size: 10px;
            opacity: 0.8;
        }

        .zf-overlay-study-desc {
            color: var(--primary);
            font-size: 12.5px;
            font-weight: 700;
            margin-top: 4px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .zf-overlay-thick {
            font-size: 10px;
            opacity: 0.8;
        }

        .zf-overlay-loc {
            font-size: 10px;
            opacity: 0.8;
        }

        .zf-overlay-rich-data {
            font-size: 9px;
            color: var(--primary);
            margin-top: 4px;
            opacity: 0.8;
        }

        .zf-overlay-br {
            text-align: right;
        }

        .zf-overlay-sequence {
            font-size: 14px;
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 2px;
            text-shadow: 1px 1px 2px #000;
        }

        .zf-overlay-machine {
            font-size: 9px;
            opacity: 0.6;
            margin-bottom: 4px;
        }

        .zf-overlay-wl-zoom {
            background: var(--glass-bg);
            backdrop-filter: blur(8px);
            border: 1px solid var(--glass-border);
            padding: 6px 10px;
            border-radius: 8px;
            display: inline-block;
        }

        .zf-overlay-wl-zoom span {
            color: #888;
        }

        .zf-overlay-wl-zoom span:not(:first-child) {
            margin-left: 6px;
        }

        /* === CONTAINER QUERIES PARA VIEWPORTS PEQUENAS/ACHATADAS === */
        @container viewport (max-height: 200px) {
            .zf-overlay {
                padding: 6px 8px;
            }
            .zf-overlay-pname {
                font-size: 12px;
            }
            .zf-overlay-pdetails {
                font-size: 10px;
            }
            .zf-overlay-exam-type {
                font-size: 11px;
                margin-top: 2px;
            }
            .zf-overlay-study-date {
                font-size: 11px;
            }
            .zf-overlay-study-desc {
                font-size: 11px;
                margin-top: 2px;
            }
            .zf-overlay-sequence {
                font-size: 11px;
            }
            .zf-overlay-wl-zoom {
                padding: 4px 6px;
                font-size: 9.5px;
                border-radius: 6px;
            }
            .zf-orient-label {
                font-size: 11px;
            }
            .zf-overlay-tr {
                top: 24px; /* Ajustado para viewports menores */
            }
            /* Ocultar elementos menos críticos em viewports curtos verticalmente */
            .zf-overlay-inst,
            .zf-overlay-study-time,
            .zf-overlay-machine {
                display: none !important;
            }
        }

        @container viewport (max-height: 135px) {
            .zf-overlay {
                padding: 4px 6px;
            }
            .zf-overlay-pname {
                font-size: 10px;
            }
            .zf-overlay-pdetails {
                font-size: 8px;
            }
            .zf-overlay-exam-type {
                display: none !important; /* Oculta tipo de exame se a altura for mínima */
            }
            .zf-overlay-study-date {
                display: none !important; /* Oculta data de estudo */
            }
            .zf-overlay-study-desc {
                font-size: 10px;
                margin-top: 0;
            }
            .zf-overlay-sequence {
                font-size: 10px;
            }
            .zf-overlay-wl-zoom {
                padding: 2px 4px;
                font-size: 8.5px;
                border-radius: 4px;
            }
            /* Mudar W: / L: / Zoom: para ficar em linha única */
            .zf-overlay-wl-zoom br {
                display: none !important;
            }
            .zf-overlay-wl-zoom span {
                margin-left: 3px !important;
            }
            /* Reduzir e colar marcadores de orientação */
            .zf-orient-label {
                font-size: 9px;
            }
            .zf-orient-top { top: 4px; }
            .zf-orient-bottom { bottom: 4px; }
            .zf-orient-left { left: 4px; }
            .zf-orient-right { right: 4px; }
            
            /* Ocultar espessura/localização se estiver muito curto */
            .zf-overlay-thick,
            .zf-overlay-loc,
            .zf-overlay-rich-data {
                display: none !important;
            }
            
            .zf-overlay-tr {
                top: 4px; /* Quase sem margem quando a altura é mínima */
            }
            .zf-vp-close-btn {
                width: 20px;
                height: 20px;
                font-size: 10px;
                top: 4px;
                right: 4px;
            }
        }

        @container viewport (max-width: 260px) {
            /* Se for muito estreito na horizontal, ocultamos textos longos para evitar sobreposição no centro */
            .zf-overlay-pdetails {
                display: none !important;
            }
            .zf-overlay-wl-zoom {
                display: none !important; /* Oculta W/L e Zoom se for muito estreito */
            }
            .zf-overlay-study-desc {
                max-width: 80px;
            }
            .zf-overlay-pname {
                max-width: 80px;
            }
            /* Ocultar marcadores de orientação laterais se o viewport for muito estreito */
            .zf-orient-left,
            .zf-orient-right {
                display: none !important;
            }
        }

        /* === RÉGUA DE MEDIDA CALIBRADA (RULER) === */
        .zf-ruler {
            position: absolute;
            right: 50px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 6;
            pointer-events: none;
            display: none; /* Oculto até imagem com pixelSpacing ser carregada */
            opacity: 0.85;
            transition: opacity 0.3s ease;
        }

        .zf-ruler-label {
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 9px;
            color: rgba(255, 200, 50, 0.9);
            text-align: center;
            margin-bottom: 2px;
            font-weight: 700;
            text-shadow: 0 1px 3px rgba(0,0,0,0.9);
            letter-spacing: 0.5px;
        }

        .zf-ruler-bar {
            position: relative;
            width: 2px;
            background: rgba(255, 200, 50, 0.6);
            margin: 0 auto;
            border-radius: 1px;
            box-shadow: 0 0 4px rgba(255, 200, 50, 0.3);
        }

        .zf-ruler-tick {
            position: absolute;
            right: 0;
            height: 1px;
            background: rgba(255, 200, 50, 0.7);
        }

        .zf-ruler-tick.cm {
            width: 10px;
        }

        .zf-ruler-tick.half {
            width: 6px;
        }

        .zf-ruler-tick-label {
            position: absolute;
            right: 14px;
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 8px;
            color: rgba(255, 200, 50, 0.85);
            transform: translateY(-50%);
            text-shadow: 0 1px 2px rgba(0,0,0,0.9);
            white-space: nowrap;
        }

        /* Ocultar régua em modo imagem pura */
        .pure-image-mode .zf-ruler, .partial-image-mode .zf-ruler { display: none !important; }

        /* === STACK SCROLLBAR (Barra de Rolagem de Fatias) === */
        .zf-stack-scrollbar {
            position: absolute;
            left: 6px;
            top: 40px;
            bottom: 40px;
            width: 12px;
            z-index: 8;
            display: none;
            cursor: pointer;
            opacity: 0.45;
            transition: opacity 0.3s ease, width 0.2s ease;
        }

        .zf-stack-scrollbar:hover,
        .zf-stack-scrollbar.active {
            opacity: 0.95;
            width: 18px;
        }

        .zf-stack-scrollbar-track {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 4px;
            height: 100%;
            background: rgba(255, 255, 255, 0.15);
            border-radius: 2px;
        }

        .zf-stack-scrollbar:hover .zf-stack-scrollbar-track,
        .zf-stack-scrollbar.active .zf-stack-scrollbar-track {
            width: 6px;
            background: rgba(255, 255, 255, 0.25);
        }

        .zf-stack-scrollbar-thumb {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            width: 10px;
            height: 30px;
            min-height: 24px;
            background: #8b0000;
            border-radius: 5px;
            transition: background 0.2s, box-shadow 0.2s, width 0.2s;
            cursor: grab;
        }

        .zf-stack-scrollbar:hover .zf-stack-scrollbar-thumb,
        .zf-stack-scrollbar.active .zf-stack-scrollbar-thumb {
            width: 16px;
            background: #8b0000;
            box-shadow: 0 0 8px rgba(139, 0, 0, 0.5);
        }

        .zf-stack-scrollbar-thumb:active,
        .zf-stack-scrollbar-thumb.dragging {
            cursor: grabbing;
            background: #8b0000;
            box-shadow: 0 0 12px rgba(139, 0, 0, 0.8);
        }

        .pure-image-mode .zf-stack-scrollbar,
        .partial-image-mode .zf-stack-scrollbar {
            display: none !important;
        }

        /* === MODAL DE PREFERÊNCIAS DE LAYOUT POR MODALIDADE === */
        .zf-prefs-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: zf-prefs-fadein 0.25s ease;
        }

        @keyframes zf-prefs-fadein {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .zf-prefs-modal {
            background: var(--bg-side, #1a1d23);
            border: 1px solid var(--border-viewer, #2a2d35);
            border-radius: 16px;
            padding: 28px 32px;
            min-width: 520px;
            max-width: 600px;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(96, 165, 250, 0.08);
            animation: zf-prefs-slidein 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes zf-prefs-slidein {
            from { transform: translateY(20px) scale(0.97); opacity: 0; }
            to { transform: translateY(0) scale(1); opacity: 1; }
        }

        .zf-prefs-title {
            font-family: 'Inter', 'Segoe UI', sans-serif;
            font-size: 16px;
            font-weight: 800;
            color: #fff;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .zf-prefs-title i {
            color: var(--primary, #60a5fa);
            font-size: 18px;
        }

        .zf-prefs-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin-bottom: 20px;
        }

        .zf-prefs-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-viewer, #2a2d35);
            border-radius: 12px;
            padding: 14px;
            text-align: center;
            transition: all 0.3s ease;
        }

        .zf-prefs-card:hover {
            background: rgba(96, 165, 250, 0.06);
            border-color: rgba(96, 165, 250, 0.3);
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.1);
        }

        .zf-prefs-card-icon {
            font-size: 22px;
            margin-bottom: 6px;
            display: block;
        }

        .zf-prefs-card-name {
            font-family: 'Inter', 'Segoe UI', sans-serif;
            font-size: 12px;
            font-weight: 700;
            color: #fff;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 8px;
        }

        .zf-prefs-card select {
            width: 100%;
            padding: 6px 8px;
            background: rgba(0, 0, 0, 0.4);
            color: #fff;
            border: 1px solid var(--border-viewer, #2a2d35);
            border-radius: 6px;
            font-family: 'Consolas', monospace;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            outline: none;
            transition: border-color 0.2s;
            -webkit-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2360a5fa'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 8px center;
            padding-right: 24px;
        }

        .zf-prefs-card select:focus {
            border-color: var(--primary, #60a5fa);
            box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
        }

        .zf-prefs-card select option {
            background: #1a1d23;
            color: #fff;
        }

        .zf-prefs-hint {
            font-size: 10px;
            color: rgba(255, 255, 255, 0.4);
            text-align: center;
            margin-bottom: 18px;
            font-style: italic;
        }

        .zf-prefs-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .zf-prefs-btn {
            padding: 8px 20px;
            border: 1px solid var(--border-viewer, #2a2d35);
            border-radius: 8px;
            font-family: 'Inter', 'Segoe UI', sans-serif;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .zf-prefs-btn-secondary {
            background: transparent;
            color: var(--text-muted, #888);
        }

        .zf-prefs-btn-secondary:hover {
            background: rgba(255, 255, 255, 0.05);
            color: #fff;
        }

        .zf-prefs-btn-primary {
            background: var(--primary, #60a5fa);
            color: #fff;
            border-color: var(--primary, #60a5fa);
        }

        .zf-prefs-btn-primary:hover {
            background: #3b82f6;
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
            transform: translateY(-1px);
        }

        /* Toolbar Lateral Direita (Top Toolbar) */
        .zf-top-toolbar {
            min-height: 54px;
            height: auto;
            flex-shrink: 0;
            flex-grow: 0;
            background: var(--bg-toolbar);
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border-bottom: 1px solid var(--border-viewer);
            display: flex;
            align-items: center;
            padding: 8px 15px;
            gap: 12px;
            flex-wrap: wrap;
            z-index: 9999; /* Increased to ensure it is above all viewports and resizers */
            box-sizing: border-box;
            position: relative;
            overflow: visible !important;
        }

        .zf-toolbar-divider {
            width: 1px;
            height: 24px;
            background: var(--border-viewer);
            margin: 0 5px;
        }

        /* Sidebar Reorganized */
        .zf-sidebar-right {
            background: var(--bg-side);
            border-left: 1px solid var(--border-viewer);
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            overflow-y: auto;
            width: var(--zf-right-sidebar-width, 240px);
            min-width: 150px;
            max-width: 500px;
            flex-shrink: 0;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
        }

        /* Auto-hide feature for Right Sidebar (Base) */
        body.right-sidebar-autohide .zf-sidebar-right {
            position: absolute !important;
            z-index: 10000;
            opacity: 0;
            box-shadow: 0 0 25px rgba(0,0,0,0.8);
            pointer-events: none; /* Ignore pointer when hidden */
            transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 1.2s ease;
        }
        body.right-sidebar-autohide .zf-sidebar-right.autohide-expanded {
            opacity: 1;
            pointer-events: auto;
            transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
        }
        /* Resizer Absolute when Autohide */
        body.right-sidebar-autohide #zfResizerRight {
            position: absolute !important;
            z-index: 10001; /* Acima da sidebar */
            pointer-events: none;
            opacity: 0;
            transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 1.2s ease;
        }
        body.right-sidebar-autohide #zfResizerRight.autohide-expanded {
            opacity: 1;
            pointer-events: auto;
            transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
        }

        /* Auto-hide Trigger (Base) */
        .zf-sidebar-hover-trigger {
            display: none;
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger {
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            background: var(--primary);
            z-index: 10000;
            cursor: pointer;
            color: #fff;
            transition: all 0.2s ease;
            opacity: 0.85;
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger:hover {
            background: var(--primary);
            opacity: 1;
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.5);
        }

        /* DEFAULT / RIGHT DOCK */
        body.right-sidebar-autohide .zf-sidebar-right:not(.dock-left):not(.dock-top):not(.dock-bottom) {
            right: 0; top: 0; bottom: 0; height: 100%;
            transform: translateX(100%);
        }
        body.right-sidebar-autohide .zf-sidebar-right.autohide-expanded:not(.dock-left):not(.dock-top):not(.dock-bottom) {
            transform: translateX(0);
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger:not(.trigger-dock-left):not(.trigger-dock-top):not(.trigger-dock-bottom) {
            right: 0; top: 35%; transform: translateY(-50%);
            width: 14px; height: 120px;
            border: 1px solid var(--primary); border-right: none;
            border-radius: 8px 0 0 8px; box-shadow: -2px 0 10px rgba(0,0,0,0.3);
            z-index: 10000;
        }
        body.right-sidebar-autohide #zfResizerRight:not(.resizer-dock-left):not(.resizer-dock-top):not(.resizer-dock-bottom) {
            right: var(--zf-right-sidebar-width, 240px); top: 0; bottom: 0; height: 100%; width: 5px; cursor: col-resize;
            transform: translateX(calc(100% + var(--zf-right-sidebar-width, 240px)));
        }
        body.right-sidebar-autohide #zfResizerRight.autohide-expanded:not(.resizer-dock-left):not(.resizer-dock-top):not(.resizer-dock-bottom) {
            transform: translateX(0);
        }

        /* LEFT DOCK */
        body.right-sidebar-autohide .zf-sidebar-right.dock-left {
            left: calc(var(--zf-left-sidebar-width, 150px) + 5px); 
            top: 0; bottom: 0; height: 100%;
            transform: translateX(-100%);
            z-index: 10000; /* Ensures visibility over main stage */
        }
        body.right-sidebar-autohide .zf-sidebar-right.dock-left.autohide-expanded {
            transform: translateX(0);
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger.trigger-dock-left {
            left: calc(var(--zf-left-sidebar-width, 150px) + 15px); 
            top: 35%; transform: translateY(-50%);
            width: 14px; height: 120px;
            border: 1px solid var(--primary); border-left: none;
            border-radius: 0 8px 8px 0; box-shadow: 2px 0 10px rgba(0,0,0,0.3);
            z-index: 10000;
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-left {
            left: calc(var(--zf-left-sidebar-width, 150px) + 5px + var(--zf-right-sidebar-width, 240px));
            top: 0; bottom: 0; height: 100%; width: 5px; cursor: col-resize;
            transform: translateX(calc(-100% - var(--zf-right-sidebar-width, 240px)));
            z-index: 10001;
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-left.autohide-expanded {
            transform: translateX(0);
        }

        /* TOP DOCK */
        body.right-sidebar-autohide .zf-sidebar-right.dock-top {
            top: var(--zf-top-toolbar-height, 54px); left: 0; right: 0; width: 100%; height: var(--zf-right-sidebar-height, 120px);
            transform: translateY(-100%);
            z-index: 105; /* Desliza por trás da top-toolbar (que tem z-index 110) */
        }
        body.right-sidebar-autohide .zf-sidebar-right.dock-top.autohide-expanded {
            transform: translateY(0);
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger.trigger-dock-top {
            top: var(--zf-top-toolbar-height, 54px); left: 35%; transform: translateX(-50%);
            width: 120px; height: 14px;
            border: 1px solid var(--primary); border-top: none;
            border-radius: 0 0 8px 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.3);
            z-index: 109;
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-top {
            top: var(--zf-top-toolbar-height, 54px); left: 0; right: 0; width: 100%; height: 5px; cursor: row-resize;
            margin-top: var(--zf-right-sidebar-height, 120px);
            transform: translateY(-1000px); /* Esconde longe quando recolhido */
            z-index: 115;
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-top.autohide-expanded {
            transform: translateY(0);
        }

        /* BOTTOM DOCK */
        body.right-sidebar-autohide .zf-sidebar-right.dock-bottom {
            bottom: 0; left: 0; right: 0; width: 100%; height: var(--zf-right-sidebar-height, 120px);
            transform: translateY(100%);
        }
        body.right-sidebar-autohide .zf-sidebar-right.dock-bottom.autohide-expanded {
            transform: translateY(0);
        }
        body.right-sidebar-autohide .zf-sidebar-hover-trigger.trigger-dock-bottom {
            bottom: 0; left: 35%; transform: translateX(-50%);
            width: 120px; height: 14px;
            border: 1px solid var(--primary); border-bottom: none;
            border-radius: 8px 8px 0 0; box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
            z-index: 10000;
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-bottom {
            bottom: var(--zf-right-sidebar-height, 120px); left: 0; right: 0; width: 100%; height: 5px; cursor: row-resize;
            transform: translateY(calc(100% + var(--zf-right-sidebar-height, 120px)));
        }
        body.right-sidebar-autohide #zfResizerRight.resizer-dock-bottom.autohide-expanded {
            transform: translateY(0);
        }

        .zf-tool-group-title {
            cursor: pointer;
            user-select: none;
            transition: color 0.3s;
            font-size: 13px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1.2px;
            margin-bottom: 14px;
            font-weight: 800;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .zf-tool-group-title::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border-viewer);
            opacity: 0.5;
        }

        .zf-accordion-icon { margin-left: auto; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
        .zf-tool-group.collapsed .zf-accordion-icon { transform: rotate(-90deg); }
        .zf-tool-group.collapsed .zf-tool-grid { max-height: 0; opacity: 0; margin-bottom: -14px; pointer-events: none; }
        .zf-tool-grid {
            transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-bottom 0.3s;
            max-height: 2000px;
            opacity: 1;
            overflow: hidden;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
            gap: 8px;
        }

        .zf-tool-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            background: transparent;
            border: 1px solid transparent;
            border-radius: 4px;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            font-size: 10px;
            font-weight: 600;
            padding: 6px;
        }

        .zf-sidebar-right .zf-tool-btn {
            aspect-ratio: 1;
            box-sizing: border-border;
        }

        .zf-sidebar-right .zf-tool-btn span {
            display: block;
            width: 100%;
            text-align: center;
            line-height: 1.15;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .zf-top-toolbar .zf-tool-btn {
            width: 40px;
            height: 40px;
            padding: 0;
            border-radius: 8px;
        }

        .zf-tool-btn i {
            font-size: 22px;
            opacity: 0.6;
            transition: all 0.2s;
        }

        .zf-tool-btn:hover {
            background: rgba(255, 255, 255, 0.05);
            color: #f1f5f9;
            border-color: rgba(255, 255, 255, 0.15);
            transform: none;
            box-shadow: none;
        }
        
        .zf-tool-btn:hover i {
            opacity: 0.95;
            color: #f1f5f9;
        }
        
        .zf-tool-btn.active {
            background: rgba(255, 255, 255, 0.08);
            color: #f1f5f9;
            border-color: rgba(255, 255, 255, 0.22);
            box-shadow: none;
        }
        .zf-tool-btn.active i {
            opacity: 1;
            color: #f1f5f9;
        }

        /* 🌟 Cephos Nexus AI - Botão Amarelo/Âmbar Suave e Discreto */
        #aiToggle, .ai-toggle-btn {
            color: #f59e0b !important;
            background: rgba(245, 158, 11, 0.08) !important;
            border: 1px solid rgba(245, 158, 11, 0.22) !important;
            border-radius: 8px !important;
            transition: all 0.2s ease !important;
            box-shadow: none !important;
        }

        #aiToggle i, .ai-toggle-btn i {
            color: #f59e0b !important;
            opacity: 0.85 !important;
            transition: all 0.2s ease !important;
            filter: none !important;
        }

        #aiToggle:hover, .ai-toggle-btn:hover {
            background: rgba(245, 158, 11, 0.16) !important;
            border-color: rgba(245, 158, 11, 0.45) !important;
            color: #fbbf24 !important;
            box-shadow: 0 0 8px rgba(245, 158, 11, 0.2) !important;
        }

        #aiToggle:hover i, .ai-toggle-btn:hover i {
            color: #fbbf24 !important;
            opacity: 1 !important;
            filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.4)) !important;
        }

        #aiToggle.active, .ai-toggle-btn.active {
            background: rgba(245, 158, 11, 0.2) !important;
            border-color: rgba(245, 158, 11, 0.5) !important;
            color: #fbbf24 !important;
            box-shadow: 0 0 10px rgba(245, 158, 11, 0.25) !important;
        }

        /* Botões de controle de Slab (Espessura) */
        .zf-slab-btn {
            background: transparent;
            border: 1px solid transparent;
            color: var(--text-muted);
            width: 24px;
            height: 24px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 14px;
            padding: 0;
        }
        .zf-slab-btn:hover {
            background: rgba(96, 165, 250, 0.1);
            color: var(--primary);
            border-color: rgba(96, 165, 250, 0.3);
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
        }
        .zf-slab-slider {
            flex: 1;
            -webkit-appearance: none;
            appearance: none;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            outline: none;
            transition: all 0.3s;
        }
        .zf-slab-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--primary);
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
        }
        .zf-slab-slider::-webkit-slider-thumb:hover {
            transform: scale(1.25);
            box-shadow: 0 0 8px var(--primary);
        }

        /* Layout Grid Buttons Premium */
        .zf-layout-grid {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        /* Menu de Layout Dynamic Dropdown */
        .zf-layout-dropdown {
            position: relative;
            display: inline-block;
            overflow: visible !important;
            z-index: 10000;
        }

        .zf-layout-dropdown-options {
            position: absolute;
            top: 100%;
            margin-top: 5px;
            right: 0; /* Alinha o menu crescendo para a esquerda, evitando clipping na direita */
            transform: none; /* Removido translateX(-50%) para evitar que vaze para os lados do container */
            background: var(--bg-side);
            border: 1px solid var(--primary);
            border-radius: 8px;
            padding: 10px;
            display: none;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            z-index: 100000;
            box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 15px rgba(96, 165, 250, 0.2);
        }

        .zf-layout-dropdown:hover .zf-layout-dropdown-options,
        .zf-layout-dropdown.open .zf-layout-dropdown-options {
            display: grid;
        }

        /* Seletor de Grade Livre */
        .zf-free-layout-popover {
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 5px;
            background: var(--bg-side);
            border: 1px solid var(--primary);
            border-radius: 8px;
            padding: 12px;
            display: none;
            flex-direction: column;
            gap: 10px;
            z-index: 100001;
            box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 15px rgba(96, 165, 250, 0.2);
            cursor: default;
        }

        .zf-free-layout-popover.open {
            display: flex;
        }

        .zf-free-layout-header {
            font-size: 11px;
            color: var(--primary);
            text-align: center;
            font-weight: 700;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }

        .zf-free-layout-grid {
            display: grid;
            gap: 2px;
            background: rgba(0,0,0,0.5);
            padding: 4px;
            border-radius: 4px;
        }

        .zf-layout-cell {
            width: 20px;
            height: 20px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 2px;
            transition: background 0.1s, border-color 0.1s;
        }

        .zf-layout-cell.hovered {
            background: var(--primary);
            border-color: #fff;
            box-shadow: 0 0 5px var(--primary);
        }

        .zf-progress-fill {

            height: 100%;
            width: 0%;
            background: var(--primary);
            transition: width 0.3s ease;
        }

        .zf-layout-btn {
            width: 52px;
            height: 52px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border-viewer);
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            position: relative;
        }

        .zf-layout-btn:hover {
            background: rgba(96, 165, 250, 0.1);
            color: var(--primary);
            border-color: var(--primary);
            transform: scale(1.1);
            z-index: 10;
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba(96, 165, 250, 0.4);
        }

        /* Responsividade Extra para a Toolbar */
        @media (max-width: 1200px) {
            .zf-top-toolbar {
                gap: 8px;
                padding: 6px 10px;
            }
            .zf-toolbar-divider {
                margin: 0 2px;
            }
        }

        @media (max-width: 900px) {
            .zf-top-toolbar .zf-tool-btn {
                width: 32px;
                height: 25px;
            }
            .zf-top-toolbar .zf-tool-btn i {
                font-size: 13px;
            }
            .zf-layout-btn {
                width: 32px;
                height: 32px;
            }
            .zf-layout-icon {
                width: 12px;
                height: 12px;
            }
        }

        .zf-layout-btn.active {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        #mipSingleBtn {
            border-color: var(--primary);
            color: var(--primary);
        }

        #mipSingleBtn.active {
            background: var(--primary) !important;
            color: #fff !important;
            border-color: var(--primary) !important;
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.4) !important;
        }

        /* Estilo Especial para Botão de Comparação Ativo (Toggle) */
        .zf-tool-btn[data-tool="compare"].active-compare {
            background: #ef4444 !important; /* Vermelho vibrante */
            color: #fff !important;
            border-color: #f87171 !important;
            box-shadow: 0 0 15px rgba(239, 68, 68, 0.6) !important;
            transform: scale(1.05);
        }

        .zf-tool-btn[data-tool="compare"].active-compare i {
            color: #fff !important;
            text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
        }

        .zf-layout-icon {
            display: grid;
            gap: 2px;
            width: 14px;
            height: 14px;
        }

        .zf-layout-icon div {
            border: 1px solid currentColor;
        }

        .layout-1x1-icon {
            grid-template-columns: 1fr;
        }

        .layout-2x2-icon {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
        }

        .layout-3x2-icon {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }

        .layout-3x3-icon {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }

        .layout-4x4-icon {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(4, 1fr);
        }

        .layout-3x1-icon {
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: 1fr;
        }

        .layout-1x3-icon {
            grid-template-columns: 1fr;
            grid-template-rows: repeat(3, 1fr);
        }

        .layout-2x1-icon {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr;
        }

        .layout-1x2-icon {
            grid-template-columns: 1fr;
            grid-template-rows: 1fr 1fr;
        }

        .layout-3d-icon {
            grid-template-columns: 1.5fr 1fr;
            grid-template-rows: 1fr 1fr;
        }

        .layout-3d-icon div:first-child {
            grid-row: span 2;
        }

        .zf-metadata-panel {
            display: none;
            position: absolute;
            top: 50px;
            right: 240px;
            width: 300px;
            height: calc(100% - 50px);
            background: var(--bg-side);
            /* Substituta de #0a0a0a para integrar com o slate */
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border-left: 1px solid var(--border-viewer);
            z-index: 10;
            padding: 15px;
            overflow-y: auto;
            box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        }

        .zf-metadata-panel.active {
            display: block;
        }

        .zf-metadata-item {
            margin-bottom: 8px;
            font-size: 11px;
            font-family: monospace;
            border-bottom: 1px solid var(--border-viewer);
            padding-bottom: 4px;
        }

        .zf-metadata-tag {
            color: #888;
            margin-right: 5px;
        }

        .zf-metadata-val {
            color: #00ffcc;
        }

        .zf-progress-fill {
            width: 0%;
            height: 100%;
            background: var(--primary);
            transition: width 0.1s linear;
        }


        /* CINE Player Profissional */
        .zf-cine-player {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(15, 23, 42, 0.9);
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border-left: 1px solid var(--border-viewer);
            border-radius: 50px;
            padding: 10px 25px;
            display: flex;
            align-items: center;
            gap: 20px;
            z-index: 2000;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            transition: all 0.3s ease;
        }

        .zf-cine-ctrl {
            color: #fff;
            cursor: pointer;
            font-size: 18px;
            transition: color 0.2s;
        }

        .zf-cine-ctrl:hover {
            color: var(--primary);
        }

        .zf-cine-slider-group {
            display: flex;
            flex-direction: column;
            gap: 2px;
            width: 150px;
        }

        .zf-cine-slider-label {
            font-size: 9px;
            color: var(--text-muted);
            text-transform: uppercase;
            font-weight: bold;
        }

        .zf-cine-slider {
            width: 100%;
            height: 4px;
            accent-color: var(--primary);
            cursor: pointer;
        }

        /* Modo Imagem Pura */
        .pure-image-mode .zf-overlay, 
        .pure-image-mode .zf-orient-label {
            visibility: hidden !important;
        }

        .pure-image-mode .zf-ref-line { display: none !important; }

/* Modo Imagem Parcial (Criar Agora) */
.partial-image-mode .zf-overlay-inst,
.partial-image-mode .zf-overlay-exam-type,
.partial-image-mode .zf-overlay-study-time,
.partial-image-mode .zf-overlay-study-desc,
.partial-image-mode .zf-overlay-slice,
.partial-image-mode .zf-overlay-thick,
.partial-image-mode .zf-overlay-loc,
.partial-image-mode .zf-overlay-rich-data,
.partial-image-mode .zf-overlay-machine,
.partial-image-mode .zf-overlay-wl-zoom {
    visibility: hidden !important;
}
.partial-image-mode .zf-overlay-pid,
.partial-image-mode .zf-overlay-psex,
.partial-image-mode .zf-overlay-pdetails-separator1,
.partial-image-mode .zf-overlay-pdetails-separator2 {
    display: none !important;
}
.partial-image-mode .zf-ref-line {
    display: none !important;
}

        /* Painel de Medições Salvas */
        .zf-measures-panel {
            position: absolute;
            top: 0;
            right: 0;
            width: 220px;
            height: 100%;
            background: rgba(2, 6, 23, 0.92);
            border-left: 1px solid var(--border-viewer);
            z-index: 500;
            display: none;
            flex-direction: column;
            padding: 12px;
            gap: 8px;
            overflow-y: auto;
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
        }

        .zf-measures-panel.active {
            display: flex;
        }

        .zf-measures-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-viewer);
            padding-bottom: 8px;
            margin-bottom: 4px;
        }

        .zf-measures-header h4 {
            margin: 0;
            font-size: 0.75rem;
            color: var(--text-viewer);
        }

        .zf-measure-item {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.04);
            border-radius: 4px;
            padding: 6px 8px;
            font-size: 11px;
            color: var(--text-viewer);
        }

        .zf-measure-item i {
            color: var(--primary);
            font-size: 13px;
            width: 16px;
        }

        .zf-measure-item span {
            flex: 1;
        }

        .zf-measure-delete {
            cursor: pointer;
            color: var(--text-muted);
            font-size: 11px;
        }

        .zf-measure-delete:hover {
            color: #f87171;
        }

        /* Indicadores de Orientação Anatômica (Elite) */
        .zf-orient-label {
            position: absolute;
            z-index: 20;
            color: #d1d5db;
            font-size: 14px;
            font-weight: 700;
            text-shadow: 1px 1px 3px #000;
            pointer-events: none;
            font-family: 'Inter', sans-serif;
            visibility: hidden;
        }

        .zf-orient-top {
            top: 12px;
            left: 50%;
            transform: translateX(-50%);
        }

        .zf-orient-bottom {
            bottom: 12px;
            left: 50%;
            transform: translateX(-50%);
        }

        .zf-orient-left {
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
        }

        .zf-orient-right {
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
        }

        /* HUD Glass Effect */
        .zf-overlay-br {
            bottom: 12px !important;
            right: 12px !important;
            text-align: right;
        }


        /* Context Menu Styles - Ultra Refined Platform Theme Skin */
        .zf-context-menu {
            position: fixed;
            z-index: 15000;
            background: var(--bg-toolbar, rgba(2, 6, 23, 0.96));
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.1));
            border-radius: 12px;
            padding: 6px;
            min-width: 225px;
            box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--glass-border, rgba(255, 255, 255, 0.05));
            display: none;
            flex-direction: column;
            gap: 1.5px;
            animation: menuFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
            transform-origin: top left;
            -webkit-user-select: none;
            user-select: none;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        .zf-context-header {
            font-size: 10px;
            font-weight: 700;
            color: var(--primary, #60a5fa);
            text-transform: uppercase;
            letter-spacing: 0.8px;
            padding: 6px 10px 6px 8px;
            border-bottom: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.08));
            margin-bottom: 4px;
            opacity: 0.95;
            pointer-events: none;
            display: flex;
            align-items: center;
        }

        .zf-context-item {
            padding: 5px 8px;
            display: flex;
            align-items: center;
            color: var(--text-viewer, #f8fafc);
            font-size: 12px;
            font-weight: 400;
            cursor: pointer;
            border-radius: 6px;
            position: relative;
            transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid transparent;
            min-height: 28px;
            box-sizing: border-box;
        }

        .zf-context-item:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--border-viewer, rgba(255, 255, 255, 0.12));
            color: #ffffff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
        }

        .zf-context-status-col {
            width: 10px;
            min-width: 10px;
            height: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 4px;
            flex-shrink: 0;
        }

        .zf-context-dot {
            width: 5.5px;
            height: 5.5px;
            border-radius: 50%;
            background: var(--primary, #60a5fa);
            box-shadow: 0 0 6px var(--primary, #60a5fa);
            display: inline-block;
            animation: pulseDot 2s infinite;
        }

        .zf-context-icon-col {
            width: 20px;
            min-width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 14px;
            color: var(--text-muted, #94a3b8);
            opacity: 0.9;
            text-align: center;
            transition: color 0.12s ease;
        }

        .zf-context-item:hover .zf-context-icon-col {
            color: var(--primary, #60a5fa);
            opacity: 1;
        }

        .zf-context-label-text {
            flex: 1;
            margin-left: 6px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.2;
            letter-spacing: 0.15px;
        }

        .zf-context-item.active {
            color: var(--primary, #60a5fa);
            font-weight: 600;
            background: rgba(255, 255, 255, 0.05);
            border-color: var(--border-viewer, rgba(255, 255, 255, 0.12));
        }

        .zf-context-item.active .zf-context-icon-col {
            color: var(--primary, #60a5fa);
        }

        .zf-context-item.active:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.1);
            border-color: var(--border-viewer, rgba(255, 255, 255, 0.2));
        }

        .zf-context-shortcut {
            margin-left: auto;
            font-size: 10px;
            font-weight: 600;
            color: var(--text-muted, #94a3b8);
            background: rgba(255, 255, 255, 0.05);
            padding: 1px 5px;
            border-radius: 4px;
            border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.08));
            letter-spacing: 0.5px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            flex-shrink: 0;
        }

        .zf-context-item:hover .zf-context-shortcut {
            color: var(--text-viewer, #ffffff);
            background: rgba(255, 255, 255, 0.12);
            border-color: var(--border-viewer, rgba(255, 255, 255, 0.15));
        }

        .zf-context-arrow {
            margin-left: auto;
            font-size: 9px;
            color: var(--text-muted, #94a3b8);
            opacity: 0.6;
            padding-left: 8px;
            transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
            flex-shrink: 0;
            display: flex;
            align-items: center;
        }

        .zf-context-parent:hover > .zf-context-arrow {
            opacity: 1;
            color: var(--primary, #60a5fa);
            transform: translateX(2px);
        }

        .zf-context-submenu {
            display: none;
            position: absolute;
            left: calc(100% + 4px);
            top: -4px;
            background: var(--bg-toolbar, rgba(2, 6, 23, 0.96));
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.1));
            border-radius: 12px;
            padding: 6px;
            min-width: 205px;
            box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--glass-border, rgba(255, 255, 255, 0.05));
            flex-direction: column;
            gap: 1.5px;
            z-index: 15001;
            animation: menuFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .zf-context-parent:hover > .zf-context-submenu {
            display: flex;
        }

        .zf-context-open-left .zf-context-submenu {
            left: auto;
            right: calc(100% + 4px);
        }

        .zf-context-divider {
            height: 1px;
            background: var(--border-viewer, rgba(255, 255, 255, 0.08));
            margin: 4px 6px;
        }

        .zf-lang-selector {
            display: flex;
            align-items: center;
            gap: 6px;
            margin: 0 10px;
            background: rgba(255, 255, 255, 0.05);
            padding: 4px 8px;
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .zf-lang-btn {
            cursor: pointer;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0.5;
            transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            filter: grayscale(0.8);
            border: 2px solid transparent;
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        .zf-lang-btn:hover {
            opacity: 0.9;
            filter: grayscale(0);
            transform: scale(1.2) translateY(-1px);
        }

        .zf-lang-btn.active {
            opacity: 1 !important;
            filter: grayscale(0) !important;
            border-color: var(--primary);
            box-shadow: 0 0 12px var(--primary);
            transform: scale(1.1);
        }

        .zf-lang-btn img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* Notifications */

        .zf-notification {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8));
            -webkit-backdrop-filter: blur(16px);
            backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-bottom: 2px solid var(--primary);
            color: #fff;
            padding: 12px 28px;
            border-radius: 50px;
            font-size: 0.9rem;
            font-weight: 500;
            z-index: 20000;
            transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.1);
            opacity: 0;
            pointer-events: none;
        }

        .zf-notification.active {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Loading Overlays (Premium Glassmorphism - Translucent Elite) */
        .zf-loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(2, 6, 23, 0.7); /* Mais translúcido (Slate 950 com 0.7) */
            backdrop-filter: blur(20px) saturate(180%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            display: none; /* Escondido por padrão, ativado via classe .active ou via JS */
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 20000;
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            pointer-events: none;
        }
        
        .zf-loading-overlay.active {
            display: flex;
            opacity: 1;
            pointer-events: auto;
        }

        /* Minimized State for Loading Overlay */
        .zf-loading-overlay.minimized {
            top: auto;
            left: auto;
            bottom: 24px;
            right: 24px;
            width: auto;
            min-width: 220px;
            height: auto;
            padding: 10px 14px;
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.85);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            pointer-events: auto; /* Corrected to prevent click-through inside the bounds */
            cursor: grab;
            touch-action: none;
        }
        
        .zf-loading-overlay.minimized > * {
            pointer-events: auto; /* Enable clicks on the actual mini window content */
        }

        .zf-loading-overlay.minimized .zf-loading-ring-wrapper {
            width: 38px;
            height: 38px;
            margin-bottom: 0;
        }

        .zf-loading-overlay.minimized .zf-loading-pct {
            font-size: 12px;
        }

        .zf-loading-overlay.minimized .zf-pct-symbol {
            font-size: 8px;
        }

        .zf-loading-overlay.minimized .zf-loading-text-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .zf-loading-overlay.minimized .zf-loading-text {
            font-size: 10px;
            text-align: left;
            margin-bottom: 0;
            margin-top: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 220px;
        }

        .zf-loading-overlay.minimized .zf-progress-bar,
        .zf-loading-overlay.minimized .rm-loading-actions {
            display: none !important;
        }

        /* Standard styling for the expand button */
        .rm-expand-loading-btn {
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            padding: 8px;
            display: none;
            transition: color 0.3s;
            pointer-events: auto;
        }
        
        .rm-expand-loading-btn:hover {
            color: #fff;
        }
        
        .zf-loading-overlay.minimized .rm-expand-loading-btn {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .rm-minimized-actions {
            display: none;
            gap: 4px;
        }
        
        .zf-loading-overlay.minimized .rm-minimized-actions {
            display: flex;
        }
        
        .rm-mini-cancel-btn {
            background: none;
            border: none;
            color: #ef4444;
            cursor: pointer;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.3s, background 0.3s;
            pointer-events: auto;
            border-radius: 6px;
        }
        
        .rm-mini-cancel-btn:hover {
            color: #f87171;
            background: rgba(239, 68, 68, 0.1);
        }
        
        /* Layout adjustments for default (non-minimized) text container */
        .zf-loading-text-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .rm-loading-actions {
            display: flex;
            gap: 12px;
            margin-top: 24px;
            z-index: 999999;
        }

        .zf-loading-ring-wrapper {
            position: relative;
            width: 120px;
            height: 120px;
            margin-bottom: 25px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .zf-loading-ring-svg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            transform: rotate(-90deg);
            filter: drop-shadow(0 0 15px rgba(96, 165, 250, 0.6));
        }

        .zf-ring-track {
            fill: none;
            stroke: rgba(255, 255, 255, 0.05); /* Track invisível ou muito sutil */
            stroke-width: 8;
        }

        .zf-ring-fill {
            fill: none;
            stroke: var(--primary);
            stroke-width: 8;
            stroke-linecap: round;
            stroke-dasharray: 326.72; /* 2 * PI * 52 */
            stroke-dashoffset: 326.72;
            transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
        }

        .zf-loading-pct {
            position: relative;
            font-size: 28px;
            font-weight: 800;
            color: #fff;
            font-family: 'Inter', sans-serif;
            text-shadow: 0 0 15px rgba(96, 165, 250, 0.5);
            z-index: 2;
        }

        .zf-pct-symbol {
            font-size: 14px;
            color: var(--primary);
            opacity: 0.8;
            margin-left: 2px;
        }

        .zf-loading-text {
            color: #fff;
            font-family: 'Inter', sans-serif;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 3px;
            text-shadow: 0 0 20px rgba(0,0,0,0.5);
            margin-bottom: 20px;
            text-transform: uppercase;
            animation: pulseText 2s infinite;
        }
        
        @keyframes pulseText {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.6; transform: scale(0.98); }
        }

        .zf-progress-bar {
            width: 300px;
            height: 4px;
            background: rgba(255,255,255,0.05);
            border-radius: 10px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.05);
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }

        .zf-progress-fill {
            width: 0%;
            height: 100%;
            background: linear-gradient(90deg, var(--primary), #818cf8, var(--primary));
            background-size: 200% 100%;
            animation: shimmer 2s infinite linear;
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.6);
            transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        @keyframes shimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }

        .zf-magnifier {
            position: absolute;
            width: 150px;
            height: 150px;
            border-radius: 50%;
            border: 2px solid var(--primary);
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.2);
            pointer-events: none;
            display: none;
            z-index: 1000;
            background-repeat: no-repeat;
            overflow: hidden;
        }

        /* ========================================================== */
        /* 3D VR (VOLUME RENDERING) ISOLATED CONTAINER                */
        /* ========================================================== */
        #zf-vr-container {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: var(--bg-viewer, #000);
            z-index: 9999;
            display: flex;
            flex-direction: column;
            transition: opacity 0.3s ease;
        }

        #zf-vr-topbar {
            height: 50px;
            background: var(--bg-toolbar, #111);
            border-bottom: 1px solid var(--border-viewer, #333);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
        }

        #zf-vr-title {
            color: var(--primary, #60a5fa);
            font-weight: bold;
            font-size: 14px;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #zf-vr-presets {
            display: flex;
            gap: 8px;
        }

        .zf-vr-preset-btn {
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            color: #ddd;
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .zf-vr-preset-btn:hover {
            background: rgba(255,255,255,0.15);
            color: #fff;
        }

        .zf-vr-preset-btn.active {
            background: var(--primary, #2563eb);
            color: #fff;
            border-color: var(--primary, #2563eb);
        }

        #zf-vr-close {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #fca5a5;
            padding: 6px 15px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        #zf-vr-close:hover {
            background: #ef4444;
            color: #fff;
        }

        #zf-vr-canvas {
            flex: 1;
            width: 100%;
            height: 100%;
            background: #000;
            position: relative;
            overflow: hidden;
        }

        #zf-vr-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            color: #60a5fa;
            font-weight: bold;
            font-size: 14px;
            letter-spacing: 2px;
            z-index: 10;
        }

        /* ==========================================
           EXPORT MODAL & PROGRESS BAR (PREMIUM)
           ========================================== */
        .zf-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            animation: fadeIn 0.3s ease;
        }

        .zf-modal-content {
            background: var(--bg-side);
            border: 1px solid var(--border-viewer);
            border-radius: 16px;
            width: 450px;
            padding: 24px;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            animation: slideUp 0.3s ease;
        }

        .zf-modal-title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            color: var(--primary);
        }

        .zf-modal-body {
            font-size: 14px;
            color: var(--text-viewer);
            margin-bottom: 24px;
            line-height: 1.6;
        }

        .zf-export-option {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-viewer);
            padding: 12px;
            border-radius: 12px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .zf-export-option:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: var(--primary);
        }

        .zf-export-option.active {
            background: rgba(96, 165, 250, 0.15);
            border-color: var(--primary);
        }

        .zf-export-option i {
            font-size: 20px;
            color: var(--primary);
        }

        .zf-modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
        }

        .zf-btn-modal {
            padding: 10px 20px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid transparent;
        }

        .zf-btn-cancel {
            background: transparent;
            color: var(--text-muted);
            border-color: var(--border-viewer);
        }

        .zf-btn-confirm {
            background: var(--primary);
            color: white;
            border: none;
        }

        .zf-btn-confirm:hover {
            background: var(--primary-dark);
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
        }

        /* Progress Bar (Global) */
        .zf-export-progress-container {
            margin-top: 20px;
            display: none;
        }

        .zf-export-progress-bg {
            height: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 8px;
        }

        .zf-export-progress-fill {
            height: 100%;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #zf-vr-presets {
            display: flex;
            gap: 8px;
        }

        .zf-vr-preset-btn {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.1);
            color: #ccc;
            padding: 4px 10px;
            border-radius: 15px;
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .zf-vr-preset-btn:hover {
            background: rgba(255,255,255,0.15);
            color: #fff;
        }

        .zf-vr-preset-btn.active {
            background: var(--primary, #2563eb);
            color: #fff;
            border-color: var(--primary, #2563eb);
        }

        #zf-vr-close {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #fca5a5;
            padding: 4px 12px;
            border-radius: 15px;
            font-size: 10px;
            font-weight: 800;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        #zf-vr-close:hover {
            background: #ef4444;
            color: #fff;
        }

        #zf-vr-canvas {
            flex: 1;
            width: 100%;
            height: 100%;
            background: #000;
            position: relative;
            overflow: hidden;
        }

        #zf-vr-canvas.scalpel-active {
            cursor: crosshair !important;
        }

        #zf-vr-scalpel-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 100;
        }

        .zf-vr-tool-group {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .zf-vr-tool-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #ccc;
            padding: 6px 10px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .zf-vr-tool-btn:hover {
            background: rgba(255, 255, 255, 0.15);
            color: #fff;
            border-color: var(--primary);
        }

        .zf-vr-tool-btn.active {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
            box-shadow: 0 0 10px rgba(96, 165, 250, 0.4);
        }

        .zf-vr-separator {
            width: 1px;
            height: 18px;
            background: rgba(255, 255, 255, 0.1);
            margin: 0 5px;
        }

        #zf-vr-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            color: #60a5fa;
            font-weight: bold;
            font-size: 14px;
            letter-spacing: 2px;
            z-index: 10;
        }


        /* VR Flash Effect */
        .zf-vr-flash {
            animation: zf-vr-flash-anim 0.5s ease-out;
            pointer-events: none;
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            background: #fff;
            z-index: 9999;
            opacity: 0;
        }

        @keyframes zf-vr-flash-anim {
            0% { opacity: 0.8; }
            100% { opacity: 0; }
        }

        /* Cursor para Medição 3D */
        .measure-active {
            cursor: crosshair !important;
        }

        .zf-modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            animation: fadeIn 0.3s ease;
        }

        .zf-modal-content {
            background: var(--bg-side);
            border: 1px solid var(--border-viewer);
            border-radius: 16px;
            width: 450px;
            padding: 24px;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            animation: slideUp 0.3s ease;
        }

        .zf-modal-title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            color: var(--primary);
        }

        .zf-modal-body {
            font-size: 14px;
            color: var(--text-viewer);
            margin-bottom: 24px;
            line-height: 1.6;
        }

        .zf-export-option {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-viewer);
            padding: 12px;
            border-radius: 12px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .zf-export-option:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: var(--primary);
        }

        .zf-export-option.active {
            background: rgba(96, 165, 250, 0.15);
            border-color: var(--primary);
        }

        .zf-export-option i {
            font-size: 20px;
            color: var(--primary);
        }

        .zf-modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
        }

        .zf-btn-modal {
            padding: 10px 20px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid transparent;
        }

        .zf-btn-cancel {
            background: transparent;
            color: var(--text-muted);
            border-color: var(--border-viewer);
        }

        .zf-btn-confirm {
            background: var(--primary);
            color: white;
            border: none;
        }

        .zf-btn-confirm:hover {
            background: var(--primary-dark);
            box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
        }

        /* Progress Bar (Global) */
        .zf-export-progress-container {
            margin-top: 20px;
            display: none;
        }

        .zf-export-progress-bg {
            height: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 8px;
        }

        .zf-export-progress-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, var(--primary), #818cf8);
            transition: width 0.1s linear;
        }

        .zf-export-progress-text {
            font-size: 11px;
            color: var(--text-muted);
            text-align: center;
        }

        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        /* ==========================================
           3D VR ADVANCED TOOLS
           ========================================== */
        .zf-vr-tool-group {
            display: flex;
            align-items: center;
            gap: 5px;
            background: rgba(15, 23, 42, 0.7);
            padding: 4px 10px;
            border-radius: 8px;
            border: 1px solid var(--border-viewer);
        }

        .zf-vr-tool-btn {
            background: transparent;
            color: var(--text-muted);
            border: 1px solid transparent;
            border-radius: 4px;
            padding: 6px 12px;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .zf-vr-tool-btn:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.1);
        }

        .zf-vr-tool-btn.active {
            color: var(--primary);
            background: rgba(96, 165, 250, 0.15);
            border-color: rgba(96, 165, 250, 0.3);
        }

        .zf-vr-separator {
            width: 1px;
            height: 20px;
            background: var(--border-viewer);
            margin: 0 4px;
        }

        /* ==========================================
           AUDIO REPORT MODAL (LAUDO GRAVADO)
           ========================================== */
        .zf-audio-backdrop {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
        }

        .zf-audio-backdrop.active {
            opacity: 1;
        }

        .zf-audio-modal {
            position: fixed;
            width: 260px;
            background: color-mix(in srgb, var(--bg-toolbar, rgba(15, 23, 42, 1)) 65%, transparent);
            backdrop-filter: blur(16px);
            border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.12));
            border-radius: 14px;
            box-shadow: 0 16px 40px rgba(0,0,0,0.6);
            display: none;
            flex-direction: column;
            z-index: 10000;
            overflow: hidden;
            color: var(--text-viewer, #fff);
            animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* Modo Pílula Flutuante Compacta durante Gravação */
        .zf-audio-modal.compact-pill {
            width: auto !important;
            max-width: 90vw !important;
            border-radius: 30px !important;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(239, 68, 68, 0.5) !important;
            background: rgba(15, 23, 42, 0.88) !important;
            backdrop-filter: blur(20px) !important;
            cursor: move;
            user-select: none;
            overflow: visible !important;
            opacity: 0.45;
            transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.1s linear, box-shadow 0.3s ease;
        }

        .zf-audio-modal.compact-pill:hover {
            opacity: 1 !important;
            box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(239, 68, 68, 0.8) !important;
        }

        .zf-audio-modal.compact-pill .zf-audio-header {
            display: none !important;
        }

        .zf-audio-modal.compact-pill .zf-audio-body {
            padding: 5px 12px !important;
            flex-direction: row !important;
            align-items: center !important;
            gap: 10px !important;
        }

        .zf-audio-modal.compact-pill #zfScreenPreviewIcon {
            display: none !important;
        }

        .zf-audio-modal.compact-pill .zf-audio-time {
            font-size: 15px !important;
            letter-spacing: 1px !important;
            color: #f8fafc !important;
            line-height: 1 !important;
            font-weight: 700;
        }

        .zf-audio-modal.compact-pill .zf-audio-controls {
            gap: 6px !important;
        }

        .zf-audio-modal.compact-pill .zf-audio-btn {
            width: 32px !important;
            height: 32px !important;
            font-size: 13px !important;
        }

        .zf-audio-modal.compact-pill .zf-audio-btn.primary {
            width: 32px !important;
            height: 32px !important;
            font-size: 13px !important;
            box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5) !important;
        }

        .zf-rec-indicator {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            font-weight: 800;
            color: #ef4444;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }

        .zf-rec-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #ef4444;
            box-shadow: 0 0 8px #ef4444;
        }

        .zf-audio-header {
            background: rgba(0, 0, 0, 0.15);
            padding: 10px 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.05));
            cursor: move;
            font-size: 12px;
            font-weight: 700;
            color: var(--primary, #60a5fa);
        }

        .zf-audio-close {
            background: none;
            border: none;
            color: var(--text-muted, #888);
            cursor: pointer;
            font-size: 13px;
            transition: color 0.2s;
        }

        .zf-audio-close:hover {
            color: var(--danger, #ef4444);
        }

        .zf-audio-body {
            padding: 14px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
        }

        .zf-audio-visualizer {
            width: 100%;
            height: 40px;
            border-radius: 8px;
            background: rgba(0, 0, 0, 0.1);
        }

        .zf-audio-time {
            font-family: 'Consolas', monospace;
            font-size: 22px;
            font-weight: bold;
            color: var(--text-viewer, #e2e8f0);
            letter-spacing: 2px;
        }

        .zf-audio-controls {
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .zf-audio-btn {
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            transition: all 0.2s;
        }

        .zf-audio-btn.primary {
            background: var(--danger, #ef4444);
            width: 48px;
            height: 48px;
            font-size: 20px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
        }

        .zf-audio-btn.primary:hover {
            transform: scale(1.05);
            filter: brightness(1.2);
        }

        .zf-audio-btn.primary.pulsing {
            animation: pulse-record 1.5s infinite;
        }

        @keyframes pulse-record {
            0% { box-shadow: 0 0 0 0 var(--danger, rgba(239, 68, 68, 0.7)); }
            70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
            100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
        }

        .zf-audio-btn.secondary {
            background: var(--primary, #3b82f6);
        }

        .zf-audio-btn.danger {
            background: var(--text-muted, #475569);
            border-radius: 12px;
        }

        .zf-audio-player {
            width: 100%;
            height: 35px;
            border-radius: 8px;
            outline: none;
        }

        .zf-audio-filename {
            width: 100%;
            background: rgba(0,0,0,0.2);
            border: 1px solid var(--border-viewer, #333);
            color: var(--text-viewer, #fff);
            padding: 8px 12px;
            border-radius: 4px;
            font-size: 12px;
            box-sizing: border-box;
            outline: none;
            transition: border-color 0.2s;
        }

        .zf-audio-filename:focus {
            border-color: var(--primary, #60a5fa);
        }

        .zf-audio-actions {
            display: flex;
            flex-direction: column;
            width: 100%;
            gap: 8px;
            margin-top: 5px;
        }

        .zf-audio-action-btn {
            background: rgba(0, 0, 0, 0.15);
            border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
            color: var(--text-viewer, #cbd5e1);
            padding: 10px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: all 0.2s;
        }

        .zf-audio-action-btn:hover {
            background: rgba(0, 0, 0, 0.3);
            color: #fff;
        }

        .zf-audio-action-btn.action-whatsapp:hover {
            border-color: #22c55e;
            color: #22c55e;
        }

        .zf-audio-action-btn.action-email:hover {
            border-color: var(--primary, #3b82f6);
            color: var(--primary, #3b82f6);
        }

        .zf-audio-action-btn.action-danger {
            color: var(--danger, #ef4444);
            justify-content: center;
        }
        
        .zf-audio-action-btn.action-danger:hover {
            background: rgba(239, 68, 68, 0.1);
            border-color: var(--danger, #ef4444);
        }

        .zf-audio-help-panel {
            padding: 20px;
            background: rgba(0,0,0,0.2);
            border-top: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.1));
            animation: slideUp 0.3s ease;
        }

        /* ========== PRINT STYLES (Professional Report & Image) ========== */
        @media print {
            /* Hide all UI elements */
            .zf-sidebar, .zf-thumbnails, .zf-top-toolbar, .zf-footer, .zf-metadata-panel, 
            .zf-measures-panel, .zf-cine-player, .back-button, .premium-fab, 
            .zf-resizer, .zf-tool-grid, .zf-left-sidebar, .zf-right-sidebar,
            .header, .footer-tools, #context-menu, .overlay, .btn, .btn-help,
            button, .ql-toolbar, .zf-notification, #zfCaptureModal .zf-cap-btn,
            #zfCaptureModal .fa-camera, #zfCaptureModal div[style*="text-transform: uppercase"] {
                display: none !important;
            }

            /* Reset body and containers for printing */
            body {
                background: #fff !important;
                color: #000 !important;
                padding: 0 !important;
                margin: 0 !important;
                overflow: visible !important;
                height: auto !important;
            }

            body::before, body::after {
                display: none !important;
            }

            .editor-wrapper, #editor-container, .ql-editor {
                padding: 0 !important;
                margin: 0 !important;
                border: none !important;
                overflow: visible !important;
                background: transparent !important;
                color: #000 !important;
            }

            /* Ensure captured images in modals are printed correctly */
            #zfCaptureImg, #zfCaptureCanvas {
                max-width: 100% !important;
                height: auto !important;
                display: block !important;
                margin: 0 auto !important;
                border: none !important;
                box-shadow: none !important;
            }

            #zfCaptureModal {
                background: #fff !important;
                backdrop-filter: none !important;
                padding: 0 !important;
                justify-content: flex-start !important;
            }

            #zfCaptureModal div {
                max-width: 100% !important;
                gap: 0 !important;
            }

            /* Force background colors and images for logos if needed */
            * {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
            }
        }

/* --- ESTILOS DO BLOQUEIO DA ESTAÇÃO --- */
.zf-btn-lock:not(.zf-btn-header-ingest) {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-muted) !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center !important;
    padding: 0;
}

.zf-btn-lock:not(.zf-btn-header-ingest):hover {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #f59e0b !important;
    color: #f59e0b !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

/* =============================================
   MPR OBLÍQUO — Linhas de Referência Arrastáveis
   ============================================= */

.oblique-ref-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 15;
    pointer-events: none;
}

.oblique-ref-overlay line.oblique-vis-line {
    pointer-events: none;
    stroke-width: 2;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.9));
    transition: stroke-width 0.15s ease;
}

.oblique-ref-overlay .oblique-hitline:hover + line.oblique-vis-line {
    stroke-width: 3.5;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.3));
}

.oblique-ref-overlay circle.oblique-vis-handle {
    pointer-events: none;
    transition: r 0.15s ease, fill-opacity 0.15s ease;
}

.oblique-ref-overlay circle.oblique-hit-handle:hover + circle.oblique-vis-handle {
    r: 8;
    fill-opacity: 1;
}

/* Indicador visual do modo oblíquo ativo no botão */
.zf-tool-btn[data-tool="oblique-mpr"].active {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: #f59e0b !important;
    color: #f59e0b !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4),
                inset 0 0 8px rgba(245, 158, 11, 0.1) !important;
    animation: oblique-pulse 2s ease-in-out infinite;
}

@keyframes oblique-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
    50%      { box-shadow: 0 0 20px rgba(245, 158, 11, 0.7); }
}

        /* AI Settings Modal Premium Styling */
        .ai-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            animation: ai-fade-in 0.3s ease;
        }

        .ai-modal-content {
            background: var(--bg-side);
            width: 450px;
            border-radius: 16px;
            border: 1px solid var(--border-viewer);
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(96, 165, 250, 0.1);
            overflow: hidden;
            animation: ai-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes ai-fade-in { from { opacity: 0; } to { opacity: 1; } }
        @keyframes ai-slide-up { from { transform: translateY(30px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

        .ai-modal-header {
            padding: 20px;
            background: rgba(255, 255, 255, 0.03);
            border-bottom: 1px solid var(--border-viewer);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .ai-modal-header h3 {
            margin: 0;
            font-weight: 600;
            font-size: 16px;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .ai-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 24px;
            cursor: pointer;
            transition: color 0.2s;
        }

        .ai-modal-close:hover { color: #f43f5e; }

        .ai-modal-body {
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .ai-setting-section {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .ai-setting-section label {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .ai-toggle-group {
            display: flex;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 10px;
            padding: 4px;
            border: 1px solid var(--border-viewer);
        }

        .ai-toggle-group button {
            flex: 1;
            padding: 10px;
            border: none;
            background: none;
            color: var(--text-muted);
            font-size: 12px;
            font-weight: 600;
            border-radius: 7px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .ai-toggle-group button.active {
            background: var(--primary);
            color: #fff;
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        }

        .ai-hint {
            font-size: 11px;
            color: var(--text-muted);
            line-height: 1.5;
            margin: 0;
        }

        .ai-input-wrapper {
            position: relative;
            display: flex;
            align-items: center;
        }

        .ai-input-wrapper input {
            width: 100%;
            background: rgba(0, 0, 0, 0.2);
            border: 1px solid var(--border-viewer);
            padding: 12px 14px;
            border-radius: 10px;
            color: #fff;
            font-family: inherit;
            outline: none;
            transition: border-color 0.2s;
        }

        .ai-input-wrapper input:focus {
            border-color: var(--primary);
        }

        .ai-btn-toggle-pass {
            position: absolute;
            right: 12px;
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0;
        }

        .ai-instruction-box {
            background: rgba(96, 165, 250, 0.05);
            border: 1px dashed rgba(96, 165, 250, 0.2);
            border-radius: 12px;
            padding: 16px;
        }

        .ai-instruction-box h4 {
            margin: 0 0 10px 0;
            font-size: 13px;
            color: var(--primary);
        }

        .ai-instruction-box ul {
            margin: 0;
            padding-left: 18px;
            font-size: 11px;
            color: var(--text-muted);
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .ai-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 14px;
            color: var(--primary);
            font-size: 11px;
            text-decoration: none;
            font-weight: 600;
            transition: opacity 0.2s;
        }

        .ai-link:hover { opacity: 0.8; text-decoration: underline; }

        .ai-modal-footer {
            padding: 20px;
            border-top: 1px solid var(--border-viewer);
            display: flex;
            justify-content: flex-end;
        }

        .ai-btn-save {
            background: var(--primary);
            border: none;
            color: #fff;
            padding: 12px 24px;
            border-radius: 10px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }

        .ai-btn-save:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
        }

        /* Dockable Sidebar Drag & Drop Styles */
        .zf-drag-handle {
            width: 100%;
            height: 15px;
            background: rgba(255,255,255,0.05);
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--text-muted);
            cursor: grab;
            border-radius: 4px;
            margin-bottom: 10px;
            transition: all 0.2s;
            flex-shrink: 0;
        }
        .zf-drag-handle:active { cursor: grabbing; }
        .zf-drag-handle:hover {
            background: var(--primary);
            color: #fff;
        }

        /* Estado Fantasma Flutuante */
        .zf-sidebar-ghost {
            position: fixed;
            pointer-events: none;
            z-index: 9999;
            opacity: 0.8;
            box-shadow: 0 10px 40px rgba(0,0,0,0.8);
            transition: none !important;
        }

        /* Dropzones Magnéticos */
        .zf-dropzone {
            position: absolute;
            z-index: 8000;
            transition: all 0.2s ease;
            opacity: 0;
            pointer-events: auto;
        }
        .zf-dropzone.active {
            background: rgba(96, 165, 250, 0.2);
            border: 2px dashed #60a5fa;
            opacity: 1;
            z-index: 9000;
        }
        .zf-dropzone.top { top: 0; left: 0; width: 100%; height: 60px; }
        .zf-dropzone.bottom { bottom: 0; left: 0; width: 100%; height: 60px; }
        .zf-dropzone.left { top: 0; left: 0; width: 60px; height: 100%; }
        .zf-dropzone.right { top: 0; right: 0; width: 60px; height: 100%; }

        /* DOCKING: Top & Bottom Override */
        .zf-sidebar-right.dock-top, .zf-sidebar-right.dock-bottom {
            flex-direction: row;
            height: var(--zf-right-sidebar-height, 120px) !important;
            width: 100% !important;
            min-width: unset;
            max-width: unset;
            min-height: 100px;
            max-height: 500px;
            overflow-x: auto;
            overflow-y: auto;
            padding: 8px 12px;
            /* Se for top, a borda vira border-bottom, senao border-top */
            border-left: none;
        }
        .zf-sidebar-right.dock-top { border-bottom: 1px solid var(--border-viewer); }
        .zf-sidebar-right.dock-bottom { border-top: 1px solid var(--border-viewer); }

        .zf-sidebar-right.dock-top .zf-drag-handle, 
        .zf-sidebar-right.dock-bottom .zf-drag-handle {
            width: 15px;
            height: 100%;
            flex-direction: column;
            margin-bottom: 0;
            margin-right: 15px;
        }
        .zf-sidebar-right.dock-top .zf-drag-handle i,
        .zf-sidebar-right.dock-bottom .zf-drag-handle i {
            transform: rotate(90deg);
        }
        .zf-sidebar-right.dock-top .zf-tool-group,
        .zf-sidebar-right.dock-bottom .zf-tool-group {
            flex: 0 0 auto;
            margin-right: 15px;
            border-right: 1px solid var(--border-viewer);
            padding-right: 15px;
        }
        .zf-sidebar-right.dock-top .zf-tool-grid,
        .zf-sidebar-right.dock-bottom .zf-tool-grid {
            display: flex;
            flex-wrap: nowrap;
            gap: 8px;
            height: auto;
            align-items: center;
        }

        /* Resizer adjustments para Topo/Fundo */
        .zf-resizer.horizontal {
            width: 100%;
            height: 4px;
            cursor: row-resize;
            flex-shrink: 0;
        }
        .zf-resizer.horizontal:hover, .zf-resizer.horizontal.active {
            width: 100%;
            height: 4px;
        }
        .zf-resizer.horizontal::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            top: -4px;
            bottom: -4px;
        }

/* --- Drag & Drop Overlay Styles --- */
#zfDragOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    border: 4px dashed var(--primary);
    margin: 15px;
    border-radius: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: pulseBorder 2s infinite;
}

#zfDragOverlay.active {
    display: flex !important;
    opacity: 1;
}

#zfDragOverlay.comparing {
    border-color: #ef4444;
}

.zf-drag-icon {
    font-size: 80px;
    margin-bottom: 25px;
    color: var(--primary);
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.5));
}

#zfDragOverlay.comparing .zf-drag-icon {
    color: #ef4444;
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.5));
}

.zf-drag-title {
    font-size: 32px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

.zf-drag-subtitle {
    font-size: 16px;
    opacity: 0.7;
    margin-top: 10px;
    font-weight: 300;
}

@keyframes pulseBorder {
    0% { border-color: var(--primary); box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
    50% { border-color: #60a5fa; box-shadow: 0 0 40px 10px rgba(96, 165, 250, 0.2); }
    100% { border-color: var(--primary); box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
}

#zfDragOverlay.comparing {
    animation: pulseBorderRed 2s infinite;
}

@keyframes pulseBorderRed {
    0% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { border-color: #f87171; box-shadow: 0 0 40px 10px rgba(239, 68, 68, 0.2); }
    100% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
}


/* =========================================================
   Config/Settings Dropdown (Engrenagem)
   ========================================================= */

.zf-settings-dropdown {
    position: relative;
    display: inline-block;
    z-index: 10000;
}

.zf-settings-dropdown-options {
    position: absolute;
    top: calc(100% + 10px); /* Mais respiro, não fica colado */
    right: 0;
    background: rgba(10, 15, 26, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 15px;
    display: flex;
    flex-direction: column;
    min-width: 260px;
    max-width: 90vw;
    min-height: 240px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    z-index: 1050;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.85), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

/* Agora abre apenas com esta classe injetada via JS */
.zf-settings-dropdown-options.zf-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.85), 
                0 0 15px rgba(255, 255, 255, 0.03), 
                inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
}

.zf-settings-section-title {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 8px;
    padding-left: 2px;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.zf-settings-section-title i {
    font-size: 10px;
    color: var(--primary);
    opacity: 0.8;
}

.zf-lang-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.zf-lang-btn {
    width: 38px;
    height: 24px;
    flex: 0 0 38px;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zf-lang-btn:hover {
    opacity: 0.85;
    transform: scale(1.08);
}

.zf-lang-btn.active {
    opacity: 1;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.45);
}

.zf-lang-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Botões Unificados do Menu de Configurações */
.zf-settings-btn {
    width: 100%;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-weight: 600;
    font-size: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.zf-settings-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.zf-settings-btn:active {
    transform: translateY(0);
}

/* Cores específicas pontuais para ícones/textos dentro dos botões */
.zf-settings-btn-skin i {
    color: #818cf8; /* Violeta */
}
.zf-settings-btn-skin:hover {
    border-color: rgba(129, 140, 248, 0.25);
    background: rgba(129, 140, 248, 0.06);
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.12);
}

.zf-settings-btn-colors i {
    color: #fbbf24; /* Dourado */
}
.zf-settings-btn-colors:hover {
    border-color: rgba(251, 191, 36, 0.25);
    background: rgba(251, 191, 36, 0.06);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.12);
}

.zf-settings-btn-shortcuts i {
    color: #38bdf8; /* Azul claro */
}
.zf-settings-btn-shortcuts:hover {
    border-color: rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.06);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.12);
}

.zf-settings-btn-update i {
    color: #38bdf8; /* Azul Celeste / Ciano */
}
.zf-settings-btn-update:hover {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.16);
}

.zf-update-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
    animation: pulse-update-badge 2s infinite ease-in-out;
}

@keyframes pulse-update-badge {
    0%, 100% { opacity: 0.9; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.06); }
}

.zf-gear-update-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    border: 1.5px solid #0f172a;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
    animation: pulse-update-badge 2s infinite ease-in-out;
    pointer-events: none;
    z-index: 10;
}

.zf-about-update-btn {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-left: 6px;
}
.zf-about-update-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2);
    color: #ffffff;
}

.zf-settings-btn-about i {
    color: #a855f7; /* Roxo */
}
.zf-settings-btn-about:hover {
    border-color: rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.06);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.12);
}

.zf-settings-footer {
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Switch Slider */
.zf-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 2px 0;
}

.zf-settings-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: #cbd5e1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zf-settings-row-label i {
    font-size: 12px;
    color: var(--primary);
    width: 14px;
    text-align: center;
    opacity: 0.85;
}

.zf-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.zf-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.zf-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
}

.zf-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.zf-switch input:checked + .zf-slider {
    background-color: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.4);
}

.zf-switch input:checked + .zf-slider:before {
    transform: translateX(18px);
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Segmented Control */
.zf-segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 2px;
    width: 100%;
    gap: 2px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.35);
    margin-bottom: 12px;
    box-sizing: border-box;
}

.zf-segment-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 8px;
    font-weight: 600;
    gap: 3px;
    text-transform: uppercase;
}

.zf-segment-btn i {
    font-size: 11px;
    transition: transform 0.2s;
}

.zf-segment-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.03);
}

.zf-segment-btn:hover i {
    transform: scale(1.1);
}

.zf-segment-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}


/* --- Intelligence Focus (Auto-Dimming) --- */
.zf-dimmed .zf-viewer-header, 
.zf-dimmed .zf-thumbnail-bar, 
.zf-dimmed .zf-sidebar-right, 
.zf-dimmed .zf-resizer,
.zf-dimmed .zf-top-toolbar {
    opacity: 0.2 !important;
    pointer-events: none;
    filter: blur(2px) grayscale(0.5);
}

/* Specific Adjustments for Arctic Theme Glass Effect */
body.theme-arctic .zf-thumbnail-bar, 
body.theme-arctic .zf-sidebar-right {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Compliance Watermark */
.viewer-clinical-watermark {
    position: absolute;
    bottom: 8px;
    right: 170px;
    color: rgba(150, 150, 150, 0.4);
    font-size: 10px;
    font-weight: 400;
    pointer-events: none;
    z-index: 50;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    background: transparent;
    padding: 2px 10px;
    border-radius: 4px;
}

/* =========================================================
   Modal da Curva Dinâmica (Wash-in / Wash-out)
   ========================================================= */
.dynamic-curve-modal {
    position: fixed;
    top: 70px;
    right: 320px; /* Afastado da sidebar */
    width: 800px;
    min-width: 520px;
    max-width: 95vw;
    background: var(--bg-side, rgba(20, 20, 25, 0.95));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--primary, #3b82f6);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.7), 0 0 15px rgba(59, 130, 246, 0.2);
    z-index: 9999 !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    resize: both;
    animation: ai-slide-up 0.3s ease-out;
}

/* Melhorar a área de clique para redimensionamento (Resize Handle) */
.dynamic-curve-modal::-webkit-resizer {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><path d="M30 30 L0 30 L30 0 Z" fill="%2360a5fa" opacity="0.8"/><path d="M25 28 L28 25 M20 28 L28 20 M15 28 L28 15" stroke="white" stroke-width="2" stroke-linecap="round"/></svg>') no-repeat bottom right;
    background-size: 30px;
    background-color: rgba(0,0,0,0.5);
    border-radius: 0 0 12px 0;
    cursor: nwse-resize;
}

.dynamic-curve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-viewer, #333);
    cursor: move;
}

.dynamic-curve-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary, #60a5fa);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dynamic-curve-header button {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
}

.dynamic-curve-header button:hover {
    color: #ef4444;
}

/* Botão Maximizar / Restaurar dos Modais Flutuantes */
.btn-modal-maximize {
    background: none !important;
    border: none !important;
    color: var(--text-muted, #cbd5e1);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.btn-modal-maximize:hover {
    color: #60a5fa !important;
    background: rgba(96, 165, 250, 0.1) !important;
}

.btn-modal-maximize:active {
    color: #93c5fd !important;
    transform: scale(0.92);
}

.btn-modal-maximize:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.dynamic-curve-body {
    padding: 16px;
    height: 250px;
    width: 100%;
}

/* CTP Map Selector Active Button */
.ctp-map-btn.active {
    outline: 2px solid rgba(255,255,255,0.6) !important;
    outline-offset: 1px;
    box-shadow: 0 0 8px rgba(255,255,255,0.15);
}

/* CTP Viewport Label Animation */
@keyframes ctpLabelIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* AdBlock Modal (Glassmorphism) */
.adblock-modal-glass {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: adblockFadeIn 0.3s ease-out;
}

.adblock-card {
    background: var(--glass-bg, rgba(15, 23, 42, 0.85));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
}

.adblock-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.adblock-body p {
    color: var(--text-muted, #94a3b8);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.adblock-body b {
    color: var(--text-viewer, #f8fafc);
}

.adblock-highlight {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    padding: 12px;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border-radius: 0 4px 4px 0;
    margin-top: 16px;
}

.adblock-footer {
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

.adblock-btn-close {
    width: 100%;
    max-width: 250px;
}

@keyframes adblockFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ========== WEASIS MODAL (Premium Alerts) ========== */
.weasis-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.weasis-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.weasis-modal-content {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    color: #fff;
    font-family: 'Inter', sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: weasisModalScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.weasis-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

.weasis-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #f8fafc;
}

.weasis-description {
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
}

.weasis-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-weasis-confirm {
    border: none;
    color: #fff;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-weasis-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.btn-weasis-confirm:active {
    transform: translateY(0);
}

@keyframes weasisModalScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Grade Livre do Menu de Contexto */
.zf-context-free-layout-submenu {
    min-width: 140px !important;
    padding: 10px !important;
}
.context-layout-cell {
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.context-layout-cell.hovered {
    background: rgba(96, 165, 250, 0.45) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 6px rgba(96, 165, 250, 0.3);
}

/* Submenu de Contexto para o MIP Single */
.zf-mip-single-context-menu {
    position: fixed;
    z-index: 100000;
    width: 220px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    padding: 12px;
    display: none;
    font-family: 'Inter', 'Outfit', sans-serif;
    color: #e2e8f0;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
    animation: zfMipMenuFadeIn 0.15s ease-out;
    transform-origin: top left;
}

@keyframes zfMipMenuFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.zf-mip-single-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary, #60a5fa);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

.zf-mip-single-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.zf-mip-single-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.zf-mip-single-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary, #60a5fa);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.zf-mip-single-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.zf-mip-single-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary, #60a5fa);
    border: none;
    cursor: pointer;
}

.zf-mip-single-slider::-moz-range-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    border: none;
}

.zf-mip-single-value {
    font-size: 11px;
    font-weight: 600;
    min-width: 55px;
    text-align: right;
    color: #fff;
}

.zf-mip-single-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.zf-mip-single-preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border-radius: 6px;
    padding: 6px 0;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.zf-mip-single-preset-btn:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--primary, #60a5fa);
    color: #fff;
}

.zf-mip-single-preset-btn.active {
    background: var(--primary, #60a5fa);
    border-color: var(--primary, #60a5fa);
    color: #fff;
}

/* =========================================================
   Visual Feedback for Actions
   ========================================================= */

@keyframes flash-viewport-clear {
    0% { filter: brightness(1) sepia(0) hue-rotate(0deg) saturate(1); border-color: transparent; }
    50% { filter: brightness(1.2) sepia(0.8) hue-rotate(310deg) saturate(3); border-color: #ef4444; }
    100% { filter: brightness(1) sepia(0) hue-rotate(0deg) saturate(1); border-color: transparent; }
}

.zf-viewport-clearing {
    animation: flash-viewport-clear 0.3s ease-out;
}

/* =========================================================
   Modal de Subtração RM - Design Premium e Estético
   ========================================================= */
#mrSubtractionModal {
    background: rgba(15, 23, 42, 0.82) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 
                0 0 0 1px rgba(255, 255, 255, 0.05),
                inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    padding-bottom: 20px !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#mrSubtractionModal .dynamic-curve-header {
    background: rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 14px 20px !important;
}

#mrSubtractionModal .dynamic-curve-header span {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

#mrSubtractionModal .dynamic-curve-header button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

#mrSubtractionModal .dynamic-curve-header button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.subtr-cards-container {
    display: flex;
    gap: 12px;
    padding: 16px;
}

.subtr-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subtr-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.subtr-card-icon {
    font-size: 24px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.subtr-card:hover .subtr-card-icon {
    transform: translateY(-2px);
}

.subtr-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 6px;
    font-family: 'Outfit', 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

.subtr-card-desc {
    font-size: 10.5px;
    color: var(--text-muted, #64748b);
    line-height: 1.4;
    margin-bottom: 12px;
}

/* Custom buttons styled premium */
.subtr-btn-select {
    width: 100%;
    padding: 9px 12px !important;
    font-family: 'Inter', sans-serif;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    color: #e2e8f0 !important;
    cursor: pointer;
    transition: all 0.25s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.subtr-btn-select:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}

/* Action button area */
.subtr-action-container {
    padding: 0 16px 12px 16px;
}

.subtr-btn-generate {
    width: 100%;
    padding: 12px !important;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 10px !important;
    border: 1px solid transparent !important;
    background: rgba(255, 255, 255, 0.02) !important;
    color: rgba(255, 255, 255, 0.15) !important;
    cursor: not-allowed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.subtr-btn-generate:not(:disabled) {
    background: linear-gradient(135deg, var(--primary, #60a5fa), #3b82f6) !important;
    color: #fff !important;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.3) !important;
}

.subtr-btn-generate:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.45) !important;
    filter: brightness(1.1);
}

.subtr-btn-generate:not(:disabled):active {
    transform: translateY(1px);
}

/* Footer / Tips */
.subtr-footer-alert {
    margin: 0 16px 8px 16px;
    padding: 10px 14px;
    background: rgba(96, 165, 250, 0.05);
    border: 1px solid rgba(96, 165, 250, 0.1);
    border-radius: 10px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.5;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.subtr-footer-alert i {
    font-size: 14px;
    color: var(--primary, #60a5fa);
    margin-top: 1px;
}

/* Progress bar customization */
#subtrProgressContainer {
    margin: 4px 16px 12px 16px;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 12px !important;
}

#subtrProgressLabel {
    font-family: 'Inter', sans-serif;
    font-size: 10.5px !important;
    font-weight: 600;
    color: var(--text-muted, #94a3b8) !important;
}

#subtrProgressContainer .progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

#subtrProgressBar {
    background: linear-gradient(90deg, var(--primary, #60a5fa), #10b981) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    height: 100%;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Card states - Premium Glowing and Color Feedback */
.subtr-card.waiting {
    border-color: rgba(245, 158, 11, 0.4) !important;
    background: rgba(245, 158, 11, 0.04) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.1) !important;
}

.subtr-card.waiting .subtr-card-icon {
    color: #f59e0b !important;
    animation: pulseIcon 1.5s infinite alternate ease-in-out;
}

.subtr-card.selected {
    border-color: rgba(16, 185, 129, 0.4) !important;
    background: rgba(16, 185, 129, 0.04) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1) !important;
}

.subtr-card.selected .subtr-card-icon {
    color: #10b981 !important;
}

@keyframes pulseIcon {
    0% { opacity: 0.6; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* ==================== CONNECTION STATUS INDICATOR (HEADER) ==================== */
.zf-header-conn-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 10px;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-user-select: none;
    height: 18px;
    box-sizing: border-box;
}

.zf-header-conn-status:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-viewer, #f1f5f9);
}

.zf-header-conn-status .status-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.zf-header-conn-status .status-indicator-dot.checking {
    background: #eab308; /* Yellow */
    box-shadow: 0 0 8px #eab308;
    animation: headerStatusPulse 1.5s infinite ease-in-out;
}

.zf-header-conn-status .status-indicator-dot.online {
    background: #10b981; /* Green */
    box-shadow: 0 0 8px #10b981;
    animation: headerStatusPulse 2s infinite ease-in-out;
}

.zf-header-conn-status .status-indicator-dot.offline {
    background: #ef4444; /* Red */
    box-shadow: 0 0 8px #ef4444;
}

@keyframes headerStatusPulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 0.4; transform: scale(0.9); }
}

#zfPatientInfo {
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#zfPatientInfo:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Transição suave para o _resetMPR e reversão de viewport */
.mpr-reset-fade {
    animation: fadeReset 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeReset {
    0% { opacity: 1; filter: blur(0px) brightness(1); }
    35% { opacity: 0.15; filter: blur(12px) brightness(0.7); }
    65% { opacity: 0.15; filter: blur(12px) brightness(0.7); }
    100% { opacity: 1; filter: blur(0px) brightness(1); }
}

/* ==================================================== */
/* Diálogo de Confirmação Assíncrono (confirmAsync)     */
/* ==================================================== */
.rm-confirm-async-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.rm-confirm-async-dialog {
    background: var(--bg-viewer, #0f172a);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.08);
    min-width: 340px;
    max-width: 460px;
    overflow: hidden;
    color: var(--text-viewer, #f8fafc);
    font-family: 'Inter', -apple-system, sans-serif;
    animation: confirmDialogIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes confirmDialogIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.rm-confirm-async-header {
    background: var(--bg-side, #020617);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-viewer, #1e293b);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent, #facc15);
    user-select: none;
}

.rm-confirm-async-header i {
    font-size: 16px;
    opacity: 0.9;
}

.rm-confirm-async-body {
    padding: 20px 24px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-viewer, #e2e8f0);
    opacity: 0.9;
}

.rm-confirm-async-actions {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.rm-confirm-async-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
    transition: all 0.15s ease;
    font-family: 'Inter', -apple-system, sans-serif;
    letter-spacing: 0.3px;
}

.rm-confirm-async-btn:focus {
    outline: 2px solid var(--primary, #60a5fa);
    outline-offset: 2px;
}

.rm-confirm-async-cancel {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted, #94a3b8);
}
.rm-confirm-async-cancel:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text-viewer, #f8fafc);
}

.rm-confirm-async-ok {
    background: var(--primary, #60a5fa);
    color: #fff;
    border-color: transparent;
}
.rm-confirm-async-ok:hover {
    background: var(--primary-dark, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}
.rm-confirm-async-ok.danger {
    background: var(--danger, #dc2626);
}
.rm-confirm-async-ok.danger:hover {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* =========================================================================
   OCTOPUS NEXUS - LUTs & MAPAS DE CORES MODAL (PALETA INTERATIVA)
   ========================================================================= */

.zf-lut-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 8, 16, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px;
    box-sizing: border-box;
}

.zf-lut-modal-overlay.active {
    opacity: 1;
}

.zf-lut-modal-container {
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(11, 17, 29, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 40px rgba(56, 189, 248, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-viewer, #f1f5f9);
    font-family: inherit;
    box-sizing: border-box;
}

.zf-lut-modal-overlay.active .zf-lut-modal-container {
    transform: scale(1) translateY(0);
}

.zf-lut-modal-header {
    padding: 16px 20px 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.zf-lut-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zf-lut-modal-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(56, 189, 248, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #38bdf8;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
    flex-shrink: 0;
}

.zf-lut-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.zf-lut-modal-count-badge {
    font-size: 11px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 1px 7px;
    border-radius: 12px;
}

.zf-lut-modal-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 400;
}

.zf-lut-modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zf-lut-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    transform: scale(1.05);
}

.zf-lut-modal-toolbar {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.zf-lut-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.zf-lut-search-box i.ph-magnifying-glass {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 14px;
    pointer-events: none;
}

.zf-lut-search-input {
    width: 100%;
    padding: 7px 30px 7px 30px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.zf-lut-search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.zf-lut-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    display: none;
    padding: 2px;
}

.zf-lut-search-clear:hover {
    color: #f8fafc;
}

.zf-lut-category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.zf-lut-cat-pill {
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.zf-lut-cat-pill:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.zf-lut-cat-pill.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.zf-lut-quick-bar {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.zf-lut-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zf-lut-reset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
}

.zf-lut-reset-preview {
    width: 24px;
    height: 10px;
    border-radius: 2px;
    background: linear-gradient(to right, #000 0%, #777 50%, #fff 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.zf-lut-sync-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.zf-lut-sync-toggle input[type="checkbox"] {
    accent-color: #38bdf8;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.zf-lut-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: calc(88vh - 200px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    box-sizing: border-box;
}

.zf-lut-modal-body::-webkit-scrollbar {
    width: 6px;
}

.zf-lut-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

.zf-lut-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.zf-lut-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.zf-lut-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

.zf-lut-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.2);
}

.zf-lut-card.active {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.zf-lut-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.zf-lut-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.15px;
}

.zf-lut-card.active .zf-lut-card-title {
    color: #34d399;
}

.zf-lut-card-tag {
    font-size: 9.5px;
    font-weight: 600;
    color: #64748b;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.zf-lut-card.active .zf-lut-card-tag {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.15);
}

.zf-lut-card-ribbon {
    width: 100%;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.zf-lut-card:hover .zf-lut-card-ribbon {
    transform: scaleY(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.zf-lut-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10.5px;
    color: #64748b;
}

.zf-lut-card-status {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #10b981;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.zf-lut-card.active .zf-lut-card-status {
    opacity: 1;
}

.zf-lut-modal-footer {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    font-size: 11.5px;
    color: #64748b;
}

.zf-lut-modal-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zf-lut-modal-hint i {
    color: #38bdf8;
}

.zf-lut-btn-close-footer {
    padding: 6px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zf-lut-btn-close-footer:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

