    /* CSS Modular - Variáveis para Temas */
    :root {
        /* Light Mode (Off-white) */
        --bg-body: #f4f3ef;
        --bg-surface: #ffffff;
        --bg-surface-hover: #f9f8f6;
        --text-main: #2c2c2a;
        --text-muted: #6b6b66;
        --border-color: #dfddd6;
        --primary: #ff5722; /* Laranja Avermelhado */
        --primary-hover: #e64a19;
        --danger: #c94c4c;
        --danger-hover: #a83d3d;
        --shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
        --shadow-drag: rgba(0, 0, 0, 0.15) 0px 8px 24px;
    }

    [data-theme="dark"] {
        /* Dark Mode */
        --bg-body: #1a1a19;
        --bg-surface: #242422;
        --bg-surface-hover: #2a2a28;
        --text-main: #ececec;
        --text-muted: #a3a3a0;
        --border-color: #383836;
        --primary: #ff7043;
        --primary-hover: #ff8a65;
        --danger: #d46363;
        --danger-hover: #e87b7b;
        --shadow: rgba(0, 0, 0, 0.3) 0px 4px 12px;
        --shadow-drag: rgba(0, 0, 0, 0.5) 0px 8px 24px;
    }

    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body {
        font-family: 'Source Serif 4', serif;
        background-color: var(--bg-body);
        color: var(--text-main);
        transition: background-color 0.3s ease, color 0.3s ease;
        line-height: 1.6;
        padding: 1rem;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    h1, h2, h3, .heading-font {
        font-family: 'Instrument Serif', serif;
        font-weight: 400;
    }

    .container {
        width: 100%;
        max-width: 1200px; /* Aumentado de 800px para 1200px */
    }

    /* Header */
    header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    header h1 {
        font-size: 2.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .theme-toggle {
        background: none;
        border: none;
        color: var(--text-main);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        border-radius: 50%;
        transition: background 0.2s;
    }

    .theme-toggle:hover {
        background-color: var(--border-color);
    }

    /* Toolbar */
    .toolbar {
        display: flex;
        gap: 1rem;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }

    .btn {
        font-family: 'Source Serif 4', serif;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        background-color: var(--bg-surface);
        color: var(--text-main);
        border: 1px solid var(--border-color);
        padding: 0.75rem 1.25rem;
        border-radius: 8px;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.2s ease;
        box-shadow: var(--shadow);
    }

    .btn:hover {
        background-color: var(--bg-surface-hover);
        transform: translateY(-1px);
    }

    .btn-primary {
        background-color: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .btn-primary:hover {
        background-color: var(--primary-hover);
        color: white;
    }

    /* Dropzone */
    .dropzone {
        border: 2px dashed var(--border-color);
        border-radius: 12px;
        padding: 2rem 1rem;
        text-align: center;
        background-color: transparent;
        transition: all 0.3s ease;
        margin-bottom: 2rem;
        cursor: pointer;
    }

    .dropzone.dragover {
        border-color: var(--primary);
        background-color: rgba(255, 87, 34, 0.05);
    }

    .dropzone .material-symbols-outlined {
        font-size: 3rem;
        color: var(--primary);
        margin-bottom: 0.5rem;
    }

    .dropzone h2 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .dropzone p {
        color: var(--text-muted);
    }

    /* Input File (Hidden) */
    #file-input {
        display: none;
    }

    /* Lista de Itens - Grid Layout */
    .item-list {
        list-style: none;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.5rem;
        padding-bottom: 4rem;
    }

    .item-card {
        display: flex;
        flex-direction: column;
        background-color: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        overflow: hidden;
        box-shadow: var(--shadow);
        transition: transform 0.2s, box-shadow 0.2s;
        position: relative;
    }

    .item-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-drag);
    }

    .item-card.sortable-ghost {
        opacity: 0.4;
    }

    .item-card.sortable-drag {
        cursor: grabbing !important;
    }

    .drag-handle {
        position: absolute;
        top: 8px;
        left: 8px;
        cursor: grab;
        color: white;
        background: rgba(0, 0, 0, 0.4);
        border-radius: 4px;
        z-index: 2;
        padding: 2px;
        display: flex;
    }
    .drag-handle:active {
        cursor: grabbing;
    }

    .item-icon {
        width: 100%;
        aspect-ratio: 3/4; /* Estilo de página */
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #e0e0e0;
        overflow: hidden;
        flex-shrink: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .item-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .item-icon .material-symbols-outlined {
        font-size: 4rem;
        color: var(--text-muted);
    }

    .item-details {
        padding: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
    }

.item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-type {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
}

.btn-delete:hover {
    background-color: rgba(201, 76, 76, 0.1);
}

/* Modal Cover and Pages */
dialog {
    border: none;
    border-radius: 12px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    box-shadow: var(--shadow-drag);
    padding: 0;
    width: 95%;
    max-width: 1000px;
    margin: auto;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.form-group-horizontal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.form-group-horizontal label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.select-small {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
}

.preview-title:empty,
.preview-subtitle:empty,
.preview-body:empty {
    display: none !important;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 2rem;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
}

.modal-body {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Inicialmente 2 colunas, muda via JS */
    gap: 1.5rem;
    align-items: start;
}

.modal-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.preview-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-column label {
    font-weight: 600;
    font-size: 0.9rem;
}

.live-preview {
    width: 100%;
    aspect-ratio: 3/4;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 24px;
    color: #000;
    transition: all 0.3s ease;
}

.preview-bg-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
    display: none;
}

.preview-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

/* Estilos de preview para modo Cover */
.live-preview.mode-cover .preview-content {
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Estilos de preview para modo Page */
.live-preview.mode-page .preview-content {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}

.preview-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    word-break: break-word;
}

.preview-subtitle {
    font-size: 0.9rem;
    margin-bottom: 20px;
    word-break: break-word;
}

.preview-body {
    font-size: 0.65rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow: hidden;
}

/* Fontes no seletor */
option[value="Inter"] { font-family: 'Inter', sans-serif; }
option[value="Roboto"] { font-family: 'Roboto', sans-serif; }
option[value="Montserrat"] { font-family: 'Montserrat', sans-serif; }
option[value="Instrument Serif"] { font-family: 'Instrument Serif', serif; }
option[value="Source Serif 4"] { font-family: 'Source Serif 4', serif; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    font-family: 'Source Serif 4', serif;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
}

.form-group textarea {
    resize: none;
    height: 350px;
}

.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

.form-group input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Loading Overlay */
#loading {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    color: white;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Utilitários */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

.mode-switch {
    display: flex;
    background-color: var(--bg-body);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    gap: 4px;
}

.mode-switch input {
    display: none;
}

.mode-switch label {
    flex: 1;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    margin: 0;
}

.mode-switch input:checked + label {
    background-color: var(--primary);
    color: white;
}

.hidden {
    display: none !important;
}
