    .main-content {
        display: flex;
        min-height: 80vh;
        background: var(--bg-card);
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        margin: 20px;
        position: relative;
    }

    .sidebar {
        width: 300px;
        background: var(--bg-body);
        padding: 30px 20px;
        border-right: 1px solid var(--border-color);
        overflow-y: auto;
        flex-shrink: 0;
    }

    .content-area-wrapper {
        flex: 1;
        display: flex;
        overflow: hidden;
    }

    .content-area {
        flex: 1;
        padding: 30px;
        overflow-y: auto;
        min-width: 0;
        /* Prevent flex overflow */
    }

    /* Vista Previa en Tiempo Real */
    .live-preview-container {
        width: 0;
        opacity: 0;
        background: #525659;
        /* Color de fondo tipo visor PDF */
        border-left: 1px solid var(--border-color);
        overflow-y: auto;
        transition: all 0.3s ease;
        display: flex;
        justify-content: center;
        padding: 20px;
    }

    .live-preview-container.active {
        width: 50%;
        opacity: 1;
    }

    .preview-paper {
        background: white;
        width: 100%;
        max-width: 210mm;
        /* A4 width */
        min-height: 297mm;
        /* A4 height */
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
        padding: 40px;
        color: black;
        /* Siempre negro sobre blanco para preview */
        transform-origin: top center;
    }

    /* Ajustes para cuando la preview está activa */
    .content-area-wrapper.preview-active .content-area {
        width: 50%;
    }

    .section-card {
        background: var(--bg-card);
        border: 2px solid var(--border-color);
        border-radius: 10px;
        margin-bottom: 20px;
        transition: all 0.3s ease;
    }

    .section-card.active {
        border-color: var(--primary-color);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    }

    .section-header {
        padding: 20px;
        background: var(--bg-body);
        border-bottom: 1px solid var(--border-color);
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .section-header h3 {
        color: var(--text-primary);
        font-size: 1.3em;
        margin: 0;
    }

    .section-toggle {
        width: 20px;
        height: 20px;
        border: 2px solid var(--primary-color);
        border-radius: 4px;
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .section-toggle.checked {
        background: var(--primary-color);
    }

    .section-toggle.checked::after {
        content: '✓';
        color: white;
        position: absolute;
        top: -2px;
        left: 2px;
        font-size: 14px;
        font-weight: bold;
    }

    .section-content {
        padding: 20px;
        display: none;
    }

    .section-content.show {
        display: block;
    }

    .item-list {
        margin-top: 15px;
    }

    .item {
        background: var(--bg-body);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 10px;
        cursor: move;
        transition: all 0.3s ease;
        position: relative;
    }

    .item:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }

    .item.selected {
        background: rgba(102, 126, 234, 0.1);
        border-color: var(--primary-color);
    }

    .item-checkbox {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 18px;
        height: 18px;
        border: 2px solid var(--primary-color);
        border-radius: 3px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .item-checkbox.checked {
        background: var(--primary-color);
    }

    .item-checkbox.checked::after {
        content: '✓';
        color: white;
        position: absolute;
        top: -3px;
        left: 1px;
        font-size: 12px;
        font-weight: bold;
    }

    .item-title {
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 5px;
        padding-right: 30px;
    }

    .item-subtitle {
        color: var(--text-secondary);
        font-size: 0.9em;
        margin-bottom: 8px;
    }

    .item-description {
        color: var(--text-primary);
        font-size: 0.85em;
        line-height: 1.4;
    }

    .template-controls {
        margin-bottom: 30px;
    }

    .template-controls h3 {
        margin-bottom: 15px;
        color: var(--text-primary);
    }

    .btn-group {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    .modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .modal-content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: var(--bg-card);
        border-radius: 15px;
        padding: 30px;
        max-width: 500px;
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
    }

    .modal-content h2 {
        margin-bottom: 20px;
        color: var(--text-primary);
    }

    .preview-area {
        background: var(--bg-body);
        border-radius: 8px;
        padding: 20px;
        margin-top: 20px;
        max-height: 400px;
        overflow-y: auto;
    }

    .preview-content {
        font-family: 'Courier New', monospace;
        white-space: pre-wrap;
        line-height: 1.5;
        color: var(--text-primary);
    }

    .sortable-placeholder {
        background: var(--border-color);
        border: 2px dashed var(--text-secondary);
        border-radius: 8px;
        height: 60px;
        margin-bottom: 10px;
    }

    @media (max-width: 768px) {
        .main-content {
            flex-direction: column;
            margin: 10px;
        }

        .sidebar {
            width: 100%;
            border-right: none;
            border-bottom: 1px solid #e9ecef;
        }

        .btn-group {
            flex-direction: column;
        }

        .modal-content {
            max-width: 95%;
            padding: 20px;
        }

        /* Mobile Live Preview: Full width toggle */
        .content-area-wrapper.preview-active .content-area {
            display: none;
            /* Hide form when preview is active */
            width: 0;
        }

        .live-preview-container.active {
            width: 100%;
            border-left: none;
        }
    }