:root {
    --primary: #505BDA;
    --primary-dark: #2A2C6E;
    --primary-light: #7BC9F5;
    --primary-soft: #f0f2ff;
    --accent: #00F9FF;
    --bg-body: #f5f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: #2A2C6E;
    --border-color: #dde1ea;
    --text-main: #333333;
    --text-muted: #6c757d;
    --accent-primary: #505BDA;
    --accent-hover: #2A2C6E;
    --accent-success: #28a745;
    --accent-success-hover: #1e7e34;
    --text-light: #ffffff;
    --shadow-sm: 0 1px 2px rgba(42, 44, 110, 0.08);
    --shadow-md: 0 10px 30px rgba(42, 44, 110, 0.1);
    --shadow-card: 0 20px 40px rgba(80, 91, 218, 0.12);
    --shadow-btn: 0 8px 20px rgba(80, 91, 218, 0.3);
    --shadow-btn-success: 0 8px 20px rgba(40, 167, 69, 0.25);
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-heading: 'DM Sans', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
}

body {
    background: linear-gradient(180deg, #f5f6fa 0%, #eef2ff 100%);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(42, 44, 110, 0.25);
    z-index: 20;
    flex-shrink: 0;
}

.logo-area {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-logo {
    height: 48px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.step-nav { padding: 24px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
    padding: 12px 16px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: none;
    display: flex; align-items: center; gap: 10px;
}
.nav-item i { width: 16px; text-align: center; font-size: 14px;}
.nav-item:hover { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 700;
}

.nav-item.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.nav-lock-icon {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.85;
}

.sidebar-footer {
    padding: 16px 12px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: auto;
}

.nav-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 999px;
    color: #ffb4b4;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-logout i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.nav-logout:hover {
    background: rgba(217, 83, 79, 0.35);
    color: #ffffff;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-body);
    isolation: isolate;
}

.main-content .ct-swal-container {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 100 !important;
}

.main-content .swal2-backdrop-show {
    background: rgba(15, 23, 42, 0.45) !important;
}

.top-header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    z-index: 5;
}
.top-header h1 { font-family: var(--font-heading); font-size: 28px; margin-bottom: 8px; font-weight: 700; color: var(--primary-dark); }
.top-header p { color: var(--text-muted); font-size: 15px;}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}
.content-area::-webkit-scrollbar { width: 8px; }
.content-area::-webkit-scrollbar-thumb { background: #b8c0e0; border-radius: 4px; }

.step-view { display: none; animation: fadeIn 0.4s ease forwards; }
.step-view.active-view { display: block; }
@keyframes fadeIn { from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: translateY(0); } }

.upload-zone {
    border: 2px dashed #c5cce8;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow-md); }
.upload-icon { font-size: 48px; color: #94a3b8; margin-bottom: 20px; transition: color 0.3s ease;}
.upload-zone:hover .upload-icon { color: var(--primary); }
.upload-zone h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; color: var(--primary-dark);}
.upload-zone p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px;}
.hidden-input { display: none; }

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: var(--text-light);
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    box-shadow: 0 12px 24px rgba(80, 91, 218, 0.35);
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: var(--text-light);
    box-shadow: var(--shadow-btn-success);
}
.btn-success:hover {
    background: linear-gradient(135deg, #34ce57, #28a745);
    box-shadow: 0 12px 24px rgba(40, 167, 69, 0.35);
    transform: translateY(-1px);
}
.btn-danger {
    background: linear-gradient(135deg, #d9534f, #c9302c);
    color: var(--text-light);
    box-shadow: 0 8px 20px rgba(217, 83, 79, 0.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #e06666, #d9534f);
    box-shadow: 0 12px 24px rgba(217, 83, 79, 0.35);
    transform: translateY(-1px);
}
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px;}

.data-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
}
.data-preview h3 { font-family: var(--font-heading); font-size: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; color: var(--primary-dark);}
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 20px;}
.form-group { display: flex; flex-direction: column; gap: 8px; }
.full-w { grid-column: 1 / -1; margin-bottom: 20px;}
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 600;}
.sleek-input {
    background: #f5f6fa;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}
.sleek-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(80, 91, 218, 0.15); background: #ffffff; }
textarea.sleek-input { resize: vertical; }
.rows-3 { min-height: 80px; }
.rows-5 { min-height: 120px; }
.w-100 { width: 100%; }

.actions-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    gap: 16px;
}
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-0 { margin-bottom: 0px !important; }
.flex-grow { flex-grow: 1; }
.d-inline-block { display: inline-block; }

.hidden { display: none !important; }
.text-accent { color: var(--accent-primary); }
.text-center { text-align: center; }
.text-left { text-align: left; }

.generator-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
}
.panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px;}
.panel-header i { color: var(--primary); font-size: 24px;}
.panel-header h3 { font-family: var(--font-heading); font-size: 22px; color: var(--primary-dark);}
.generator-panel p { color: var(--text-muted); margin-bottom: 20px; font-size: 15px;}

.progress-bar-container { background: #dde1ea; height: 8px; border-radius: 4px; overflow: hidden; width: 100%;}
.progress-bar { background: linear-gradient(90deg, var(--accent), var(--primary), var(--primary-dark)); height: 100%; transition: width 0.5s ease;}
#progress-text { font-size: 13px; color: var(--text-muted); font-weight: 500;}

.themes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.theme-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}
.theme-card:hover { border-color: #cbd5e1; transform: translateY(-4px); box-shadow: var(--shadow-card);}
.t-header { display: flex; justify-content: space-between; align-items: flex-start;}
.t-badge { background: var(--primary-soft); padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--primary-dark); letter-spacing: 0.5px;}
.t-title { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--primary-dark);}

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 100; opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.show { display: flex; opacity: 1;}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%; max-width: 650px;
    padding: 32px; position: relative;
    box-shadow: 0 24px 48px rgba(0,0,0,0.1);
    transform: scale(0.95); transition: transform 0.3s;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.modal-content h2 { margin-bottom: 24px; font-family: var(--font-heading); font-size: 24px; color: var(--primary-dark);}

.eval-block { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin-top: 16px; box-shadow: var(--shadow-sm);}
.eval-block h4 { margin-bottom: 8px; color: #1e293b;}

.eval-mode-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.eval-mode-header h4 {
    margin: 0 0 6px;
    color: #1e293b;
    font-size: 16px;
}

.eval-mode-header p {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.eval-mode-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.eval-mode-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.eval-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.eval-mode-option.is-active,
.eval-mode-option:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.eval-mode-title {
    font-weight: 700;
    color: #1e293b;
}

.eval-mode-detail {
    font-size: 13px;
    color: #64748b;
}

.eval-mode-summary {
    margin: 16px 0 0;
    font-size: 13px;
    color: #475569;
}

.export-divider {
    width: min(400px, 100%);
    height: 1px;
    margin: 28px auto 20px;
    background: #e2e8f0;
}

.export-reset-note {
    max-width: 400px;
    margin: 12px auto 0;
    font-size: 13px;
    color: #64748b;
}

.step-reset-bar {
    margin-top: 40px;
    padding-bottom: 24px;
    text-align: center;
}

.step-reset-bar .export-divider {
    margin-bottom: 24px;
}

/* ===== Login (CargaTutor style) ===== */
.auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #eef2ff, #f8f9ff);
}

.auth-body form {
    width: min(420px, 100%);
    margin: 0;
}

.auth-page {
    width: 100%;
}

.auth-shell {
    animation: fadeIn 0.5s ease forwards;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-radius: 18px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 10px 30px rgba(42, 44, 110, 0.2);
}

.auth-brand-logo {
    height: 56px;
    width: auto;
    max-width: 100%;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.auth-brand-icon {
    height: 56px;
    width: 56px;
    margin: 0 auto 0.75rem;
    border-radius: 12px;
    object-fit: contain;
}

.auth-brand-fallback {
    font-size: 2.5rem;
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.auth-brand h1 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: #ffffff;
    font-family: var(--font-heading);
}

.auth-brand p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.92rem;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 1.75rem;
    border: 2px solid transparent;
    background-image:
        linear-gradient(white, white),
        linear-gradient(135deg, #00F9FF, #7BC9F5, #505BDA, #2A2C6E);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: var(--shadow-card);
}

.auth-card h2 {
    font-size: 1.25rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
}

.auth-card-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

.auth-card label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0.75rem 0 0.35rem;
}

.auth-alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #ffe5e5;
    color: #b30000;
    font-size: 0.9rem;
    border: 1px solid #f5c2c2;
}

.auth-submit {
    margin-top: 1.25rem;
}

.auth-note,
.auth-footer-note {
    color: #94a3b8;
    font-size: 12px;
    margin-top: 16px;
    text-align: center;
}

.auth-footer-note {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 20px;
}

.auth-footer-note code {
    font-size: 11px;
}

.usage-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-soft), #ffffff);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.usage-summary-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.usage-summary-value {
    font-size: 32px;
    color: var(--primary-dark);
    line-height: 1;
}

.usage-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.usage-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.usage-history-toolbar h4 {
    margin: 0;
    color: var(--primary-dark);
}

.usage-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.usage-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.usage-item-index {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 4px 8px;
    border-radius: 999px;
}

.usage-item-date {
    font-size: 12px;
    color: var(--text-muted);
}

.usage-item-title {
    margin: 0 0 10px;
    color: var(--primary-dark);
    font-size: 18px;
}

.usage-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.usage-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.usage-loading,
.usage-empty,
.usage-error {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
}

.usage-error {
    color: #b30000;
    background: #ffe5e5;
    border: 1px solid #f5c2c2;
    border-radius: 12px;
}

.multimedia-worker-status {
    padding: 14px 18px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 14px;
}

.multimedia-worker-ok { color: #15803d; }
.multimedia-worker-warn { color: #b45309; }
.multimedia-worker-error { color: #b30000; }

.multimedia-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.multimedia-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.multimedia-card h4 {
    margin: 8px 0;
    font-size: 15px;
    color: var(--primary-dark);
}

.multimedia-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.multimedia-phase {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.multimedia-downloads {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.multimedia-error {
    font-size: 12px;
    color: #b30000;
    margin: 0 0 8px;
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--primary-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ct-swal-popup {
    font-family: var(--font-body) !important;
    border-radius: 20px !important;
    padding: 8px !important;
}

.ct-swal-title {
    color: var(--primary-dark) !important;
    font-size: 1.35rem !important;
}

.ct-swal-text {
    color: var(--text-muted) !important;
    font-size: 0.95rem !important;
}

.ct-swal-btn {
    border-radius: 10px !important;
    font-weight: 700 !important;
    padding: 0.65rem 1.2rem !important;
}

.ct-swal-btn-primary {
    box-shadow: 0 8px 20px rgba(80, 91, 218, 0.25) !important;
}

.ct-swal-btn-danger {
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.2) !important;
}