/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    color: #2d3748;
}

#root {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100vh; /* fallback */
    height: 100dvh;
    overflow: hidden;
}

/* ── TopBar ─────────────────────────────────────────────────────── */
.app-topbar {
    background: #2b6cb0;
    color: #fff;
    padding: 0 16px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    flex-shrink: 0;
    z-index: 100;
}

.app-topbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .02em;
    flex: 1;
}

.app-topbar-brand-logo {
    height: 32px;
    width: auto;
    flex: none;
    object-fit: contain;
    margin-right: auto;
}

.app-topbar-logout {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color .15s, background .15s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .app-topbar-logout:hover {
        color: #fff;
        background: rgba(255,255,255,.12);
        transform: scale(1.1);
    }

.app-topbar-profile {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color .15s, background .15s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .app-topbar-profile:hover {
        color: #fff;
        background: rgba(255,255,255,.12);
        transform: scale(1.1);
    }

/* ── Profile Modal ──────────────────────────────────────────────── */
.profile-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.profile-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: min(420px, 96vw);
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    background: #2b6cb0;
    color: #fff;
}

.profile-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-modal-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

    .profile-modal-close:hover {
        color: #fff;
        background: rgba(255,255,255,.15);
    }

.profile-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-modal-label {
    font-size: .82rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-modal-input,
.profile-modal-select {
    border: 1.5px solid #cbd5e0;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: .95rem;
    color: #2d3748;
    outline: none;
    transition: border-color .15s;
    background: #f7fafc;
}

    .profile-modal-input:focus,
    .profile-modal-select:focus {
        border-color: #2b6cb0;
        background: #fff;
    }

.profile-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.profile-modal-subscriptions {
    background: transparent;
    border: 1.5px solid #9ae6b4;
    color: #276749;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: .92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    transition: background .15s, border-color .15s;
}

    .profile-modal-subscriptions:hover:not(:disabled) {
        background: #f0fff4;
        border-color: #68d391;
    }

.profile-modal-save {
    background: #2b6cb0;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px 20px;
    border-radius: 7px;
    font-size: .92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, opacity .15s;
}

    .profile-modal-save:hover:not(:disabled) {
        background: #2c5282;
    }

    .profile-modal-save:disabled,
    .profile-modal-subscriptions:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

@media (max-width: 600px) {
    .profile-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-modal-subscriptions {
        margin-right: 0;
        justify-content: center;
    }

    .profile-modal-save {
        justify-content: center;
    }
}

/* ── Profile avatar ─────────────────────────────────────────────── */
.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 4px;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
}

.profile-avatar-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #cbd5e0;
    background: #e2e8f0;
    display: block;
}

.profile-avatar-uploading {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2b6cb0;
    font-size: 1.2rem;
}

.profile-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.profile-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1.5px solid #cbd5e0;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: .86rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
}

    .profile-avatar-btn:hover:not(:disabled) {
        border-color: #2b6cb0;
        color: #2b6cb0;
        background: #ebf8ff;
    }

    .profile-avatar-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.profile-avatar-hint {
    font-size: .76rem;
    color: #a0aec0;
}

.profile-avatar-error {
    font-size: .78rem;
    color: #e53e3e;
}

@media (max-width: 600px) {
    .profile-avatar-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ── Profile language picker ────────────────────────────────────── */
.profile-lang-picker {
    position: relative;
}

.profile-lang-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #cbd5e0;
    border-radius: 7px;
    background: #f7fafc;
    color: #2d3748;
    font-size: .95rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: left;
}

    .profile-lang-selected:focus,
    .profile-lang-selected:hover:not(:disabled) {
        border-color: #2b6cb0;
        background: #fff;
    }

    .profile-lang-selected:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.profile-lang-flag {
    width: 22px !important;
    height: 15px !important;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,.1);
    overflow: hidden;
}

.profile-lang-chevron {
    margin-left: auto;
    font-size: .75rem;
    color: #718096;
    transition: transform .15s;
}

    .profile-lang-chevron.open {
        transform: rotate(180deg);
    }

.profile-lang-dropdown {
    background: #fff;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    list-style: none;
    padding: 4px;
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
}

.profile-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: .93rem;
    cursor: pointer;
    transition: background .12s;
    color: #2d3748;
}

    .profile-lang-option:hover {
        background: #ebf8ff;
    }

    .profile-lang-option.selected {
        background: #ebf8ff;
        color: #2b6cb0;
        font-weight: 600;
    }

/* ── Profile highlighters ───────────────────────────────────────── */
.profile-highlighters-loading {
    color: #718096;
    font-size: 1rem;
    padding: 4px 0;
}

.profile-highlighters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-highlighter-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-highlighter-preview {
    flex: 1;
    min-width: 0;
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 6px;
    border-radius: 3px;
}

.profile-highlighter-preview-clickable {
    cursor: pointer;
    outline: 2px solid transparent;
    transition: outline-color .15s;
}

    .profile-highlighter-preview-clickable:hover {
        outline-color: rgba(0,0,0,.25);
    }

.profile-highlighter-name {
    flex: 1;
    min-width: 0;
    border: 1.5px solid #cbd5e0;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: .9rem;
    color: #2d3748;
    background: #f7fafc;
    outline: none;
    transition: border-color .15s;
}

    .profile-highlighter-name:focus {
        border-color: #2b6cb0;
        background: #fff;
    }

    .profile-highlighter-name:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.profile-highlighter-remove {
    flex-shrink: 0;
    width: 32px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid #fed7d7;
    border-radius: 7px;
    color: #c53030;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.profile-highlighter-public {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    font-size: .8rem;
    color: #4a5568;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

    .profile-highlighter-public input[type="checkbox"] {
        width: 15px;
        height: 15px;
        cursor: pointer;
        accent-color: #2b6cb0;
    }


.profile-highlighter-remove:hover:not(:disabled) {
    background: #fff5f5;
    border-color: #fc8181;
}

.profile-highlighter-remove:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.profile-highlighter-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1.5px dashed #cbd5e0;
    border-radius: 7px;
    padding: 7px 12px;
    font-size: .88rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    width: 100%;
    justify-content: center;
    margin-top: 2px;
}

    .profile-highlighter-add:hover:not(:disabled) {
        border-color: #2b6cb0;
        color: #2b6cb0;
        background: #ebf8ff;
    }

    .profile-highlighter-add:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.profile-highlighter-picker {
    width: 100%;
    box-sizing: border-box;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px;
    overflow: hidden;
}

@media (max-width: 600px) {
    .profile-highlighter-row {
        flex-wrap: wrap;
    }

    .profile-highlighter-preview {
        width: 100%;
        flex: none;
    }

    .profile-highlighter-name {
        flex: 1;
    }
}

.app-topbar-dashboard {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color .15s, background .15s, transform .15s;
}

    .app-topbar-dashboard:hover {
        color: #fff;
        background: rgba(255,255,255,.12);
        transform: scale(1.1);
    }

/* ── BottomBar ──────────────────────────────────────────────────── */
.app-bottombar {
    background: #2b6cb0;
    color: #fff;
    box-shadow: 0 -2px 6px rgba(0,0,0,.15);
    z-index: 100;
}

.app-bottombar-recent {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.bottombar-recent-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
    white-space: nowrap;
    flex-shrink: 0;
}

.bottombar-recent-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.bottombar-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    border: none;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity .15s;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

    .bottombar-recent-chip span {
        white-space: nowrap;
    }

/* En móvil: limitar ancho del chip y truncar con ellipsis */
@media (max-width: 600px) {
    .bottombar-recent-label {
        width: 100%;
    }

    .bottombar-recent-chip {
        max-width: calc(100vw - 38px);
        overflow: hidden;
    }

        .bottombar-recent-chip span {
            overflow: hidden;
            text-overflow: ellipsis;
        }

    /* En móvil ocultar ancestors, mostrar solo exam + leaf */
    .bottombar-chip-desktop-only {
        display: none;
    }
}

@media (min-width: 601px) {
    .bottombar-chip-mobile-only {
        display: none;
    }
}

.bottombar-chip-exam {
    font-weight: 700;
    opacity: .9;
    flex-shrink: 0;
}

.bottombar-chip-group {
    opacity: .75;
    font-weight: 600;
    flex-shrink: 0;
}

.bottombar-chip-ancestor {
    opacity: .65;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    display: inline-block;
}

.bottombar-chip-leaf {
    font-weight: 700;
    flex-shrink: 0;
}

.bottombar-chip-sep {
    opacity: .45;
    font-size: .72rem;
}

.bottombar-recent-chip.syllabus {
    background: rgba(235,248,255,.18);
    color: #bee3f8;
}

    .bottombar-recent-chip.syllabus:hover {
        background: rgba(235,248,255,.32);
    }

.bottombar-recent-chip.test {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.bottombar-chip-test-label {
    font-weight: 500;
    opacity: .6;
    font-size: .72rem;
    letter-spacing: .03em;
}

.bottombar-recent-chip.test:hover {
    background: rgba(255,255,255,.22);
}

/* ── Main content area ──────────────────────────────────────────── */
.app-main {
    overflow: hidden;
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
}

/* ── Scrollable left column ─────────────────────────────────────── */
.index-content-col {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

/* ── Background SVG (desktop only) ─────────────────────────────── */
@media (min-width: 769px) {
    .index-content-col {
        background: linear-gradient(rgba(245,246,250,0.97), rgba(245,246,250,0.97)), url('/img/background.png') center top / cover no-repeat;
    }
}

/* ── Index greeting ─────────────────────────────────────────────── */
.index-greeting {
    padding: 20px 20px 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d3748;
}

/* ── Shared section wrapper ─────────────────────────────────────── */
.index-section {
    padding: 10px 20px;
}

.index-section-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #718096;
    margin-bottom: 12px;
}

/* ── Exam cards grid ────────────────────────────────────────────── */
.exam-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.exam-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px solid transparent;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}

.exam-card-clickable {
    cursor: pointer;
    user-select: none;
}

    .exam-card-clickable:hover {
        border-color: #3182ce;
        box-shadow: 0 6px 18px rgba(49,130,206,.18);
        transform: translateY(-3px);
    }

.exam-card-name {
    font-size: .95rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
}

.exam-card-scope {
    font-size: .78rem;
    color: #718096;
    margin-top: -6px;
}

.exam-card-call {
    font-size: .78rem;
    color: #718096;
}

/* ── Progress bar ───────────────────────────────────────────────── */
.exam-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
}

.exam-progress-label {
    font-size: .75rem;
    color: #4a5568;
    display: flex;
    justify-content: space-between;
}

.exam-progress-bar-bg {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.exam-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3182ce, #63b3ed);
    border-radius: 99px;
    transition: width .4s ease;
}

/* ── Exam card action button ────────────────────────────────────── */
.exam-card-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #2b6cb0;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
    text-decoration: none;
    margin-top: auto;
}

    .exam-card-btn:hover {
        background: #2c5282;
        color: #fff;
    }

.exam-card-btn-upgrade {
    box-shadow: 0 2px 6px rgba(56,161,105,.3);
}

    .exam-card-btn-upgrade:hover {
        background: linear-gradient(135deg, #22543d, #276749);
        color: #fff;
        box-shadow: 0 3px 10px rgba(56,161,105,.4);
    }

/* ── Add exam row ───────────────────────────────────────────────── */
.exam-add-row {
    margin-top: 10px;
}

.exam-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #ebf8ff;
    color: #2b6cb0;
    border: 1.5px dashed #63b3ed;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

    .exam-add-btn:hover {
        background: #bee3f8;
        border-color: #3182ce;
    }

/* ── Available exams panel ──────────────────────────────────────── */
.avail-nav-row {
    margin-bottom: 12px;
}

.avail-back-btn {
    background: #ebf8ff;
    border: 1.5px solid #bee3f8;
    color: #2b6cb0;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    padding: 9px 18px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s, border-color .15s;
}

    .avail-back-btn:hover {
        background: #bee3f8;
        border-color: #90cdf4;
        color: #2c5282;
    }

.avail-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.avail-category-tile {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    padding: 28px 16px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}

    .avail-category-tile:hover {
        border-color: #3182ce;
        box-shadow: 0 6px 18px rgba(49,130,206,.18);
        transform: translateY(-3px);
    }

/* Demo category tile – green highlight when user has no exams */
.avail-category-tile-demo {
    background: linear-gradient(135deg, #f0fff4, #e9f7ef);
}

    .avail-category-tile-demo .avail-category-icon {
        background: linear-gradient(135deg, #38a169, #48bb78);
        color: #fff;
    }

    .avail-category-tile-demo .avail-category-count {
        background: #c6f6d5;
        color: #22543d;
    }

    .avail-category-tile-demo:hover {
        box-shadow: 0 6px 18px rgba(56,161,105,.22);
    }

        .avail-category-tile-demo:hover .avail-category-icon {
            background: linear-gradient(135deg, #276749, #38a169);
        }

.avail-category-icon {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    color: #2b6cb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: background .18s;
}

.avail-category-tile:not(.avail-category-tile-demo):hover .avail-category-icon {
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
}

.avail-category-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
}

.avail-category-count {
    font-size: .8rem;
    color: #718096;
    background: #f7fafc;
    padding: 3px 10px;
    border-radius: 99px;
    font-weight: 600;
}

/* ── Available exam card grid ───────────────────────────────────── */
.avail-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.avail-exam-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}

    .avail-exam-card:hover {
        border-color: #3182ce;
        box-shadow: 0 6px 18px rgba(49,130,206,.18);
        transform: translateY(-3px);
    }

.avail-exam-card-accent {
    height: 5px;
    background: linear-gradient(90deg, #2b6cb0, #63b3ed);
    flex-shrink: 0;
}

.avail-exam-card-inner {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.avail-exam-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.avail-exam-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.avail-exam-scope-badge {
    flex-shrink: 0;
    background: #ebf8ff;
    color: #2b6cb0;
    font-size: .7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.avail-exam-scope-name {
    font-size: .82rem;
    font-weight: 600;
    color: #4a5568;
    line-height: 1.2;
}

/* Price badge – top-right corner of card header */
.avail-exam-price-badge {
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    background: #fff3cd;
    color: #7b4f00;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

    .avail-exam-price-badge.avail-exam-price-badge-free {
        background: #c6f6d5;
        color: #22543d;
    }

.avail-exam-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.35;
}

.avail-exam-desc {
    font-size: .82rem;
    color: #4a5568;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

.avail-exam-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.avail-exam-meta-item {
    font-size: .75rem;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f7fafc;
    padding: 3px 8px;
    border-radius: 99px;
}

.avail-exam-card-footer {
    margin-top: auto;
    padding-top: 6px;
}

.avail-exam-card-clickable {
    cursor: pointer;
}

.avail-exam-card-draft {
    opacity: .6;
    background: #fff;
}

    .avail-exam-card-draft:hover {
        opacity: .82;
    }

.avail-exam-draft-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    background: linear-gradient(135deg, #f6e05e, #fbd38d);
    color: #744210;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .05em;
    box-shadow: 0 1px 4px rgba(236,201,75,.4);
}

.avail-exam-header-top-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.avail-exam-add-btn,
.avail-exam-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, #2b6cb0, #3182ce);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s, transform .1s, box-shadow .18s;
    box-shadow: 0 2px 8px rgba(49,130,206,.3);
}

.avail-exam-view-btn {
    background: linear-gradient(135deg, #2b6cb0, #3182ce);
}

.avail-exam-card-clickable:hover .avail-exam-add-btn,
.avail-exam-card-clickable:hover .avail-exam-view-btn {
    background: linear-gradient(135deg, #2c5282, #2b6cb0);
    box-shadow: 0 4px 14px rgba(49,130,206,.4);
}

.avail-exam-added-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: #f0fff4;
    color: #276749;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 700;
    border: 1.5px solid #9ae6b4;
}

/* ── Empty state ────────────────────────────────────────────────── */
.index-empty {
    color: #a0aec0;
    font-size: .88rem;
    padding: 8px 0;
}

/* ── Exam detail modal ───────────────────────────────────────── */
.exam-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.exam-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: exam-modal-in .18s ease;
}

/* Two-view switchable modal: only the slide container moves, header stays */
.exam-modal-switchable {
    position: relative;
}

/* Sliding area that wraps body + footer of both views */
.exam-modal-slide-container {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Each view fills the slide container */
.exam-modal-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: absolute;
    inset: 0;
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
    will-change: transform, opacity;
}

/* Active view: visible, in place */
.exam-modal-view-active {
    position: relative;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* View sliding out to the left */
.exam-modal-view-exit {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

/* View waiting off-screen to the right */
.exam-modal-view-enter {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* Purchase footer with two side-by-side buttons */
.exam-modal-footer-purchase {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Plan title row inside the purchase view body */
.purchase-view-header {
    margin-bottom: 14px;
}

.purchase-view-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
}

/* Purchase option cards */
.purchase-option-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    cursor: pointer;
    text-align: left;
    width: 100%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

    .purchase-option-card + .purchase-option-card {
        margin-top: 10px;
    }

    .purchase-option-card:hover:not(.purchase-option-card-selected) {
        border-color: #bee3f8;
        background: #f0f8ff;
        box-shadow: 0 1px 4px rgba(66,153,225,.08);
    }

.purchase-option-card-selected {
    background: #ebf8ff;
    box-shadow: 0 3px 12px rgba(43,108,176,.22);
}

.purchase-option-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #bee3f8;
    color: #2b6cb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.purchase-option-body {
    flex: 1;
}

.purchase-option-label {
    font-size: .95rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 3px;
}

.purchase-option-desc {
    font-size: .8rem;
    color: #718096;
    line-height: 1.4;
}

.purchase-option-features {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .purchase-option-features li {
        font-size: .78rem;
        color: #4a5568;
        display: flex;
        align-items: baseline;
        gap: 5px;
    }

        .purchase-option-features li .fa-check {
            font-size: .65rem;
            color: #38a169;
            flex-shrink: 0;
        }

.purchase-option-features-sep {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
    padding: 0;
}

.purchase-option-features-extra .fa-plus {
    font-size: .6rem;
    color: #2b6cb0;
    flex-shrink: 0;
}

.purchase-option-corner-price {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 118px;
    height: 118px;
    background: #2b6cb0;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 13px 12px;
    pointer-events: none;
    transition: background .15s;
}

    .purchase-option-corner-price strong {
        font-size: 1.25rem;
        font-weight: 800;
        color: #fff;
        line-height: 1.1;
        text-align: right;
        display: block;
    }

    .purchase-option-corner-price span {
        font-size: .7rem;
        font-weight: 500;
        color: rgba(255,255,255,.85);
        line-height: 1.2;
        text-align: right;
        display: block;
    }

.purchase-option-card-selected .purchase-option-corner-price {
    background: #2c5282;
}

.purchase-option-card:hover:not(.purchase-option-card-selected) .purchase-option-corner-price {
    background: #4299e1;
}

.purchase-option-check {
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #2b6cb0;
    flex-shrink: 0;
    margin-top: 4px;
}

.purchase-modal-cancel-btn {
    padding: 9px 20px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #fff;
    color: #4a5568;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

    .purchase-modal-cancel-btn:hover {
        background: #f7fafc;
        border-color: #a0aec0;
    }

.purchase-modal-confirm-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    background: #2b6cb0;
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

    .purchase-modal-confirm-btn:hover:not(:disabled) {
        background: #2c5282;
    }

    .purchase-modal-confirm-btn:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

@keyframes exam-modal-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Fixed header */
.exam-modal-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #e2e8f0;
}

.exam-modal-accent {
    height: 5px;
    background: linear-gradient(90deg, #2b6cb0, #63b3ed);
    flex-shrink: 0;
}

.exam-modal-header-inner {
    padding: 16px 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.exam-modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.exam-modal-header-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.exam-modal-close {
    flex-shrink: 0;
    background: #f7fafc;
    border: 1.5px solid #e2e8f0;
    color: #718096;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background .15s, color .15s;
}

    .exam-modal-close:hover {
        background: #fed7d7;
        border-color: #fc8181;
        color: #c53030;
    }

.exam-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.3;
    margin: 0;
}

/* Scrollable body */
.exam-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exam-modal-desc {
    font-size: .88rem;
    color: #4a5568;
    line-height: 1.55;
    margin: 0;
}

.exam-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.exam-modal-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7fafc;
    border-radius: 10px;
    padding: 14px 16px;
}

.exam-modal-section-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #2b6cb0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exam-modal-section-body {
    font-size: .85rem;
    color: #4a5568;
    line-height: 1.5;
    margin: 0;
}

.exam-modal-loading,
.exam-modal-empty {
    font-size: .85rem;
    color: #a0aec0;
    margin: 0;
}

/* Fixed footer */
.exam-modal-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.exam-modal-subscribe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #2b6cb0, #3182ce);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(49,130,206,.35);
    transition: background .18s, box-shadow .18s, transform .1s;
}

    .exam-modal-subscribe-btn:hover {
        background: linear-gradient(135deg, #2c5282, #2b6cb0);
        box-shadow: 0 5px 16px rgba(49,130,206,.45);
        transform: scale(1.01);
    }

.exam-modal-go-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #276749, #38a169);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(56,161,105,.35);
    transition: background .18s, box-shadow .18s, transform .1s;
}

    .exam-modal-go-btn:hover {
        background: linear-gradient(135deg, #22543d, #276749);
        box-shadow: 0 5px 16px rgba(56,161,105,.45);
        transform: scale(1.01);
    }

/* Dual-button footer (upgrade + go to exam) */
.exam-modal-footer-dual {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.exam-modal-subscribe-btn-upgrade {
    box-shadow: 0 3px 10px rgba(56,161,105,.35);
}

    .exam-modal-subscribe-btn-upgrade:hover {
        background: linear-gradient(135deg, #22543d, #276749);
        box-shadow: 0 5px 16px rgba(56,161,105,.45);
    }

/* Disabled purchase option card (e.g. OnlyTest when upgrading) */
.purchase-option-card-disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Accordion syllabus */
.exam-syllabus-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-syllabus-item {
    border-radius: 8px;
    overflow: hidden;
}

.exam-syllabus-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: .88rem;
    font-weight: 600;
    color: #2d3748;
    text-align: left;
    transition: background .15s, border-color .15s;
}

    .exam-syllabus-row.open,
    .exam-syllabus-row:hover {
        background: #ebf8ff;
        border-color: #bee3f8;
    }

.exam-syllabus-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2b6cb0;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exam-syllabus-name {
    flex: 1;
    line-height: 1.3;
}

.exam-syllabus-chevron {
    flex-shrink: 0;
    font-size: .75rem;
    color: #718096;
    transition: transform .2s;
}

    .exam-syllabus-chevron.open {
        transform: rotate(180deg);
    }

/* Children indented */
.exam-syllabus-children {
    list-style: none;
    margin: 2px 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.exam-syllabus-depth-1 .exam-syllabus-row {
    background: transparent;
    border-color: #e2e8f0;
    font-size: .83rem;
    font-weight: 500;
    color: #4a5568;
    padding: 7px 10px;
}

    .exam-syllabus-depth-1 .exam-syllabus-row:hover {
        background: #f7fafc;
        border-color: #cbd5e0;
    }

.exam-syllabus-depth-2 .exam-syllabus-row {
    font-size: .8rem;
    font-weight: 400;
    color: #718096;
    padding: 6px 10px;
    border-color: #edf2f7;
}

/* ── Responsive adjustments ─────────────────────────────────────── */
@media (max-width: 600px) {
    .app-topbar {
        padding: 0 12px;
    }

    .app-topbar-brand {
        font-size: 1.05rem;
    }

    .app-bottombar {
        gap: 10px;
    }

    .index-greeting {
        font-size: 1rem;
        padding: 14px 14px 0;
    }

    .index-section {
        padding: 10px;
    }

    .avail-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .avail-exam-grid {
        grid-template-columns: 1fr;
    }

    .exam-cards-grid {
        grid-template-columns: 1fr;
    }

    .exam-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .exam-modal {
        max-height: none;
        height: 92vh;
        height: 92dvh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .purchase-option-body {
        padding-right: 15px;
    }

    .purchase-option-corner-price {
        width: 86px;
        height: 86px;
        padding: 9px 8px;
    }

        .purchase-option-corner-price strong {
            font-size: 1rem;
        }

        .purchase-option-corner-price span {
            font-size: .6rem;
        }
}

@media (min-width: 601px) and (max-width: 900px) {
    .avail-exam-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Loading screen ─────────────────────────────────────────────── */
.index-loading-overlay {
    position: fixed;
    inset: 0;
    background: #f5f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.index-loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.index-spinner {
    display: block;
    width: 48px;
    height: 48px;
    border: 4px solid #bee3f8;
    border-top-color: #2b6cb0;
    border-radius: 50%;
    animation: index-spin 0.7s linear infinite;
}

@keyframes index-spin {
    to {
        transform: rotate(360deg);
    }
}

.index-loading-content p {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
    margin: 0;
}

/* ── Welcome Panel ──────────────────────────────────────────────── */
.index-welcome-panel {
    width: 360px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 20px 32px;
}

@media (max-width: 1099px) {
    .index-welcome-panel {
        display: none;
    }
}

/* Header branding */
.welcome-panel-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}

.welcome-panel-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2b6cb0, #63b3ed);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(43,108,176,.3);
}

    .welcome-panel-logo .fas {
        font-size: 1.5rem;
        color: #fff;
    }

.welcome-panel-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
}

.welcome-panel-tagline {
    font-size: .86rem;
    color: #718096;
    margin-top: 2px;
    line-height: 1.35;
}

/* Section label inside panel */
.welcome-panel-section-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #718096;
    margin-bottom: 10px;
}

/* Steps list */
.welcome-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.welcome-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2b6cb0;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.welcome-step-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #ebf8ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .welcome-step-icon .fas {
        font-size: .9rem;
        color: #2b6cb0;
    }

.welcome-step-body {
    flex: 1;
}

.welcome-step-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
    margin-bottom: 5px;
}

.welcome-step-desc {
    font-size: .84rem;
    color: #718096;
    line-height: 1.4;
}

/* CTA button */
.welcome-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, #2b6cb0, #3182ce);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(43,108,176,.35);
    transition: background .18s, box-shadow .18s, transform .1s;
}

    .welcome-cta-btn:hover {
        background: linear-gradient(135deg, #2c5282, #2b6cb0);
        box-shadow: 0 5px 16px rgba(43,108,176,.45);
        transform: scale(1.01);
    }

/* Has-exams motivational card */
.welcome-panel-has-exams {
    text-align: center;
    padding: 10px;
}

.welcome-has-exams-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ed8936, #f6ad55);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-has-exams-title {
    font-size: 2.15rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 10px;
}

.welcome-has-exams-desc {
    font-size: .9rem;
    color: #4a5568;
    line-height: 1.5;
}

/* Demo card */
.welcome-demo-card {
    background: linear-gradient(135deg, #f0fff4, #e9f7ef);
    border: 1px solid #9ae6b4;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.welcome-demo-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #38a169, #48bb78);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(56,161,105,.25);
}

    .welcome-demo-icon .fas {
        font-size: 1.1rem;
        color: #fff;
    }

.welcome-demo-body {
    flex: 1;
}

.welcome-demo-title {
    font-size: .9rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
}

.welcome-demo-desc {
    font-size: .84rem;
    color: #4a5568;
    line-height: 1.4;
    margin: 0 0 10px;
}

.welcome-demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #38a169, #48bb78);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(56,161,105,.3);
    transition: background .15s, box-shadow .15s, transform .1s;
}

    .welcome-demo-btn:hover {
        background: linear-gradient(135deg, #276749, #38a169);
        box-shadow: 0 4px 12px rgba(56,161,105,.4);
        transform: scale(1.01);
    }

    .welcome-demo-btn-disabled,
    .welcome-demo-btn:disabled {
        background: #a0aec0;
        box-shadow: none;
        cursor: default;
        opacity: .7;
    }

        .welcome-demo-btn-disabled:hover,
        .welcome-demo-btn:disabled:hover {
            background: #a0aec0;
            box-shadow: none;
            transform: none;
        }

        .welcome-demo-btn-disabled:hover,
        .welcome-demo-btn:disabled:hover {
            background: #a0aec0;
            box-shadow: none;
            transform: none;
        }

/* ── Bottom group: demo banner + recent activity pinned to bottom ── */
.index-bottom-group {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

/* ── Demo card banner (inline column, shown when no exams) ──────── */
.index-section-demo-banner {
    padding-top: 6px;
    padding-bottom: 10px;
}

.demo-banner-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #f0fff4, #e9f7ef);
    border: 1px solid #9ae6b4;
    border-radius: 14px;
    padding: 16px 20px;
}

.demo-banner-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #38a169, #48bb78);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(56,161,105,.25);
}

    .demo-banner-icon .fas {
        font-size: 1.1rem;
        color: #fff;
    }

.demo-banner-body {
    flex: 1;
    min-width: 0;
}

.demo-banner-title {
    font-size: .95rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 2px;
}

.demo-banner-desc {
    font-size: .84rem;
    color: #4a5568;
    line-height: 1.4;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .demo-banner-card {
        flex-wrap: wrap;
    }

    .demo-banner-desc {
        white-space: normal;
    }
}

/* Benefits list */
.welcome-benefits {
    list-style: none;
    margin: auto 0 0;
    padding: 12px 0 0;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.welcome-benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .87rem;
    color: #4a5568;
    font-weight: 500;
}

.welcome-benefit-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #ebf8ff;
    color: #2b6cb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    flex-shrink: 0;
}

/* ── SimpleColorPicker ─────────────────────────────────────────── */

.simple-color-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(24px, 1fr));
    gap: 4px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.simple-color-swatch {
    aspect-ratio: 1;
    width: auto;
    min-width: 22px;
    border-radius: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .1s, border-color .1s;
}

    .simple-color-swatch:hover {
        transform: scale(1.15);
        border-color: #718096;
    }

    .simple-color-swatch.selected {
        border-color: #2d3748;
        transform: scale(1.15);
    }

/* ── TopBar support button ──────────────────────────────────────── */
.app-topbar-support {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color .15s, background .15s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .app-topbar-support:hover {
        color: #fff;
        background: rgba(255,255,255,.12);
        transform: scale(1.1);
    }

/* ── SupportModal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: min(480px, 100%);
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-box-in .18s ease;
}

@keyframes modal-box-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    background: #2b6cb0;
    color: #fff;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

    .modal-close-btn:hover {
        color: #fff;
        background: rgba(255,255,255,.15);
    }

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.support-modal-hint {
    font-size: .9rem;
    color: #4a5568;
    line-height: 1.5;
}

.support-modal-textarea {
    width: 100%;
    resize: vertical;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: .92rem;
    font-family: inherit;
    color: #2d3748;
    line-height: 1.5;
    transition: border-color .15s;
    min-height: 120px;
}

    .support-modal-textarea:focus {
        outline: none;
        border-color: #2b6cb0;
    }

    .support-modal-textarea:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.support-modal-charcount {
    font-size: .78rem;
    color: #a0aec0;
    text-align: right;
}

.btn-primary {
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    background: #2b6cb0;
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

    .btn-primary:hover:not(:disabled) {
        background: #2c5282;
    }

    .btn-primary:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

.btn-secondary {
    padding: 9px 18px;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    background: #fff;
    color: #4a5568;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

    .btn-secondary:hover:not(:disabled) {
        background: #f7fafc;
        border-color: #a0aec0;
    }

    .btn-secondary:disabled {
        opacity: .45;
        cursor: not-allowed;
    }
