/* === 1. CSS Переменные и Общие Стили === */
        :root {
            --bg-color: #05050C; 
            --glass-bg: rgba(10, 10, 30, 0.75); 
            --text-color: #E0FFFF; 
            --secondary-text: #6A7B8C;
            --neon-accent: #00FF99; /* Лаймовый */
            --neon-shadow: 0 0 8px rgba(0, 255, 153, 0.7), 0 0 16px rgba(0, 255, 153, 0.5);
            --neon-shadow-light: 0 0 4px rgba(0, 255, 153, 0.5);
            --font-main: 'Roboto Mono', monospace; 
            --font-pixel: 'Press Start 2P', cursive;
            --danger-color: #ff6347; /* Красный для удаления */
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            font-family: var(--font-main);
            min-height: 100vh;
            text-shadow: 0 0 1px rgba(224, 255, 255, 0.2); 
            overflow-x: hidden; 
            position: relative;
        }

        body::before { /* Grid */
            content: '';
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background-image: linear-gradient(to right, rgba(0, 255, 153, 0.05) 1px, transparent 1px), linear-gradient(to bottom, rgba(0, 255, 153, 0.05) 1px, transparent 1px);
            background-size: 40px 40px;
            opacity: 0.1; 
            z-index: -2; 
            animation: moveGrid 60s linear infinite; 
        }

        /* === 2. Cyber Element (Общий стиль карточек) === */
        .cyber-element {
            background: var(--glass-bg);
            backdrop-filter: blur(10px) brightness(1.1); 
            border-radius: 6px;
            border: 1px solid rgba(0, 255, 153, 0.1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            position: relative; 
            overflow: hidden; 
        }
        
        .cyber-element:hover {
            border-color: var(--neon-accent);
            box-shadow: 0 0 15px rgba(0, 255, 153, 0.5);
            transform: translateY(-2px);
        }
        
        /* === 3. Основной Layout === */
        .app-container {
            display: flex;
            max-width: 1400px;
            margin: 0 auto;
            min-height: 100vh;
            padding-top: 20px;
            padding-bottom: 20px;
            gap: 20px;
        }

        /* --- 3.1. Левая панель (Секции/Папки) --- */
        .sidebar {
            width: 280px;
            flex-shrink: 0;
            padding: 15px 0 15px 10px; 
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            border-right: 1px solid var(--neon-accent);
            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        }

        .section-header {
            font-family: var(--font-pixel);
            font-size: 0.8em;
            color: var(--neon-accent);
            padding: 10px 10px 15px 10px; 
            text-transform: uppercase;
        }

        .section-list a {
            display: block;
            padding: 8px 10px; 
            color: var(--secondary-text);
            text-decoration: none;
            font-size: 1em;
            position: relative;
        }
        
        .section-list a i {
            margin-right: 10px;
            transition: color 0.2s;
        }

        .section-list a:hover {
            color: var(--text-color);
            background: rgba(0, 255, 153, 0.05);
        }

        .section-list a.active {
            color: var(--neon-accent);
            font-weight: 700;
            background: transparent;
            border-top: 1px solid var(--neon-accent);
            border-bottom: 1px solid var(--neon-accent);
            border-left: 3px solid var(--neon-accent); 
            text-shadow: var(--neon-shadow-light);
            padding-left: 10px; 
        }
        
        .section-list a.active::after {
            content: '_'; 
            position: absolute;
            bottom: -2px;
            right: 10px;
            color: var(--neon-accent);
            font-size: 1em;
            animation: blink 1s infinite step-end;
        }

        .add-section-btn {
            display: flex;
            align-items: center;
            padding: 10px 10px; 
            color: var(--secondary-text);
            background: transparent;
            border: none;
            width: 100%;
            text-align: left;
            cursor: pointer;
            font-family: var(--font-main);
            font-size: 0.9em;
            margin-top: 15px; 
        }
        
        .add-section-btn i {
            margin-right: 10px; 
        }

        /* --- 3.2. Основная область (Списки) --- */
        .main-content {
            flex-grow: 1;
            padding: 0 20px;
        }
        
        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 10px;
            margin-bottom: 20px;
            border-bottom: 1px solid var(--secondary-text);
            gap: 12px;
            flex-wrap: nowrap;
        }
        
        .main-header h2 {
            font-family: var(--font-pixel);
            font-size: 1.2em;
            color: var(--neon-accent);
            min-width: 0; /* allows ellipsis on narrow screens */
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1 1 auto;
        }
        
        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            flex: 0 0 auto;
            flex-wrap: nowrap;
            white-space: nowrap;
        }
        
        .action-icon-btn {
            background: transparent;
            border: none;
            color: var(--secondary-text);
            font-size: 1.2em;
            cursor: pointer;
            margin-left: 0;
            padding: 5px;
            flex: 0 0 auto;
        }
        
        .action-icon-btn:hover {
            color: var(--neon-accent);
            text-shadow: var(--neon-shadow-light);
            transform: scale(1.1);
        }

        .action-icon-btn.danger:hover {
            color: var(--danger-color);
            text-shadow: 0 0 8px rgba(255, 99, 71, 0.5);
        }

        /* --- 3.3. Карточки Чек-листов --- */
        .checklist-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }

        .checklist-card {
            padding: 20px;
            cursor: pointer;
            min-height: 120px;
        }
        
        .checklist-card h3 {
            font-size: 1.1em;
            margin-bottom: 5px;
            color: var(--text-color);
        }
        
        .progress-bar {
            height: 5px;
            background: rgba(0, 255, 153, 0.2);
            border-radius: 2px;
            margin-top: 10px;
            overflow: hidden;
        }
        
        .progress-fill {
            height: 100%;
            width: 50%; 
            background: var(--neon-accent);
            box-shadow: var(--neon-shadow-light);
            transition: width 0.5s ease-in-out;
        }
        
        .status-text {
            font-size: 0.8em;
            color: var(--secondary-text);
            text-align: right;
            margin-top: 5px;
        }
        
        /* === 4. Modal (Общие стили модальных окон) === */
        
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(5px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        
        .checklist-modal {
            width: 90%;
            max-width: 600px;
            padding: 30px;
            transform: translateY(-50px);
            opacity: 0;
            background: var(--glass-bg);
            border-radius: 6px;
            border: 1px solid var(--neon-accent); 
            box-shadow: 0 0 25px rgba(0, 255, 153, 0.4);
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(0, 255, 153, 0.4); 
            padding-bottom: 15px;
            /* Отступ для окна просмотра/редактирования */
            margin-bottom: 25px; 
            gap: 12px;
            flex-wrap: nowrap;
        }
        
        /* ИСПРАВЛЕННЫЙ ОТСТУП: для окна создания */
        #creationModalOverlay .modal-header {
             margin-bottom: 25px; 
        }

        .modal-header h3 {
            color: var(--neon-accent);
            font-size: 1.3em;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1 1 auto;
        }
        
        /* --- Элементы списка (Режим просмотра) --- */
        .checklist-item {
            display: flex;
            align-items: center;
            padding: 10px 0;
            cursor: pointer;
            border-bottom: 1px dashed rgba(255, 255, 255, 0.1); 
            font-size: 1em;
        }

        .item-checkbox {
            width: 18px;
            height: 18px;
            border: 2px solid var(--neon-accent);
            border-radius: 4px;
            margin-right: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--bg-color); 
            background: transparent;
            font-size: 12px;
        }
        
        .checklist-item.checked .item-checkbox {
            background: var(--neon-accent);
            border-color: var(--neon-accent);
            box-shadow: var(--neon-shadow-light);
        }

        .checklist-item.checked .item-text {
            text-decoration: line-through;
            color: var(--secondary-text);
            opacity: 0.7;
        }

        /* --- Действия и кнопки --- */
        .modal-actions {
            display: flex;
            justify-content: flex-end;
            margin-top: 20px;
            gap: 10px;
        }
        
        .modal-action-btn {
            padding: 8px 15px;
            background: transparent;
            border: 1px solid var(--secondary-text);
            color: var(--secondary-text);
            cursor: pointer;
            font-size: 0.9em;
            text-transform: uppercase;
        }

        .modal-action-btn:hover {
            transform: translateY(-1px);
        }

        .modal-action-btn.reset {
            border-color: #FFC107;
            color: #FFC107;
        }
        
        .modal-action-btn.primary {
            border-color: var(--neon-accent);
            color: var(--neon-accent);
            box-shadow: var(--neon-shadow-light);
        }

        .modal-action-btn.danger {
            border-color: var(--danger-color);
            color: var(--danger-color);
            box-shadow: 0 0 8px rgba(255, 99, 71, 0.35);
        }
        
        /* --- 4.1. Modal Input Styles (Общие для всех полей ввода в модалках) --- */
        
        .modal-input-group {
            margin-bottom: 20px;
        }
        
        .modal-input-group label {
            display: block;
            color: var(--neon-accent);
            margin-bottom: 12px;
            font-size: 0.9em;
        }
        
        .modal-input-group input[type="text"],
        .modal-content-edit input[type="text"] {
            width: 100%;
            padding: 10px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid var(--neon-accent);
            box-shadow: 0 0 5px rgba(0, 255, 153, 0.2);
            color: var(--text-color);
            font-family: var(--font-main);
            font-size: 1em;
            transition: border-color var(--transition-speed), box-shadow var(--transition-speed), background var(--transition-speed);
        }
        
        .modal-input-group input[type="text"]:focus,
        .modal-content-edit input[type="text"]:focus {
            outline: none;
            border-color: var(--neon-accent);
            box-shadow: 0 0 8px var(--neon-accent);
            background: rgba(0, 255, 153, 0.05);
        }

        .icon-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
            gap: 10px;
        }

        .icon-option {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--secondary-text);
            color: var(--secondary-text);
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .icon-option:hover {
            border-color: var(--neon-accent);
            color: var(--neon-accent);
            box-shadow: var(--neon-shadow-light);
        }

        .icon-option.active {
            border-color: var(--neon-accent);
            color: var(--neon-accent);
            box-shadow: var(--neon-shadow);
        }

        .icon-selection-info {
            margin-top: 10px;
            color: var(--secondary-text);
            font-size: 0.85em;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* --- Completion Animation --- */
        .completion-flash {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 3000;
            pointer-events: none;
            backdrop-filter: blur(2px);
        }

        .completion-flash.active {
            display: flex;
        }

        .completion-card {
            padding: 16px 22px;
            display: flex;
            align-items: center;
            gap: 10px;
            border: 1px solid var(--neon-accent);
            box-shadow: 0 0 16px rgba(0, 255, 153, 0.25);
            animation: minimalFlash 0.8s ease-out forwards;
        }

        .completion-card i {
            color: var(--neon-accent);
            font-size: 1.2em;
            text-shadow: var(--neon-shadow);
        }

        @keyframes minimalFlash {
            0% { transform: translateY(6px); opacity: 0; }
            40% { transform: translateY(0); opacity: 1; }
            100% { transform: translateY(-4px); opacity: 0; }
        }
        
        /* --- 4.2. Элементы для режима редактирования --- */
        .edit-item-row {
            display: flex;
            gap: 10px;
            align-items: center;
            padding: 10px 12px;
            margin-bottom: 0; 
            background: rgba(0, 0, 0, 0.35);
            border: 1px solid rgba(0, 255, 153, 0.15);
            border-radius: 6px;
            box-shadow: 0 0 12px rgba(0, 255, 153, 0.08);
        }

        .edit-item-row.dragging {
            opacity: 0.8;
            border-color: var(--neon-accent);
            box-shadow: 0 0 12px rgba(0, 255, 153, 0.25);
        }

        .edit-item-row .drag-handle {
            width: 38px;
            height: 38px;
            display: grid;
            place-items: center;
            background: transparent;
            border: 1px dashed rgba(0, 255, 153, 0.35);
            color: var(--neon-accent);
            cursor: grab;
            transition: border-color var(--transition-speed), color var(--transition-speed), box-shadow var(--transition-speed);
        }

        .edit-item-row .drag-handle:hover {
            border-color: var(--neon-accent);
            color: #b5ffe3;
            box-shadow: 0 0 10px rgba(0, 255, 153, 0.2);
        }

        .edit-item-row .drag-handle:active {
            cursor: grabbing;
        }

        .edit-item-row input {
            flex-grow: 1;
        }

        .edit-item-row .delete-btn {
            flex-shrink: 0;
            width: 40px;
            height: 40px;
            padding: 0;
            background: transparent;
            border: 1px solid var(--danger-color);
            color: var(--danger-color);
            cursor: pointer;
        }

        .edit-item-row .delete-btn:hover {
            background: rgba(255, 99, 71, 0.1);
        }

        #editChecklistItems {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        /* --- Контейнер добавления нового элемента --- */
        #addItemContainer {
            margin-top: 30px; 
            padding-top: 15px; 
            border-top: 1px dashed rgba(255, 255, 255, 0.1);
        }

        .add-item-input-group {
            display: flex;
            gap: 10px;
        }
        
        .add-item-input-group input {
            flex-grow: 1;
        }

        .add-item-input-group button {
            flex-shrink: 0;
            padding: 10px 15px;
            font-size: 0.9em;
            text-transform: uppercase;
        }
        
        /* --- Скрытие/отображение контента модального окна --- */
        .modal-content-view,
        .modal-content-edit {
            display: none;
        }
        
        .checklist-modal.mode-view .modal-content-view {
            display: block;
        }
        
        .checklist-modal.mode-edit .modal-content-edit {
            display: block;
        }

        /* === 5. Мобильная Адаптация === */
        @media (max-width: 900px) {
            .app-container { flex-direction: column; padding: 10px; gap: 10px; }
            /* ... (мобильные стили) ... */
            .sidebar {
                width: 100%; height: auto; border-right: none;
                border-bottom: 1px solid var(--neon-accent);
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); padding: 0;
            }
            .section-list {
                display: flex; overflow-x: auto;
                white-space: nowrap; padding: 5px 0;
            }
            .section-list a {
                padding: 8px 15px; display: inline-block;
                border-top: none !important; 
                border-bottom: none !important;
                border-left: none !important; 
                margin: 0 5px;
            }
            .section-list a.active {
                border-bottom: 3px solid var(--neon-accent) !important;
                border-left: none !important; 
                background: transparent;
            }
             .section-list a.active::after {
                content: none; 
            }
            .section-header, .add-section-btn { display: none; }
            .main-content { padding: 0; }
            .main-header { gap: 8px; }
            .main-header h2 { font-size: 1em; }
            .header-actions { gap: 8px; }
            .action-icon-btn { font-size: 1.1em; }
            .checklist-grid { grid-template-columns: 1fr; }
            .checklist-modal { width: 95%; padding: 20px; }
            .edit-item-row .delete-btn { width: 35px; height: 35px; } 
        }
        
        /* === Анимации === */
        @keyframes moveGrid { from { background-position: 0 0; } to { background-position: 40px 40px; } }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
        
        .modal-visible .checklist-modal {
            animation: fadeIn 0.4s ease-out forwards;
        }
