/* --- FOLDABLE NEON RADIAL MENU (V2 - DONUT STYLE) --- */
        #foldable-ui-layer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 100;
        }

        .radial-menu {
            position: absolute;
            width: 0;
            height: 0;
            /* Perfekcyjny środek matematyczny */
            pointer-events: visible;
            z-index: 150;
        }

        /* Centralny przycisk zębatki */
        .radial-center {
            position: absolute;
            top: -25px;
            left: -25px;
            /* Offset na równą połowę (50x50) */
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: #111;
            border: 2px solid #ffcc00;
            color: #ffcc00;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            font-size: 22px;
            z-index: 10;
            box-shadow: 0 0 15px rgba(255, 204, 0, 0.4), inset 0 0 10px rgba(255, 204, 0, 0.4);
            transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        /* Reakcja kliknięcia i otwarcia (Obrót i neonowy rozbłysk) */
        .radial-menu.open .radial-center {
            background: linear-gradient(135deg, #ffcc00, #ff6600);
            color: #000;
            border-color: #fff;
            box-shadow: 0 0 30px #ffcc00, 0 0 50px #ff6600, inset 0 0 10px #fff;
            transform: rotate(180deg) scale(1.1);
        }

        /* Przyciemniony, szklany pierścień w tle (Donut) */
        .radial-ring-bg {
            position: absolute;
            top: -115px;
            left: -115px;
            /* Radius 115px */
            width: 230px;
            height: 230px;
            border-radius: 50%;
            background: rgba(15, 15, 15, 0.85);
            border: 2px solid #ff8800;
            box-shadow: 0 0 30px rgba(255, 136, 0, 0.3), inset 0 0 20px rgba(255, 136, 0, 0.2);
            z-index: 1;
            opacity: 0;
            transform: scale(0);
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            backdrop-filter: blur(8px);
        }

        .radial-menu.open .radial-ring-bg {
            opacity: 1;
            transform: scale(1);
        }

        /* Pojedyncze opcje rozwijane wokół środka */
        .radial-item {
            position: absolute;
            top: -32px;
            left: -32px;
            /* Offset (64x64) */
            width: 64px;
            height: 64px;
            border-radius: 50%;
            background: #222;
            border: 1px solid #ffcc00;
            color: #ffcc00;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            z-index: 5;
            font-size: 10px;
            font-weight: bold;
            text-align: center;
            line-height: 1.2;
            box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
            /* Używamy zmiennych CSS do zapamiętania wektora wystrzału */
            --tx: 0px;
            --ty: 0px;
            transform: translate(0, 0) scale(0);
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        .radial-item span {
            font-size: 18px;
            margin-bottom: 2px;
            text-shadow: 0 0 5px rgba(255, 204, 0, 0.5);
        }

        /* Animacja otwierania na zewnątrz */
        .radial-menu.open .radial-item {
            opacity: 1;
            transform: translate(var(--tx), var(--ty)) scale(1);
        }

        /* Ekstremalny rozbłysk po najechaniu myszką */
        .radial-menu.open .radial-item:hover {
            background: linear-gradient(135deg, #ffcc00, #ff6600);
            color: #000;
            border-color: #fff;
            box-shadow: 0 0 20px #ffcc00, 0 0 40px #ff8800;
            transform: translate(var(--tx), var(--ty)) scale(1.2);
            z-index: 20;
        }

        /* Matematyczne ułożenie ikon na idealnym okręgu (Promień: 78px) + Kaskadowe opóźnienia */
        .item-1 {
            --tx: 0px;
            --ty: -78px;
            transition-delay: 0.05s;
        }

        /* Górny (Całość) */
        .item-2 {
            --tx: 67px;
            --ty: -39px;
            transition-delay: 0.10s;
        }

        /* Prawy Górny (Pół) */
        .item-3 {
            --tx: 67px;
            --ty: 39px;
            transition-delay: 0.15s;
        }

        /* Prawy Dolny (Pojed) */
        .item-4 {
            --tx: 0px;
            --ty: 78px;
            transition-delay: 0.20s;
        }

        /* Dolny (Front) */
        .item-5 {
            --tx: -67px;
            --ty: 39px;
            transition-delay: 0.25s;
        }

        /* Lewy Dolny (Tył) */
        .item-6 {
            --tx: -67px;
            --ty: -39px;
            transition-delay: 0.30s;
        }

        /* Lewy Górny (Oba) */
        :root {
            --led-color: #ff0080;
            --led-glow: 0 0 10px rgba(255, 0, 128, 0.6);
            --bg-dark: #121212;
            --panel-bg: #1e1e1e;
            --highlight: #00d2ff;
            --tall-color: #b800ff;
        }

        body {
            margin: 0;
            font-family: 'Segoe UI', sans-serif;
            display: flex;
            height: 100vh;
            background-color: var(--bg-dark);
            color: #fff;
            overflow: hidden;
        }

        .sidebar {
            width: 400px;
            background: var(--panel-bg);
            border-right: 1px solid #333;
            display: flex;
            flex-direction: column;
            padding: 20px;
            box-sizing: border-box;
            z-index: 10;
            overflow-y: auto;
        }

        .sidebar::-webkit-scrollbar {
            width: 6px;
        }

        .sidebar::-webkit-scrollbar-thumb {
            background: #444;
            border-radius: 4px;
        }

        h2 {
            color: var(--led-color);
            margin-top: 0;
            text-shadow: var(--led-glow);
            font-size: 22px;
        }

        h3 {
            font-size: 13px;
            margin-top: 15px;
            border-bottom: 1px solid #444;
            padding-bottom: 5px;
            color: #aaa;
            text-transform: uppercase;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 10px;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            background: #222;
            border: 1px solid #444;
            color: #fff;
            padding: 8px 10px;
            border-radius: 4px;
            box-sizing: border-box;
            font-family: inherit;
            font-size: 13px;
            transition: 0.2s;
        }

        .form-group input:focus,
        .form-group select:focus {
            border-color: var(--highlight);
            outline: none;
            box-shadow: 0 0 5px rgba(0, 210, 255, 0.3);
        }

        .form-group input::placeholder {
            color: #777;
        }

        .btn {
            background: #2a2a2a;
            color: #fff;
            border: 1px solid #444;
            padding: 8px 12px;
            margin-bottom: 5px;
            border-radius: 5px;
            cursor: pointer;
            text-align: left;
            font-size: 13px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: 0.2s;
        }

        .btn:hover {
            border-color: var(--led-color);
            background: rgba(255, 0, 128, 0.1);
        }

        .btn-rotate {
            background: #223344;
            border-color: #335577;
            justify-content: center;
            gap: 10px;
        }

        .btn-acc {
            border-left: 3px solid #ffcc00;
        }

        .btn-action {
            background: #333;
            justify-content: center;
            margin-top: 5px;
            font-weight: bold;
        }

        .btn-3d {
            background: #00d2ff;
            color: #000;
            border-color: #00d2ff;
            margin-top: 15px;
            box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
            font-weight: bold;
            justify-content: center;
            font-size: 16px;
        }

        .btn-3d:hover {
            background: #fff;
            border-color: #fff;
        }

        .btn-pdf {
            background: #ff9900;
            color: #000;
            border-color: #ff9900;
            margin-top: 5px;
            font-weight: bold;
            justify-content: center;
            font-size: 14px;
        }

        .btn-pdf:hover {
            background: #ffaa33;
        }

        .btn-sheets {
            background: #0f9d58;
            color: #fff;
            border-color: #0f9d58;
            margin-top: 5px;
            font-weight: bold;
            justify-content: center;
            font-size: 14px;
        }

        .btn-sheets:hover {
            background: #13b968;
        }

        .finance-panel {
            background: #161616;
            padding: 15px;
            border-radius: 8px;
            margin-top: 10px;
            border: 1px solid #333;
        }

        .input-group {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .input-group input {
            width: 80px;
            background: #222;
            border: 1px solid #444;
            color: var(--led-color);
            padding: 5px;
            border-radius: 4px;
            text-align: center;
            font-weight: bold;
        }

        .currency-row {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
            margin-bottom: 3px;
            color: #bbb;
        }

        .currency-row b {
            color: #fff;
        }

        .bom-container {
            flex-grow: 1;
            min-height: 150px;
            overflow-y: auto;
            margin-top: 10px;
            font-size: 12px;
            color: #ccc;
            background: #000;
            padding: 10px;
            border-radius: 5px;
            border: 1px solid #222;
        }

        .bom-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 3px;
            border-bottom: 1px solid #111;
            padding-bottom: 2px;
        }

        .bom-item.highlight {
            color: var(--highlight);
            font-weight: bold;
        }

        .bom-item.warn {
            color: #ff5555;
        }

        .bom-item.sub-item {
            color: #888;
            padding-left: 10px;
            font-style: italic;
            border: none;
        }

        .total-price {
            font-size: 26px;
            font-weight: bold;
            color: var(--led-color);
            text-align: right;
            margin-top: 10px;
            text-shadow: 0 0 5px rgba(255, 0, 128, 0.4);
        }

        .stage {
            flex-grow: 1;
            position: relative;
            background-image: radial-gradient(#333 1px, transparent 1px);
            background-size: 50px 50px;
            overflow: hidden;
            cursor: grab;
        }

        .stage:active {
            cursor: grabbing;
        }

        .legend {
            position: absolute;
            bottom: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.8);
            padding: 10px;
            border-radius: 5px;
            font-size: 11px;
            color: #ccc;
            border: 1px solid #333;
            line-height: 1.5;
            z-index: 100;
        }

        #drawingLayer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            transform-origin: top left;
            transition: transform 0.05s linear;
            pointer-events: none;
        }

        #drawingLayer>* {
            pointer-events: auto;
        }

        /* Z-index wyższy niż podłoga (1) by ułatwić zaznaczanie */
        .sego-wall {
            position: absolute;
            background-color: rgba(255, 0, 128, 0.05);
            border: 2px solid var(--led-color);
            box-shadow: var(--led-glow);
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 11px;
            font-weight: bold;
            cursor: pointer;
            transition: 0.2s;
            z-index: 5;
        }

        .sego-wall:hover {
            background-color: rgba(255, 0, 128, 0.2);
        }

        .sego-wall.selected {
            border-color: var(--highlight) !important;
            box-shadow: 0 0 15px var(--highlight) !important;
            z-index: 6;
            background-color: rgba(0, 210, 255, 0.15);
        }

        .sego-joint {
            position: absolute;
            width: 10px;
            height: 10px;
            background: #fff;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            z-index: 6;
            cursor: crosshair;
            transition: 0.2s;
            box-shadow: 0 0 5px #fff;
        }

        .sego-joint:hover {
            transform: translate(-50%, -50%) scale(1.5);
            background: #00ff00;
            box-shadow: 0 0 10px #00ff00;
        }

        .sego-accessory {
            position: absolute;
            color: #000;
            font-size: 9px;
            font-weight: bold;
            border-radius: 3px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
            cursor: pointer;
            transition: 0.2s;
        }

        .sego-accessory:hover {
            filter: brightness(1.2);
        }

        .sego-daszek {
            position: absolute;
            background-color: rgba(204, 0, 255, 0.1);
            border: 2px dashed #cc00ff;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 6;
            border-top: 4px solid #cc00ff;
            border-bottom: 12px solid rgba(255, 0, 128, 0.8);
        }

        .sego-daszek.selected {
            border-color: var(--highlight) !important;
            box-shadow: 0 0 15px var(--highlight) !important;
            z-index: 7;
            background-color: rgba(0, 210, 255, 0.15);
        }

        /* Obsługa niewidzialnego mostu dla acc-controls (aby myszka nie gubiła przycisków) */
        .acc-controls {
            display: flex;
            gap: 5px;
            padding: 4px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 4px;
            border: 1px solid #444;
            pointer-events: auto;
        }

        .sego-accessory .acc-controls,
        .sego-daszek .acc-controls,
        .sego-freestanding .acc-controls,
        .sego-suspended .acc-controls {
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            margin-bottom: 3px;
            z-index: 100;
        }

        .sego-accessory .acc-controls::after,
        .sego-daszek .acc-controls::after,
        .sego-freestanding .acc-controls::after,
        .sego-suspended .acc-controls::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            height: 15px;
        }

        .acc-btn {
            font-size: 12px;
            cursor: pointer;
            transition: 0.2s;
            user-select: none;
        }

        .acc-btn:hover {
            transform: scale(1.2);
        }

        .build-cursor {
            position: absolute;
            width: 0;
            height: 0;
            border-top: 10px solid transparent;
            border-bottom: 10px solid transparent;
            border-left: 15px solid #00ff00;
            transform-origin: 0% 50%;
            z-index: 20;
            filter: drop-shadow(0 0 5px #00ff00);
            animation: pulse 1s infinite alternate;
            pointer-events: none;
        }

        @keyframes pulse {
            from {
                opacity: 0.5;
            }

            to {
                opacity: 1;
            }
        }

        /* Zaktualizowany kontener 3D z płynną animacją dopasowaną do lewego panelu */
        #stage3DContainer {
            display: none;
            position: absolute;
            top: 0;
            left: 400px;
            width: calc(100vw - 400px);
            height: 100vh;
            z-index: 200;
            background: #f0f0f0;
            overflow: hidden;
            transition: left 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), width 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        /* Magiczna reguła: Gdy panel ma klasę 'collapsed', kontener 3D rozciąga się na pełny ekran */
        .sidebar.collapsed~#stage3DContainer {
            left: 0;
            width: 100vw;
        }

        /* Wymuszamy, by zawartość 3D płynnie wypełniała zmieniający się kontener */
        #stage3DContainer canvas {
            width: 100% !important;
            height: 100% !important;
        }

        .ui-3d-panel {
            position: absolute;
            top: 20px;
            right: 20px;
            z-index: 201;
            display: flex;
            flex-direction: column;
            gap: 10px;
            align-items: flex-end;
        }

        .close-3d-btn {
            padding: 10px 20px;
            background: #ff5555;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            font-size: 14px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        }

        .close-3d-btn:hover {
            background: #ff2222;
        }

        .ctrl-3d-btn {
            padding: 8px 15px;
            background: #333;
            color: #fff;
            border: 1px solid #555;
            border-radius: 5px;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
        }

        .ctrl-3d-btn:hover {
            background: #444;
            border-color: var(--highlight);
        }

        .ctrl-3d-btn.active {
            background: var(--highlight);
            color: #000;
            border-color: var(--highlight);
        }

        .mouse-hint {
            position: absolute;
            bottom: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.8);
            padding: 15px;
            border-radius: 5px;
            font-size: 13px;
            color: #fff;
            border: 1px solid #444;
            pointer-events: none;
            line-height: 1.6;
        }

        .graphics-panel {
            display: none;
            position: absolute;
            top: 60px;
            left: 420px;
            width: 350px;
            background: #1e1e1e;
            border: 1px solid #444;
            border-radius: 8px;
            z-index: 202;
            padding: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
            color: #fff;
            max-height: 80vh;
            overflow-y: auto;
        }

        .graphics-panel h3 {
            color: var(--highlight);
            margin-top: 0;
        }

        .graphics-item {
            background: #2a2a2a;
            padding: 10px;
            margin-bottom: 8px;
            border-radius: 5px;
            border-left: 3px solid var(--led-color);
            font-size: 12px;
        }

        .graphics-item-title {
            font-weight: bold;
            margin-bottom: 5px;
            color: #ccc;
        }

        .graphics-item-file {
            color: #00d2ff;
            word-break: break-all;
        }

        .btn-guidelines {
            background: #0055ff;
            color: #fff;
            border: none;
            padding: 10px;
            width: 100%;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            margin-top: 10px;
            text-align: center;
            text-decoration: none;
            display: block;
            box-sizing: border-box;
        }

        .btn-guidelines:hover {
            background: #0077ff;
        }

        .settings-panel {
            display: none;
            position: absolute;
            top: 60px;
            right: 20px;
            width: 260px;
            background: rgba(0, 0, 0, 0.85);
            border: 1px solid #444;
            border-radius: 8px;
            z-index: 202;
            padding: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
            color: #fff;
        }

        .settings-panel h3 {
            color: var(--highlight);
            margin-top: 0;
            font-size: 14px;
            margin-bottom: 10px;
            border-bottom: 1px solid #444;
            padding-bottom: 5px;
            padding-right: 20px;
        }

        .settings-row {
            margin-bottom: 12px;
            font-size: 12px;
        }

        .settings-row label {
            display: block;
            margin-bottom: 4px;
            color: #ccc;
        }

        .settings-row input[type=range] {
            width: 100%;
            cursor: pointer;
        }

        .bg-btn-group {
            display: flex;
            gap: 5px;
        }

        .bg-btn {
            flex: 1;
            padding: 5px;
            cursor: pointer;
            border: 1px solid #555;
            border-radius: 4px;
            font-size: 11px;
            font-weight: bold;
            color: #fff;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
            transition: 0.2s;
        }

        .bg-btn:hover {
            filter: brightness(1.2);
        }

        .close-settings-btn {
            position: absolute;
            top: 12px;
            right: 12px;
            cursor: pointer;
            font-size: 14px;
            transition: transform 0.2s;
            user-select: none;
        }

        .close-settings-btn:hover {
            transform: scale(1.2);
        }

        .sego-freestanding {
            position: absolute;
            background-color: rgba(255, 255, 255, 0.5);
            border: 2px solid #ff0080;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ff0080;
            font-size: 10px;
            font-weight: bold;
            cursor: grab;
            z-index: 15;
            box-shadow: 0 0 10px rgba(255, 0, 128, 0.4);
        }

        .sego-freestanding:hover {
            box-shadow: 0 0 15px #00d2ff;
        }

        .sego-freestanding:active {
            cursor: grabbing;
        }

        .sego-suspended {
            position: absolute;
            background-color: rgba(0, 210, 255, 0.1);
            border: 2px dashed #00d2ff;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #00d2ff;
            font-size: 10px;
            font-weight: bold;
            cursor: grab;
            z-index: 20;
            box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
        }

        .sego-suspended:hover {
            box-shadow: 0 0 20px #fff;
        }

        .sego-suspended:active {
            cursor: grabbing;
        }

        /* NOWY KOD DO PODŚWIETLANIA ELEMENTÓW */
        .sego-freestanding.selected,
        .sego-suspended.selected {
            border-color: var(--highlight) !important;
            box-shadow: 0 0 20px var(--highlight) !important;
            z-index: 30;
            background-color: rgba(0, 210, 255, 0.2);
        }

        .floor-dimension {
            position: absolute;
            background: rgba(0, 0, 0, 0.7);
            color: #fff;
            padding: 2px 6px;
            font-size: 10px;
            border-radius: 3px;
            font-weight: bold;
            pointer-events: none;
        }

        .turn-toggle-btn {
            position: absolute;
            min-width: 30px;
            height: 20px;
            padding: 0 4px;
            background: var(--highlight);
            color: #000;
            border-radius: 4px;
            transform: translate(-50%, -50%);
            z-index: 25;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 9px;
            font-weight: bold;
            box-shadow: 0 0 5px rgba(0, 210, 255, 0.5);
            transition: 0.2s;
        }

        .turn-toggle-btn:hover {
            background: #fff;
            transform: translate(-50%, -50%) scale(1.2);
        }

        .studio-light-2d {
            position: absolute;
            width: 26px;
            height: 26px;
            background: rgba(255, 255, 0, 0.1);
            border: 2px dashed #ffcc00;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: grab;
            z-index: 30;
            transform: translate(-50%, -50%);
            font-size: 13px;
            transition: 0.2s;
            box-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
        }

        .studio-light-2d:hover {
            background: rgba(255, 255, 0, 0.4);
            transform: translate(-50%, -50%) scale(1.2);
        }

        .studio-light-2d:active {
            cursor: grabbing;
        }

        /* --- NAKŁADKA LOGOWANIA --- */
        #loginOverlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: var(--bg-dark);
            /* Tło całkowicie czarne - zakrywa edytor, gdy film się jeszcze ładuje */
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        /* Klasa dla naszego wideo w tle */
        .login-video-bg {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            /* Wypełnia cały ekran ucinając nadmiar */
            z-index: 0;
            /* POPRAWKA: Ustawione na 0, aby nie wpadało pod tło */
            filter: blur(0px) brightness(0.5);
            /* Rozmycie i przyciemnienie filmu */
            pointer-events: none;
        }

        .login-box {
            position: relative;
            /* POPRAWKA: Wymagane, aby z-index zadziałał */
            z-index: 1;
            /* POPRAWKA: Formularz wyżej niż wideo */
            background: rgba(30, 30, 30, 0.85);
            padding: 40px;
            border-radius: 8px;
            border: 1px solid #444;
            width: 320px;
            text-align: center;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
        }

        .login-box h2 {
            color: var(--highlight);
            margin-bottom: 20px;
            font-size: 24px;
        }

        .login-box input {
            width: 100%;
            padding: 12px;
            margin-bottom: 15px;
            border-radius: 4px;
            border: 1px solid #555;
            background: #222;
            color: #fff;
            box-sizing: border-box;
            font-size: 14px;
            outline: none;
            transition: 0.2s;
        }

        .login-box input:focus {
            border-color: var(--highlight);
            box-shadow: 0 0 5px rgba(0, 210, 255, 0.3);
        }

        .login-box button {
            width: 100%;
            padding: 12px;
            background: var(--highlight);
            color: #000;
            border: none;
            border-radius: 4px;
            font-weight: bold;
            font-size: 15px;
            cursor: pointer;
            transition: 0.2s;
        }

        .login-box button:hover {
            background: #fff;
        }

        .error-msg {
            color: #ff5555;
            font-size: 13px;
            margin-bottom: 15px;
            display: none;
            font-weight: bold;
        }

        /* --- NAKŁADKA EDYTOR DB (ADMIN) --- */
        #dbEditorOverlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.85);
            z-index: 9998;
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(5px);
        }

        .db-editor-box {
            background: var(--panel-bg);
            width: 650px;
            max-height: 85vh;
            border-radius: 8px;
            border: 1px solid var(--highlight);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 0 30px rgba(0, 210, 255, 0.2);
        }

        .db-header {
            padding: 15px 20px;
            background: #111;
            border-bottom: 1px solid #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .db-header h3 {
            margin: 0;
            color: var(--highlight);
            border: none;
            padding: 0;
            font-size: 18px;
        }

        .db-close-btn {
            color: #888;
            cursor: pointer;
            font-size: 20px;
            transition: 0.2s;
            user-select: none;
        }

        .db-close-btn:hover {
            color: #fff;
            transform: scale(1.2);
        }

        .db-content {
            padding: 15px 20px;
            overflow-y: auto;
            flex-grow: 1;
        }

        .db-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid #2a2a2a;
            transition: 0.2s;
        }

        .db-row:hover {
            background: rgba(255, 255, 255, 0.02);
        }

        .db-row span {
            font-size: 13px;
            color: #ddd;
        }

        .db-row b {
            color: #fff;
        }

        .db-row input {
            width: 90px;
            padding: 6px;
            background: #222;
            border: 1px solid #555;
            color: var(--highlight);
            text-align: right;
            border-radius: 3px;
            font-weight: bold;
            font-size: 14px;
        }

        .db-footer {
            padding: 15px 20px;
            background: #111;
            border-top: 1px solid #333;
            text-align: right;
        }

        .db-save-btn {
            background: #0f9d58;
            color: #fff;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            font-weight: bold;
            cursor: pointer;
            transition: 0.2s;
        }

        .db-save-btn:hover {
            background: #13b968;
        }

        #loadingOverlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: #050505;
            z-index: 9999;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .loading-logo {
            color: var(--led-color);
            font-size: 44px;
            font-weight: bold;
            text-shadow: var(--led-glow);
            margin-bottom: 30px;
            letter-spacing: 2px;
        }

        .loading-bar-container {
            width: 300px;
            height: 8px;
            background: #222;
            border-radius: 4px;
            overflow: hidden;
            border: 1px solid #444;
            box-shadow: inset 0 0 5px #000;
        }

        .loading-bar {
            width: 0%;
            height: 100%;
            background: var(--led-color);
            box-shadow: 0 0 15px var(--led-color);
        }

        .loading-text {
            margin-top: 20px;
            font-size: 15px;
            color: #888;
            font-style: italic;
            letter-spacing: 1px;
        }

        /* Przycisk zgłoś poprawkę */
        /* Menu nadrzędne */
        .fab-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 1001;
            display: flex;
            flex-direction: column-reverse;
            align-items: flex-end;
            gap: 10px;
        }

        .fab-main {
            background: #007bff;
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 30px;
            cursor: pointer;
            font-weight: bold;
            box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
            display: flex;
            align-items: center;
            gap: 8px;
            transition: 0.3s;
        }

        .fab-main:hover {
            background: #0056b3;
            transform: scale(1.05);
        }

        .fab-buttons-row {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .fab-spakuj {
            background: linear-gradient(135deg, #0f9d58, #13b968) !important;
            box-shadow: 0 4px 15px rgba(15, 157, 88, 0.4) !important;
            color: #fff !important;
            transition: all 0.3s ease;
        }

        .fab-spakuj:hover {
            background: linear-gradient(135deg, #13b968, #1de276) !important;
            box-shadow: 0 4px 20px rgba(19, 185, 104, 0.6) !important;
            transform: scale(1.05);
        }

        .fab-spakuj.packed {
            background: linear-gradient(135deg, #e67e22, #f39c12) !important;
            box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4) !important;
        }

        .fab-spakuj.packed:hover {
            background: linear-gradient(135deg, #f39c12, #f1c40f) !important;
            box-shadow: 0 4px 20px rgba(241, 196, 15, 0.6) !important;
        }

        /* Sub-przyciski */
        .fab-subs {
            display: none;
            flex-direction: column;
            gap: 8px;
            align-items: flex-end;
            margin-bottom: 5px;
        }

        .btn-sub {
            border: none;
            padding: 10px 15px;
            border-radius: 20px;
            color: white;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
            transition: 0.2s;
            width: 160px;
        }

        .btn-sub:hover {
            transform: translateX(-5px);
        }

        .btn-report {
            background: #ff0055;
        }

        .btn-check {
            background: #00aaff;
        }

        .btn-changelog {
            background: #ffcc00;
            color: #333;
        }

        /* Style Tabel w Modalach */
        .modal-wide {
            width: 80% !important;
            max-width: 1000px;
            max-height: 80vh;
            overflow-y: auto;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
            font-size: 13px;
            color: #eee;
        }

        .data-table th {
            background: #333;
            padding: 10px;
            text-align: left;
            border-bottom: 2px solid #444;
        }

        .data-table td {
            padding: 10px;
            border-bottom: 1px solid #333;
        }

        /* Color Coding */
        .badge {
            padding: 3px 8px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: bold;
        }

        .prio-Krytyczny {
            background: #ff0000;
            color: white;
        }

        .prio-Wysoki {
            background: #ff6600;
            color: white;
        }

        .prio-Średni {
            background: #ffcc00;
            color: #333;
        }

        .type-Błąd {
            border-left: 4px solid #ff0055;
        }

        .type-Ulepszenie {
            border-left: 4px solid #00ff88;
        }

        /* Modal zgłoszenia */
        #ticketModal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10002;
            align-items: center;
            justify-content: center;
        }

        .ticket-content {
            background: #1a1a1a;
            padding: 25px;
            border-radius: 12px;
            width: 400px;
            border: 1px solid #333;
            color: white;
        }

        .ticket-content h3 {
            margin-top: 0;
            color: #ff0055;
        }

        .ticket-field {
            margin-bottom: 15px;
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .ticket-field label {
            font-size: 12px;
            color: #aaa;
        }

        .ticket-field input,
        .ticket-field select,
        .ticket-field textarea {
            background: #2a2a2a;
            border: 1px solid #444;
            color: white;
            padding: 8px;
            border-radius: 4px;
        }

        .ticket-buttons {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }

        .btn-send {
            background: #ff0055;
            color: white;
            border: none;
            padding: 10px;
            border-radius: 4px;
            flex: 1;
            cursor: pointer;
        }

        .btn-cancel {
            background: #444;
            color: white;
            border: none;
            padding: 10px;
            border-radius: 4px;
            cursor: pointer;
        }

        /* --- EPIC UI: Zwijany pasek 3D (z Neoc-Traliem) --- */
        body {
            perspective: 1500px;
        }

        .sidebar {
            transition: margin-left 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                filter 0.4s ease,
                box-shadow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
            position: relative;
            transform-origin: left center;

            /* Zmienna koloru dla krawędzi i bazowego blasku paska */
            box-shadow: 10px 0 40px var(--warp-color, rgba(255, 0, 128, 0.3));
            border-right: 1px solid var(--warp-color, rgba(255, 0, 128, 0.5));
            will-change: transform, margin-left, box-shadow;
        }

        /* Pseudo-element ::after (Prawdziwy Napęd Warp) */
        .sidebar::after {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background: linear-gradient(90deg, transparent, var(--warp-color, rgba(255, 0, 128, 1)));
            opacity: 0;
            z-index: -1;
            transform-origin: right center;
            filter: blur(15px) brightness(1.8);
            /* Mocne podbicie światła */
            pointer-events: none;
            /* Żeby laser nie blokował kliknięć myszką na ekranie */
        }

        .sidebar.collapsed {
            margin-left: -400px;
            transform: rotateY(-35deg) scale(0.9) translateX(-50px);
            /* USUNIĘTE opacity: 0; - aby ogon komety mógł przetrwać na ekranie! */
            filter: blur(4px);
            box-shadow: 40px 0 100px var(--warp-color, rgba(255, 0, 128, 0.4));
        }

        .sidebar.collapsed::after {
            /* Odpalenie kinowej animacji (2 sekundy) */
            animation: warpDriveBlast 2s forwards;
        }

        /* Osobna reżyseria gasnącej smugi */
        @keyframes warpDriveBlast {
            0% {
                opacity: 0;
                transform: scaleX(1) translateX(0);
            }

            15% {
                /* Szybkie uderzenie lasera od razu po wciśnięciu zamykania */
                opacity: 1;
                transform: scaleX(8) translateX(80px);
            }

            50% {
                /* Utrzymanie twardej smugi przez około sekundę */
                opacity: 0.8;
                transform: scaleX(10) translateX(120px);
            }

            100% {
                /* Płynne, powolne rozmywanie się i gaśnięcie przez kolejną sekundę */
                opacity: 0;
                transform: scaleX(16) translateX(300px);
            }
        }

        /* Aktywny przycisk z trybem "Overdrive" */
        .sidebar-toggle {
            position: fixed;
            top: 50%;
            left: 400px;
            width: 30px;
            height: 60px;
            background: #1e1e1e;
            border: 1px solid rgba(255, 0, 128, 0.7);
            border-left: none;
            border-radius: 0 8px 8px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1000;
            box-shadow: 0 0 15px var(--led-color);
            color: #fff;
            text-shadow: 0 0 8px #fff;
            /* Pełna moc */
            font-size: 16px;
            transition: left 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), background 0.3s, box-shadow 0.3s, transform 0.2s;
            transform: translateY(-50%);
        }

        /* Wygaszony przycisk (Standby) */
        .sidebar-toggle.collapsed {
            left: 0;
            background: #111;
            border-color: #333;
            box-shadow: 0 0 5px rgba(255, 0, 128, 0.2);
            color: var(--led-color);
            text-shadow: none;
        }

        /* Reakcja na hover i klik (potężny rozbłysk) */
        .sidebar-toggle:hover {
            background: #ff0080;
            box-shadow: 0 0 25px #ff0080, 0 0 50px #ff0080;
            color: #fff;
        }

        .sidebar-toggle:active {
            transform: translateY(-50%) scale(0.8);
        }

        /* Błysk wzdłuż krawędzi przy otwieraniu */
        @keyframes powerSurge {
            0% {
                box-shadow: 0 0 100px #fff, inset -10px 0 30px #fff;
                border-right-color: #fff;
            }

            50% {
                box-shadow: 10px 0 50px var(--led-color), inset -5px 0 20px var(--led-color);
            }

            100% {
                box-shadow: 5px 0 30px rgba(255, 0, 128, 0.2);
                border-right-color: rgba(255, 0, 128, 0.5);
            }
        }

        .sidebar.surge {
            animation: powerSurge 0.6s ease-out;
        }

        /* Naprawa przycisku - stałe pozycjonowanie na ekranie, by nie chował się wewnątrz panelu */
        .sidebar-toggle {
            position: fixed;
            top: 50%;
            left: 400px;
            width: 30px;
            height: 60px;
            background: #1e1e1e;
            border: 1px solid #333;
            border-left: none;
            border-radius: 0 8px 8px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1000;
            box-shadow: 2px 0 10px var(--led-glow);
            color: var(--led-color);
            font-size: 16px;
            transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
            transform: translateY(-50%);
        }

        .sidebar-toggle.collapsed {
            left: 0;
        }

        .sidebar-toggle:hover {
            background: #2a2a2a;
            box-shadow: 4px 0 15px var(--led-glow);
        }

        /* --- EPIC UI: Akordeony (Kategorie) --- */
        .category-header {
            font-size: 13px;
            margin-top: 15px;
            border-bottom: 1px solid #444;
            padding-bottom: 5px;
            color: #aaa;
            text-transform: uppercase;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: color 0.4s, border-color 0.4s, text-shadow 0.4s;
            user-select: none;
        }

        /* Świecący nagłówek przy najechaniu i gdy kategoria jest otwarta (klasa active) */
        .category-header:hover,
        .category-header.active {
            color: var(--highlight);
            border-bottom-color: var(--highlight);
            text-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
        }

        .category-content {
            max-height: 1000px;
            overflow: hidden;
            /* Płynne wyłanianie się z blura, zmiana przezroczystości i zjazd w dół */
            transition: max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
            opacity: 1;
            transform: translateY(0) scale(1);
            filter: blur(0);
            padding-top: 10px;
        }

        .category-content.collapsed {
            max-height: 0;
            opacity: 0;
            transform: translateY(-15px) scale(0.98);
            /* Cofa się lekko w głąb i do góry */
            filter: blur(6px);
            /* Cyberpunkowe rozmycie przy chowaniu */
            padding-top: 0;
        }

        .cat-arrow {
            transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), color 0.3s, text-shadow 0.3s;
            font-size: 10px;
            display: inline-block;
            color: var(--highlight);
            text-shadow: 0 0 8px var(--highlight);
        }

        /* Zgaszona, zrotowana strzałka */
        .cat-arrow.collapsed {
            transform: rotate(-90deg);
            color: #555;
            text-shadow: none;
        }

        /* --- NOWY UI: Pływające przyciski Lewy Dół --- */
        .fab-container-left {
            position: absolute;
            bottom: 20px;
            left: 20px;
            z-index: 1001;
            display: flex;
            gap: 10px;
        }

        /* Magiczne nadpisanie wbudowanych stylów brzydkiego przycisku AR */
        #ARButton {
            position: static !important;
            transform: none !important;
            margin: 0 !important;
            background: #ffcc00 !important;
            color: #000 !important;
            box-shadow: 0 4px 15px rgba(255, 204, 0, 0.4) !important;
            border: none !important;
            padding: 12px 20px !important;
            border-radius: 30px !important;
            font-weight: bold !important;
            font-family: inherit !important;
            height: auto !important;
            width: auto !important;
            opacity: 1 !important;
            display: flex !important;
            align-items: center !important;
            transition: 0.3s !important;
        }

        #ARButton:hover {
            background: #ffaa00 !important;
            transform: scale(1.05) !important;
        }

        /* --- NEON FLASH EFFECT --- */
        @keyframes categoryNeonFlash {
            0% {
                background: rgba(255, 0, 128, 0);
                box-shadow: 0 0 0 rgba(255, 0, 128, 0);
                color: #aaa;
            }

            20% {
                background: rgba(255, 0, 128, 0.6);
                box-shadow: 0 0 30px #ff0080, inset 0 0 20px #fff;
                color: #fff;
            }

            100% {
                background: rgba(255, 0, 128, 0);
                box-shadow: 0 0 0 rgba(255, 0, 128, 0);
            }
        }

        .category-flash {
            animation: categoryNeonFlash 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }

        /* ========================================= */
        /* --- MOTYW FOLDABLE DLA PANELU BOCZNEGO --- */
        /* ========================================= */
        .sidebar.foldable-theme {
            /* Ciemne tło z głębokim, żółto-złotym tintem (zastępuje standardowe czarne) */
            background: linear-gradient(180deg, rgba(20, 18, 10, 0.98) 0%, rgba(45, 35, 0, 0.95) 100%) !important;
            border-right: 1px solid #ffcc00 !important;

            /* Zastępujemy różowy power surge neonowym żółto-pomarańczowym oddechem */
            animation: foldablePowerSurge 3s infinite alternate !important;
        }

        @keyframes foldablePowerSurge {
            0% {
                box-shadow: 2px 0 10px rgba(255, 204, 0, 0.1), inset -2px 0 15px rgba(255, 204, 0, 0.05);
                border-right-color: rgba(255, 204, 0, 0.3) !important;
            }

            100% {
                box-shadow: 4px 0 25px rgba(255, 170, 0, 0.5), inset -4px 0 25px rgba(255, 170, 0, 0.2);
                border-right-color: rgba(255, 204, 0, 1) !important;
            }
        }

        /* --- EKRAN AWARII SILNIKA --- */
        #crash-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(15, 15, 20, 0.95);
            z-index: 99999;
            display: flex;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(5px);
        }

        .crash-modal {
            background: #2a2a30;
            padding: 40px;
            border-radius: 12px;
            text-align: center;
            max-width: 500px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            border: 1px solid #444;
            color: #fff;
            font-family: sans-serif;
        }

        .crash-btn {
            background: #007bff;
            color: white;
            border: none;
            padding: 15px 30px;
            font-size: 16px;
            font-weight: bold;
            border-radius: 8px;
            margin-top: 20px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .crash-btn:hover {
            background: #0056b3;
        }

        /* --- PANEL DPD: Sprawdzanie dostępności usług --- */
        .dpd-panel {
            margin-top: 15px;
            padding: 12px;
            background: linear-gradient(135deg, #1a0a0a 0%, #1e1212 100%);
            border: 1px solid #cc0000;
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(204, 0, 0, 0.15), inset 0 0 20px rgba(204, 0, 0, 0.05);
        }

        .dpd-panel-title {
            font-size: 13px;
            font-weight: bold;
            color: #ff3333;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 6px;
            text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
        }

        .dpd-input-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .dpd-input-row label {
            font-size: 11px;
            color: #aaa;
            min-width: 65px;
            flex-shrink: 0;
        }

        .dpd-input-row input {
            flex: 1;
            background: #1a1a1a;
            border: 1px solid #cc0000;
            color: #fff;
            padding: 6px 8px;
            border-radius: 4px;
            font-size: 13px;
            font-weight: bold;
            letter-spacing: 1px;
            text-align: center;
            font-family: 'Consolas', monospace;
            transition: 0.2s;
        }

        .dpd-input-row input:focus {
            border-color: #ff4444;
            box-shadow: 0 0 8px rgba(255, 68, 68, 0.4);
            outline: none;
        }

        .dpd-check-btn {
            width: 100%;
            padding: 9px;
            background: linear-gradient(135deg, #cc0000, #990000);
            color: #fff;
            border: 1px solid #ff3333;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            font-size: 12px;
            transition: all 0.3s;
            box-shadow: 0 2px 10px rgba(204, 0, 0, 0.3);
            margin-top: 4px;
        }

        .dpd-check-btn:hover {
            background: linear-gradient(135deg, #ee0000, #bb0000);
            box-shadow: 0 4px 20px rgba(255, 0, 0, 0.5);
            transform: translateY(-1px);
        }

        .dpd-check-btn:active {
            transform: translateY(0);
        }

        .dpd-check-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .dpd-results {
            margin-top: 10px;
            display: none;
        }

        .dpd-service-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 7px 10px;
            margin-bottom: 4px;
            background: #111;
            border-radius: 4px;
            border-left: 3px solid #333;
            font-size: 12px;
            transition: all 0.3s;
        }

        .dpd-service-row.available {
            border-left-color: #00ff88;
            background: rgba(0, 255, 136, 0.05);
        }

        .dpd-service-row.unavailable {
            border-left-color: #ff3333;
            background: rgba(255, 51, 51, 0.05);
        }

        .dpd-service-name {
            color: #ddd;
            font-weight: bold;
        }

        .dpd-service-status {
            font-weight: bold;
            font-size: 11px;
        }

        .dpd-service-row.available .dpd-service-status {
            color: #00ff88;
            text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
        }

        .dpd-service-row.unavailable .dpd-service-status {
            color: #ff5555;
        }

        .dpd-error {
            color: #ff5555;
            font-size: 11px;
            margin-top: 8px;
            padding: 8px;
            background: rgba(255, 0, 0, 0.1);
            border-radius: 4px;
            border: 1px solid rgba(255, 0, 0, 0.2);
            display: none;
        }

        .dpd-spinner {
            display: inline-block;
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: dpd-spin 0.6s linear infinite;
            margin-right: 6px;
            vertical-align: middle;
        }

        @keyframes dpd-spin {
            to { transform: rotate(360deg); }
        }

        .dpd-all-services {
            margin-top: 8px;
            font-size: 10px;
            color: #666;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease;
        }

        .dpd-all-services.expanded {
            max-height: 300px;
            overflow-y: auto;
        }

        .dpd-toggle-all {
            font-size: 10px;
            color: #666;
            cursor: pointer;
            text-align: center;
            margin-top: 6px;
            transition: color 0.2s;
        }

        .dpd-toggle-all:hover {
            color: #ff3333;
        }

        /* === KASETON CONFIGURATOR MODAL === */
        #kasetonModal {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 10000;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(12px);
            animation: kasetonFadeIn 0.35s ease-out;
        }
        @keyframes kasetonFadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        .kaseton-modal-inner {
            width: 520px;
            max-height: 85vh;
            overflow-y: auto;
            background: #0d0d0d;
            border: 1px solid var(--kaseton-neon, #00e5ff);
            border-radius: 14px;
            box-shadow:
                0 0 30px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.25)),
                0 0 80px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.08)),
                inset 0 0 60px rgba(0, 0, 0, 0.6);
            padding: 30px 28px 24px;
            position: relative;
            animation: kasetonSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
            transition: border-color 0.5s, box-shadow 0.5s;
        }
        @keyframes kasetonSlideUp {
            from { transform: translateY(40px) scale(0.96); opacity: 0; }
            to { transform: translateY(0) scale(1); opacity: 1; }
        }
        .kaseton-modal-inner::-webkit-scrollbar { width: 5px; }
        .kaseton-modal-inner::-webkit-scrollbar-thumb {
            background: var(--kaseton-neon, #00e5ff);
            border-radius: 10px;
        }
        .kaseton-modal-inner::-webkit-scrollbar-track { background: #111; }

        .kaseton-title {
            font-size: 20px;
            font-weight: 800;
            text-align: center;
            color: var(--kaseton-neon, #00e5ff);
            text-shadow: 0 0 20px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.5));
            margin-bottom: 22px;
            letter-spacing: 2px;
            text-transform: uppercase;
            transition: color 0.5s, text-shadow 0.5s;
        }
        .kaseton-close {
            position: absolute;
            top: 12px; right: 16px;
            font-size: 22px;
            color: #666;
            cursor: pointer;
            transition: 0.25s;
            z-index: 10;
        }
        .kaseton-close:hover {
            color: #ff3355;
            text-shadow: 0 0 12px rgba(255, 51, 85, 0.6);
            transform: scale(1.2);
        }

        .kaseton-section {
            margin-bottom: 16px;
        }
        .kaseton-label {
            font-size: 11px;
            color: #888;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .kaseton-label .kaseton-badge {
            font-size: 9px;
            background: var(--kaseton-neon, #00e5ff);
            color: #000;
            padding: 1px 6px;
            border-radius: 3px;
            font-weight: 700;
            transition: background 0.5s;
        }

        /* Select & Input  — neon-styled */
        .kaseton-select,
        .kaseton-input {
            width: 100%;
            background: #111;
            border: 1px solid #333;
            color: #eee;
            padding: 10px 12px;
            border-radius: 6px;
            font-size: 13px;
            font-family: 'Segoe UI', sans-serif;
            box-sizing: border-box;
            transition: border-color 0.3s, box-shadow 0.3s;
            appearance: none;
            -webkit-appearance: none;
        }
        .kaseton-select {
            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='%23888'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 32px;
            cursor: pointer;
        }
        .kaseton-select:focus,
        .kaseton-input:focus {
            outline: none;
            border-color: var(--kaseton-neon, #00e5ff);
            box-shadow: 0 0 12px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.3));
        }
        .kaseton-input::placeholder {
            color: #555;
        }
        .kaseton-input:invalid {
            border-color: #ff3355;
        }
        .kaseton-dim-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }
        .kaseton-unit {
            font-size: 10px;
            color: #555;
            margin-top: 3px;
        }

        /* Afterglow pulse on select open */
        .kaseton-select.afterglow {
            animation: afterglowPulse 0.6s ease-out;
        }
        @keyframes afterglowPulse {
            0% { box-shadow: 0 0 0px var(--kaseton-neon, #00e5ff); }
            30% { box-shadow: 0 0 25px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.5)), 0 0 50px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.2)); }
            100% { box-shadow: 0 0 0px transparent; }
        }

        /* Conditional fields fade in */
        .kaseton-conditional {
            overflow: hidden;
            max-height: 0;
            opacity: 0;
            transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
            margin-bottom: 0;
        }
        .kaseton-conditional.visible {
            max-height: 200px;
            opacity: 1;
            margin-bottom: 16px;
        }

        /* Bottom action button */
        .kaseton-submit {
            width: 100%;
            padding: 13px;
            border: 1px solid var(--kaseton-neon, #00e5ff);
            background: linear-gradient(135deg, rgba(0,229,255,0.12), rgba(0,229,255,0.03));
            color: var(--kaseton-neon, #00e5ff);
            font-size: 15px;
            font-weight: 700;
            border-radius: 8px;
            cursor: pointer;
            letter-spacing: 1px;
            text-transform: uppercase;
            transition: all 0.3s;
            margin-top: 10px;
            text-shadow: 0 0 8px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.4));
        }
        .kaseton-submit:hover {
            background: var(--kaseton-neon, #00e5ff);
            color: #000;
            box-shadow: 0 0 25px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.5)), 0 0 60px var(--kaseton-neon-alpha, rgba(0, 229, 255, 0.2));
            text-shadow: none;
        }

        /* System type indicator dot */
        .kaseton-system-dot {
            display: inline-block;
            width: 8px; height: 8px;
            border-radius: 50%;
            background: var(--kaseton-neon, #00e5ff);
            box-shadow: 0 0 8px var(--kaseton-neon, #00e5ff);
            margin-right: 6px;
            transition: background 0.5s, box-shadow 0.5s;
        }

        /* Separator line */
        .kaseton-separator {
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--kaseton-neon-alpha, rgba(0,229,255,0.3)), transparent);
            margin: 18px 0;
            transition: background 0.5s;
        }

/* ═══════════════════════════════════════
   BLUEPRINT LEGEND PANEL
   ═══════════════════════════════════════ */
#blueprintLegend {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 310px;
    max-height: calc(100vh - 120px);
    background: rgba(4, 14, 32, 0.92);
    border: 1px solid rgba(0, 200, 255, 0.35);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,200,255,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 5000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    animation: blPanelIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes blPanelIn {
    from { opacity: 0; transform: translateX(30px) scale(0.97); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
.bl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid rgba(0, 200, 255, 0.18);
    background: rgba(0, 160, 220, 0.08);
    flex-shrink: 0;
}
.bl-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #00cfff;
    text-transform: uppercase;
}
.bl-close {
    background: none;
    border: 1px solid rgba(0,200,255,0.3);
    color: #00cfff;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1;
    transition: all 0.15s;
}
.bl-close:hover { background: rgba(0,200,255,0.15); }

.bl-dims {
    padding: 10px 16px 8px;
    border-bottom: 1px solid rgba(0,200,255,0.1);
    flex-shrink: 0;
}
.bl-dim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}
.bl-dim-label {
    font-size: 11px;
    color: rgba(150,210,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.bl-dim-value {
    font-size: 15px;
    font-weight: 700;
    color: #00e5ff;
    letter-spacing: 0.02em;
}

.bl-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,200,255,0.25), transparent);
    flex-shrink: 0;
}

.bl-list {
    overflow-y: auto;
    padding: 10px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.bl-list::-webkit-scrollbar { width: 4px; }
.bl-list::-webkit-scrollbar-track { background: transparent; }
.bl-list::-webkit-scrollbar-thumb { background: rgba(0,200,255,0.25); border-radius: 2px; }

.bl-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 7px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.bl-item:hover { background: rgba(0,200,255,0.07); }
.bl-badge {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #000;
    margin-top: 1px;
}
.bl-item-text {
    flex: 1;
}
.bl-item-name {
    font-size: 11px;
    font-weight: 600;
    color: #e0f4ff;
    line-height: 1.3;
}
.bl-item-desc {
    font-size: 10px;
    color: rgba(140,190,220,0.6);
    margin-top: 2px;
    line-height: 1.3;
}

/* --- INTRANET BOM MODAL & TABLE STYLES --- */
.intranet-bom-box {
    background: #18191f;
    border: 1px solid var(--highlight);
    border-radius: 16px;
    width: 1100px;
    max-width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 210, 255, 0.25);
    overflow: hidden;
    animation: modalAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    color: #f5f6fa;
}

.intranet-bom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #111216;
    border-bottom: 1px solid #282a36;
}

.intranet-bom-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.intranet-bom-table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #282a36;
    border-radius: 8px;
    background: #111216;
}

.intranet-bom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.intranet-bom-table th {
    position: sticky;
    top: 0;
    background: #1e2029;
    color: #8f95b2;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #282a36;
    z-index: 10;
}

.intranet-bom-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #20222a;
    color: #e2e4f0;
    vertical-align: middle;
}

.intranet-bom-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.intranet-bom-table tr.parent-row {
    background: rgba(0, 210, 255, 0.06);
    border-left: 4px solid var(--highlight);
}

.intranet-bom-table tr.parent-row:hover {
    background: rgba(0, 210, 255, 0.1);
}

.intranet-bom-table tr.child-row td:first-child {
    padding-left: 24px;
    color: #b0b5d0;
}

.intranet-bom-table tr.manual-row {
    background: rgba(156, 39, 176, 0.04);
}

.intranet-bom-table tr.manual-row:hover {
    background: rgba(156, 39, 176, 0.08);
}

.intranet-bom-table input,
.intranet-bom-table textarea,
.intranet-bom-table select {
    width: 100%;
    background: #20222a;
    border: 1px solid #3c4052;
    border-radius: 6px;
    color: #fff;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.intranet-bom-table input:focus,
.intranet-bom-table textarea:focus,
.intranet-bom-table select:focus {
    border-color: var(--highlight);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.25);
    background: #242731;
}

.intranet-bom-table input.row-qty {
    text-align: center;
}

.intranet-bom-table input.row-price {
    text-align: right;
    font-weight: bold;
    color: #2a75d3;
}

.intranet-bom-table select.row-vat {
    text-align: center;
}

.intranet-bom-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #111216;
    border-top: 1px solid #282a36;
}

.btn-intranet-submit {
    background: #0f9d58;
    color: #fff;
    border: 1px solid #0f9d58;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(15, 157, 88, 0.3);
}

.btn-intranet-submit:hover {
    background: #13b968;
    border-color: #13b968;
    box-shadow: 0 4px 15px rgba(19, 185, 104, 0.4);
    transform: translateY(-1px);
}

.btn-intranet-cancel {
    background: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-intranet-cancel:hover {
    background: #444;
    border-color: #555;
}

.btn-row-del {
    background: none;
    border: none;
    color: #ff5555;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-row-del:hover {
    background: rgba(255, 85, 85, 0.15);
}

/* Drag-and-drop support for the Intranet BOM table */
.intranet-bom-table tr[draggable="true"] {
    cursor: grab;
    user-select: none;
}

.intranet-bom-table tr[draggable="true"]:active {
    cursor: grabbing;
}

.intranet-bom-table tr.dragging {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.05);
}

.intranet-bom-table tr.drag-over {
    background: rgba(0, 229, 255, 0.15) !important;
    outline: 2px solid var(--highlight, #00d2ff);
    outline-offset: -2px;
}