    /* 1. SCOPED WRAPPER */
    .attendance-app-wrapper {
        container-type: inline-size;
        container-name: app-main;
        --bg-body: #F7F9FC;
        --bg-surface: #FFFFFF;
        --text-primary: #0F172A;
        --text-secondary: #475569;
        --text-tertiary: #94A3B8;
        --primary: #3B82F6;
        --success: #10B981;
        --warning: #F59E0B;
        --danger: #EF4444;
        --radius-xl: 28px;
        --font-main: 'DM Sans', sans-serif;
        font-family: var(--font-main);
        background-color: transparent;
        color: var(--text-primary);
        width: 100%;
        position: relative;
        box-sizing: border-box;
        line-height: 1.5;
    }

    /* NU Settings Card */
    .nu-card { background: #EEF2FF; border: 1px solid #C7D2FE; border-radius: 24px; padding: 18px 22px; }
    .nu-card-header { display: flex; align-items: center; gap: 12px; cursor: pointer; }
    .nu-card-icon { width: 36px; height: 36px; border-radius: 10px; background: #C7D2FE; color: #4338CA; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
    .nu-card-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; }
    .nu-card-title-row { display: flex; align-items: center; gap: 6px; }
    .nu-card-title { font-size: 14px; font-weight: 800; color: #312E81; text-align: left; }
    .nu-tooltip-wrapper { position: relative; display: flex; align-items: center; justify-content: center; color: #818CF8; font-size: 13px; cursor: help; margin-top: 1px; }
    .nu-tooltip { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-5px); background: #312E81; color: #FFF; padding: 6px 10px; border-radius: 6px; font-size: 10px; font-weight: 500; width: max-content; max-width: 200px; text-align: center; opacity: 0; pointer-events: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 12px rgba(49,46,129,0.25); z-index: 100; line-height: 1.4; display: block; font-family: var(--font-main); }
    .nu-tooltip-wrapper:hover .nu-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
    .nu-tooltip::after { content: ''; position: absolute; bottom: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: transparent transparent #312E81 transparent; }
    .nu-card-row2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
    .nu-card-status { font-size: 12px; color: #6366F1; font-weight: 600; white-space: nowrap; }
    .nu-card-chevron { font-size: 10px; color: #6366F1; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: rgba(99,102,241,0.1); border-radius: 6px; flex-shrink: 0; transition: transform 0.25s ease; }
    .nu-card.expanded .nu-card-chevron { transform: rotate(180deg); }
    .nu-select { padding: 5px 8px; font-size: 11px; font-family: var(--font-main); font-weight: 700; color: #312E81; background: #FFF; border: 1px solid #A5B4FC; border-radius: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(99,102,241,0.08); -webkit-appearance: auto; appearance: auto; }
    .nu-select:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
    .nu-card-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
    .nu-card.expanded .nu-card-body { max-height: 800px; overflow-y: auto; }
    .nu-list { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid #C7D2FE; margin-top: 16px; }
    .nu-subject-group { background: rgba(255,255,255,0.75); border-radius: 12px; padding: 12px 16px; }
    .nu-subject-name { font-size: 12px; font-weight: 800; color: #312E81; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
    .nu-subject-count { font-size: 9px; font-weight: 700; color: #6366F1; background: #E0E7FF; padding: 2px 7px; border-radius: 4px; }
    .nu-date-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #E0E7FF; gap: 10px 12px; }
    .nu-date-row:last-child { border-bottom: none; }
    .nu-date-info { display: flex; flex-direction: column; gap: 2px; flex: 1 1 120px; min-width: 120px; }
    .nu-date-label { font-size: 11.5px; color: #312E81; font-weight: 700; white-space: nowrap; }
    .nu-date-time { font-size: 10px; color: #6366F1; font-weight: 600; white-space: nowrap; }
    .nu-toggle-group { display: flex; flex: 1 1 200px; border-radius: 8px; overflow: hidden; border: 1px solid #C7D2FE; min-width: 200px; }
    .nu-toggle-btn { flex: 1; font-size: 11px; font-weight: 700; font-family: var(--font-main); padding: 6px 4px; border: none; cursor: pointer; background: #F5F3FF; color: #6366F1; transition: all 0.15s; text-align: center; }
    .nu-toggle-btn:not(:last-child) { border-right: 1px solid #C7D2FE; }
    .nu-toggle-btn.active-ignore { background: #818CF8; color: white; }
    .nu-toggle-btn.active-present { background: #10B981; color: white; }
    .nu-toggle-btn.active-absent { background: #EF4444; color: white; }
    .nu-empty-msg { text-align: center; padding: 14px; font-size: 12px; color: #6366F1; font-weight: 600; }

    .attendance-app-wrapper *,
    .attendance-app-wrapper *::before,
    .attendance-app-wrapper *::after {
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }

    .attendance-app-wrapper button,
    .attendance-app-wrapper input {
        font-family: var(--font-main);
    }

    #global-tooltip {
        position: fixed;
        background: #1E293B;
        color: white;
        padding: 8px 14px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        pointer-events: none;
        z-index: 9999;
        opacity: 0;
        transform: translateY(5px);
        transition: opacity 0.15s ease, transform 0.15s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        max-width: 250px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #global-tooltip.visible {
        opacity: 1;
        transform: translateY(0);
    }

    #global-tooltip::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        margin-left: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: #1E293B transparent transparent transparent;
    }

    #global-tooltip.flipped::after {
        top: auto;
        bottom: 100%;
        border-color: transparent transparent #1E293B transparent;
    }

    .view-upload {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 10px;
        padding-bottom: 30px;
        gap: 30px;
    }

    .upload-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--text-primary);
        color: white;
        padding: 14px 28px;
        border-radius: 16px;
        font-weight: 700;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .upload-btn:hover {
        background: #000;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    }

    .upload-btn-spinner {
        width: 16px;
        height: 16px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: white;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        display: inline-block;
    }

    input[type="file"] {
        display: none;
    }

    .history-card {
        width: 100%;
        max-width: 400px;
        background: #F8FAFC;
        border-radius: 24px;
        border: 1px solid #E2E8F0;
        overflow: hidden;
        display: none;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .history-card.expanded {
        overflow: hidden;
    }

    .history-header {
        padding: 24px 24px 0 24px;
        cursor: pointer;
        user-select: none;
        background: linear-gradient(to bottom, #ffffff, #f8fafc);
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .history-header:active {
        background: #f1f5f9;
    }

    .welcome-label {
        font-size: 11px;
        color: var(--text-tertiary);
        font-weight: 700;
        text-transform: uppercase;
        margin-bottom: 4px;
        letter-spacing: 0.5px;
    }

    .student-name-hist {
        font-weight: 800;
        color: var(--text-primary);
        font-size: 20px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hist-data-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #F1F5F9;
        border-radius: 16px;
        padding: 6px 6px 6px 16px;
        border: 1px solid #E2E8F0;
    }

    .hist-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: var(--text-secondary);
        font-weight: 600;
    }

    .hist-score-badge {
        padding: 8px 16px;
        border-radius: 12px;
        font-weight: 800;
        font-size: 16px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .hist-handle {
        width: 100%;
        padding: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        color: var(--text-tertiary);
    }

    .chevron-icon {
        transition: transform 0.3s;
        font-size: 14px;
    }

    .history-card.expanded .chevron-icon {
        transform: rotate(180deg);
    }

    .history-details {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
        background: #F8FAFC;
        border-top: 1px solid #E2E8F0;
    }

    .history-card.expanded .history-details {
        max-height: 2000px;
        opacity: 1;
    }

    .mini-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 12px;
        padding: 24px;
        padding-bottom: 30px;
    }

    .mini-sub-card {
        background: white;
        border-radius: 16px;
        padding: 16px 8px;
        text-align: center;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
        border: 1px solid #E2E8F0;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        cursor: pointer;
    }

    .mini-sub-card:active {
        background: #F1F5F9;
    }

    .mini-ring {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        margin-bottom: 10px;
        background: conic-gradient(var(--c) var(--p), #F1F5F9 0);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mini-ring-inner {
        width: 40px;
        height: 40px;
        background: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 800;
        color: var(--text-primary);
    }

    .mini-name {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
        width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: break-word;
        line-height: 1.3;
        pointer-events: none;
    }

    .view-dashboard {
        display: none;
        max-width: 1200px;
        margin: 0 auto;
        padding: 32px;
        padding-bottom: 80px;
    }

    .dashboard-grid {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .dashboard-top-row {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    @container app-main (min-width: 700px) {
        .dashboard-top-row {
            display: grid;
            grid-template-columns: 1.3fr 1fr;
            align-items: start;
        }

        .header-card,
        .simulator-card {
            margin-bottom: 0;
            height: 100%;
        }

        .grid-rings {
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        }
    }

    @media (max-width: 600px) {
        .view-dashboard {
            padding: 16px;
        }

        .big-score {
            font-size: 48px;
        }
    }

    @media (max-width: 400px) {
        .header-card {
            padding: 20px !important;
        }

        .big-score {
            font-size: 42px !important;
        }
    }

    .glass-card {
        background: var(--bg-surface);
        border-radius: 24px;
        padding: 24px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        border: 1px solid #E2E8F0;
    }

    .header-card {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 24px;
        border-radius: 28px;
    }

    .header-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin: 0;
        gap: 12px;
    }

    .main-stat {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 4px;
        flex: 1;
        min-width: 0;
    }

    .label-overline {
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-tertiary);
        letter-spacing: 1.2px;
        margin: 0;
        margin-bottom: 4px;
    }

    .big-score {
        font-size: 64px;
        font-weight: 800;
        color: var(--text-primary);
        line-height: 1;
        letter-spacing: -2px;
        background: -webkit-linear-gradient(135deg, var(--text-primary), var(--text-secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin: 0;
    }

    .student-name-tag {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-top: 8px;
        padding: 6px 12px;
        background: #F1F5F9;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-secondary);
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 1px solid #E2E8F0;
        background: transparent;
        color: var(--text-secondary);
        font-size: 16px;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .icon-btn:hover {
        background: #F1F5F9;
        color: var(--text-primary);
        border-color: #CBD5E1;
    }

    .badges-row {
        display: flex;
        gap: 12px;
        margin-top: 0;
    }

    .stat-badge {
        padding: 8px 16px;
        border-radius: 50px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        position: relative;
        transition: transform 0.2s;
        border: 1px solid transparent;
        width: auto;
    }

    .stat-badge:hover {
        transform: translateY(-2px);
    }

    .badge-streak {
        background-color: #FFFBEB;
        border-color: #FEF3C7;
        color: #D97706;
    }

    .badge-missed {
        background-color: #F8FAFC;
        border-color: #E2E8F0;
        color: #475569;
    }

    .stat-badge i {
        font-size: 16px;
        margin-bottom: 0;
    }

    .stat-badge span {
        font-size: 16px;
        font-weight: 800;
    }

    .sim-header {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 16px;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid #F1F5F9;
    }

    .control-group {
        margin-bottom: 28px;
    }

    .control-group:last-child {
        margin-bottom: 8px;
    }

    .control-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        margin-bottom: 12px;
    }

    .control-label {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .number-input {
        background: #fff;
        border: 1px solid #E2E8F0;
        border-radius: 8px;
        width: 60px;
        padding: 6px 0;
        text-align: center;
        font-weight: 700;
        font-size: 15px;
        color: var(--text-primary);
        transition: all 0.2s;
    }

    .number-input:focus {
        border-color: var(--primary);
        outline: none;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .number-input.purple:focus {
        border-color: #8B5CF6;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    }

    input[type=range] {
        width: 100%;
        -webkit-appearance: none;
        height: 6px;
        background: #E2E8F0;
        border-radius: 10px;
        outline: none;
        margin-bottom: 20px;
        display: block;
        touch-action: none;
    }

    input[type=range]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: white;
        cursor: grab;
        border: 2px solid var(--primary);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        transition: transform 0.1s, box-shadow 0.1s;
    }

    input[type=range]::-webkit-slider-thumb:active {
        transform: scale(1.1);
    }

    input[type=range].slider-purple::-webkit-slider-thumb {
        border-color: #8B5CF6;
    }

    .sim-result-box {
        background: #F8FAFC;
        border-radius: 16px;
        padding: 18px;
        border: 1px solid #E2E8F0;
    }

    .sim-grid {
        display: flex;
    }

    .sim-col {
        flex: 1;
        text-align: center;
    }

    .sim-divider {
        width: 1px;
        background: #E2E8F0;
        margin: 0 16px;
    }

    .sim-col span {
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        color: var(--text-tertiary);
        font-weight: 600;
        margin-bottom: 6px;
    }

    .goal-text {
        font-size: 14px;
        color: var(--text-secondary);
        line-height: 1.5;
        text-align: center;
    }

    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
        margin-top: 12px;
    }

    .section-title {
        font-size: 20px;
        font-weight: 800;
        color: var(--text-primary);
    }

    .count-badge {
        font-size: 13px;
        font-weight: 700;
        color: var(--text-secondary);
        background: #fff;
        padding: 6px 12px;
        border-radius: 20px;
        border: 1px solid #E2E8F0;
    }

    .grid-rings {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }

    .subject-card {
        background: var(--bg-surface);
        border-radius: 24px;
        padding: 24px 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        position: relative;
        cursor: pointer;
        transition: all 0.2s ease;
        border: 1px solid #E2E8F0;
        height: 100%;
    }

    .subject-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        border-color: #CBD5E1;
        z-index: 10;
    }

    .expand-icon {
        position: absolute;
        top: 12px;
        right: 12px;
        color: var(--text-tertiary);
        font-size: 11px;
        opacity: 0.6;
        transition: 0.2s;
        background: #F1F5F9;
        width: 28px;
        height: 28px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .subject-card:hover .expand-icon {
        opacity: 1;
        background: #E2E8F0;
    }

    .ring-container {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        margin-bottom: 16px;
        background: conic-gradient(var(--ring-color) var(--percent), #E2E8F0 0);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ring-inner {
        width: 60px;
        height: 60px;
        background: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    }

    .ring-val {
        font-size: 16px;
        font-weight: 800;
        color: var(--text-primary);
    }

    .subject-name {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: break-word;
        height: 36px;
        line-height: 1.4;
    }

    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 2000;
        display: none;
        opacity: 0;
        transition: opacity 0.35s ease;
        touch-action: none;
    }

    .modal-overlay.active {
        display: block;
        opacity: 1;
    }

    .modal-wrapper {
        position: fixed;
        background: var(--bg-surface);
        border-radius: 32px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        z-index: 2001;
        overflow: hidden;
        display: none;
        opacity: 0;
        transform: scale(0.95) translateY(10px);
        transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        overscroll-behavior: contain;
    }

    .modal-wrapper.visible {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    .layer-mini {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 20px;
        pointer-events: none;
        opacity: 1;
        transition: opacity 0.15s ease;
    }

    .layer-mini .subject-name {
        width: 100%;
    }

    .layer-full {
        position: absolute;
        inset: 0;
        padding: 28px;
        overflow-y: auto;
        opacity: 0;
        background: var(--bg-surface);
        transition: opacity 0.2s ease;
        display: flex;
        flex-direction: column;
    }

    .modal-wrapper.is-expanded .layer-mini {
        opacity: 0;
    }

    .modal-wrapper.is-expanded .layer-full {
        opacity: 1;
    }

    .close-modal-btn {
        position: absolute;
        top: 16px;
        right: 16px;
        background: #F1F5F9;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 14px;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: 0.2s;
        z-index: 10;
    }

    .close-modal-btn:hover {
        background: #E2E8F0;
        color: var(--text-primary);
    }

    .modal-header-content {
        text-align: center;
        margin-bottom: 20px;
        margin-top: 8px;
        padding: 0 48px;
    }

    .modal-title-big {
        font-size: 20px;
        font-weight: 800;
        margin-bottom: 12px;
        color: var(--text-primary);
        line-height: 1.2;
        overflow-wrap: break-word;
    }

    .stats-pill-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        align-items: center;
        background: #F8FAFC;
        border: 1px solid #E2E8F0;
        border-radius: 16px;
        padding: 12px 0;
        width: 100%;
        box-sizing: border-box;
    }

    .pill-stat {
        text-align: center;
        position: relative;
    }
    
    .pill-stat:not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        height: 24px;
        width: 1px;
        background: #E2E8F0;
    }

    .pill-stat span {
        display: block;
        font-size: 10px;
        text-transform: uppercase;
        color: var(--text-tertiary);
        font-weight: 700;
    }

    .pill-stat strong {
        font-size: 15px;
        color: var(--text-primary);
    }



    #loading {
        position: fixed;
        inset: 0;
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(5px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 3000;
    }

    .spinner {
        width: 48px;
        height: 48px;
        border: 4px solid #E2E8F0;
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        100% {
            transform: rotate(360deg);
        }
    }

    /* ===== ADVANCED FORECAST ===== */
    .fc-forecast-trigger { margin-top: 20px; padding-top: 20px; border-top: 1px solid #F1F5F9; }
    .fc-forecast-btn { width: 100%; display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #F8FAFC, #EFF6FF); border: 1px solid #DBEAFE; border-radius: 16px; padding: 16px 18px; cursor: pointer; transition: all 0.2s; text-align: left; font-family: var(--font-main); }
    .fc-forecast-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(59,130,246,0.12); border-color: #BFDBFE; }
    .fc-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
    .fc-btn-text { flex: 1; min-width: 0; }
    .fc-btn-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
    .fc-btn-sub { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
    .fc-btn-arrow { color: var(--text-tertiary); font-size: 12px; flex-shrink: 0; }

    /* === ADVANCED FORECAST — ACCORDION CARDS === */
    .fc-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 3000; display: none; opacity: 0; transition: opacity 0.3s ease; }
    .fc-overlay.active { display: block; opacity: 1; }
    .fc-container { position: fixed; z-index: 3001; left: 50%; top: 50%; translate: -50% -50%; width: 96vw; max-width: 1200px; height: 94vh; height: 94dvh; display: none; flex-direction: column; gap: 10px; opacity: 0; transform: translateY(20px); transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1); }
    .fc-container.visible { opacity: 1; transform: translateY(0); }
    @media (max-width: 768px) { .fc-container { width: 100vw; height: 100vh; height: 100dvh; max-width: 100%; border-radius: 0; padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); } }

    /* Top card */
    .fc-top-card { background: white; border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); overflow: hidden; display: flex; flex-direction: column; flex: 1 1 0; min-height: 56px; transition: flex 0.45s cubic-bezier(0.4,0,0.2,1); }
    .fc-top-card.collapsed { flex: 0 0 56px; overflow: hidden; cursor: pointer; }
    .fc-top-card.collapsed .fc-top-inner { opacity: 0; pointer-events: none; }
    .fc-top-card.collapsed .fc-top-header { border-bottom: none; }
    .fc-top-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid #E2E8F0; flex-shrink: 0; }
    .fc-top-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
    .fc-close-btn { border: none; background: #F1F5F9; color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
    .fc-close-btn:hover { background: #E2E8F0; color: var(--text-primary); }

    /* Split layout inside top card */
    .fc-top-inner { display: flex; flex: 1; min-height: 0; overflow: hidden; background: #F8FAFC; padding: 16px; gap: 16px; opacity: 1; transition: opacity 0.3s ease; }
    @media (max-width: 768px) { 
        .fc-top-inner { flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 12px; gap: 12px; background: #F1F5F9; } 
    }

    /* Left: timetable */
    .fc-left { width: 50%; flex-shrink: 0; background: white; border-radius: 16px; border: 1px solid #E2E8F0; box-shadow: 0 4px 12px rgba(0,0,0,0.03); padding: 16px 20px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
    @media (max-width: 768px) { 
        .fc-left { width: 100%; padding: 14px 16px; flex: 0 0 auto; overflow: visible; } 
    }
    .fc-step-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: #0F172A; color: white; font-size: 11px; font-family: var(--font-main); margin-right: 6px; flex-shrink:0; }
    .fc-left-label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .fc-left-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
    .beta-badge { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; background: linear-gradient(135deg, #818CF8, #6366F1); color: white; padding: 2px 8px; border-radius: 6px; }
    .fc-left-hint { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 14px; }
    .fc-left-actions { display: flex; gap: 6px; margin-bottom: 12px; }
    .fc-small-btn { border: none; padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; transition: 0.15s; font-family: var(--font-main); }
    .fc-small-btn.edit { background: #EFF6FF; color: #2563EB; }
    .fc-small-btn.edit.active { background: var(--primary); color: white; }
    .fc-small-btn.reset { background: #FEF2F2; color: #EF4444; }
    .fc-small-btn.reset:hover { background: #FEE2E2; color: #DC2626; }
    .fc-small-btn:hover { transform: scale(1.03); }

    /* Timetable grid */
    .tt-grid { display: grid; grid-template-columns: repeat(7, minmax(64px, 1fr)); gap: 6px; border-radius: 12px; padding: 12px; border: 1px solid #E2E8F0; background: #FAFBFC; flex: 1; overflow: auto; }
    .tt-grid::-webkit-scrollbar { height: 4px; }
    .tt-grid::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
    .tt-day-col { display: flex; flex-direction: column; gap: 4px; min-height: 40px; min-width: 0; overflow: visible; }
    .tt-day-label { font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-align: center; text-transform: uppercase; padding-bottom: 4px; border-bottom: 1px solid #F1F5F9; }
    .tt-chip { background: #EFF6FF; color: #2563EB; font-size: 9px; font-weight: 600; padding: 6px 4px; border-radius: 6px; text-align: center; line-height: 1.2; position: relative; cursor: default; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; word-break: break-word; }
    .tt-chip-name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .tt-chip-mult { font-size: 8px; opacity: 0.8; background: rgba(37,99,235,0.1); padding: 1px 4px; border-radius: 4px; margin-top: 2px; }
    .tt-chip.editing { padding-right: 22px; padding-left: 2px; cursor: grab; touch-action: pan-x; -webkit-user-select: none; user-select: none; }
    .tt-chip.editing:active { cursor: grabbing; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
    .tt-chip-x { position: absolute; top: 0; right: 0; width: 28px; height: 28px; display: none; align-items: flex-start; justify-content: flex-end; padding: 4px; cursor: pointer; z-index: 10; }
    .tt-chip-x::after { content: '✕'; width: 14px; height: 14px; border-radius: 50%; background: #EF4444; color: white; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: bold; }
    .tt-chip.editing .tt-chip-x { display: flex; }
    .tt-add-btn { border: 1px dashed #CBD5E1; background: transparent; color: var(--text-tertiary); font-size: 12px; padding: 3px; border-radius: 6px; cursor: pointer; display: none; align-items: center; justify-content: center; transition: 0.2s; font-family: var(--font-main); }
    .tt-grid.editing .tt-add-btn { display: flex; }
    .tt-add-btn:hover { border-color: var(--primary); color: var(--primary); background: #EFF6FF; }
    .tt-picker { position: fixed; z-index: 3200; background: white; border-radius: 14px; border: 1px solid #E2E8F0; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 8px; max-height: 200px; overflow-y: auto; min-width: 160px; display: none; }
    .tt-picker.visible { display: block; }
    .tt-picker-item { padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-primary); cursor: pointer; transition: 0.15s; }
    .tt-picker-item:hover { background: #F1F5F9; }

    /* Right: day planner */
    .fc-right { flex: 1; min-width: 0; background: white; border-radius: 16px; border: 1px solid #E2E8F0; box-shadow: 0 4px 12px rgba(0,0,0,0.03); overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
    @media (max-width: 768px) {
        .tt-grid { overflow-x: auto; overflow-y: visible; flex: 0 0 auto; }
        .fc-right { width: 100%; flex: 0 0 auto; overflow: visible; }
        .fc-right-scroll { overflow-y: visible; padding-bottom: 24px; }
    }
    .fc-right-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid #F1F5F9; flex-shrink: 0; flex-wrap: wrap; gap: 8px; position: relative; }
    .fc-right-title { font-size: 14px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; }
    .fc-days-input { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); flex-wrap: nowrap; background: #F8FAFC; padding: 6px 12px; border-radius: 10px; border: 1px solid #F1F5F9; }
    @media (max-width: 768px) { .fc-days-input { width: 100%; justify-content: space-between; gap: 4px; padding: 8px 10px; } }
    .fc-days-num { width: 44px; padding: 4px; border: 1px solid #CBD5E1; border-radius: 6px; font-size: 13px; font-weight: 700; text-align: center; color: var(--text-primary); font-family: var(--font-main); }
    .fc-days-num:focus { border-color: var(--primary); outline: none; }
    .fc-days-date { padding: 3px 6px; border: 1px solid #CBD5E1; border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--text-primary); font-family: var(--font-main); height: 26px; min-width: 100px; }
    .fc-right-scroll { flex: 1; overflow-y: auto; padding: 0 16px 12px; }
    .fc-include-today { display: flex; align-items: center; gap: 5px; width: 100%; padding-top: 2px; }
    .fc-include-today input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; margin: 0; }
    .fc-include-today label { font-size: 11px; font-weight: 500; color: var(--text-tertiary); cursor: pointer; user-select: none; }

    /* Day sections */
    .plan-day-section { margin-bottom: 2px; }
    .plan-day-header { display: flex; align-items: center; gap: 8px; padding: 10px 0 6px; }
    .plan-day-name { font-size: 11px; font-weight: 800; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.8px; }
    .plan-day-date { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }
    .plan-day-line { flex: 1; height: 1px; background: #E2E8F0; }
    .plan-day-actions { display: flex; gap: 4px; flex-shrink: 0; }
    .plan-day-quick { border: none; padding: 3px 8px; border-radius: 5px; font-size: 9px; font-weight: 700; cursor: pointer; transition: 0.15s; font-family: var(--font-main); }
    .plan-day-quick.q-attend { background: #ECFDF5; color: #059669; }
    .plan-day-quick.q-skip { background: #FEF2F2; color: #DC2626; }
    .plan-day-quick.q-cancel { background: #F1F5F9; color: #64748B; }
    .plan-day-quick:hover { transform: scale(1.05); }

    /* Subject rows */
    .plan-subj { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #F8FAFC; }
    .plan-subj:last-child { border-bottom: none; }
    .plan-subj-name { flex: 1; font-size: 12.5px; font-weight: 500; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-align: left; }
    .plan-subj-name.struck { text-decoration: line-through; color: var(--text-tertiary); }
    .plan-subj-btns { display: flex; gap: 3px; flex-shrink: 0; }
    .plan-btn { border: 1.5px solid #E2E8F0; background: white; height: 28px; border-radius: 6px; font-size: 10px; font-weight: 600; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 3px; color: var(--text-tertiary); padding: 0 8px; font-family: var(--font-main); }
    .plan-btn:hover { border-color: #CBD5E1; }
    .plan-btn.on-attend { background: var(--success); border-color: var(--success); color: white; }
    .plan-btn.on-skip { background: var(--danger); border-color: var(--danger); color: white; }
    .plan-btn.on-cancel { background: #94A3B8; border-color: #94A3B8; color: white; }
    .plan-empty { font-size: 12px; color: var(--text-tertiary); font-style: italic; padding: 20px 0; text-align: center; }

    /* One-off class additions */
    .plan-oneoff-btn { background: none; border: 1px dashed #CBD5E1; color: var(--text-tertiary); font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-family: var(--font-main); transition: all 0.15s; display: flex; align-items: center; gap: 4px; margin: 4px 0 2px; }
    .plan-oneoff-btn:hover { border-color: var(--primary); color: var(--primary); }
    .plan-oneoff-remove { background: none; border: none; color: #EF4444; cursor: pointer; font-size: 11px; padding: 0 2px; margin-left: 2px; transition: color 0.15s; flex-shrink: 0; }
    .plan-oneoff-remove:hover { color: #DC2626; }

    /* Bottom card — results */
    .fc-bottom-card { background: white; border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); overflow: hidden; flex: 0 0 auto; min-height: 90px; transition: flex 0.45s cubic-bezier(0.4,0,0.2,1); }
    .fc-bottom-card.compact { flex: 0 0 auto; cursor: pointer; }
    .fc-bottom-card.expanded { flex: 1 1 0; overflow-y: auto; cursor: default; }
    .fc-bottom-bar { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 24px 6px; cursor: pointer; }
    .fc-bottom-current { font-size: 20px; font-weight: 800; color: var(--text-primary); }
    .fc-bottom-arrow { color: #CBD5E1; font-size: 12px; }
    .fc-bottom-forecast { font-size: 20px; font-weight: 800; transition: color 0.3s; }
    .fc-bottom-delta { padding: 3px 10px; border-radius: 16px; font-size: 12px; font-weight: 800; }
    .fc-bottom-delta.positive { background: #ECFDF5; color: #059669; }
    .fc-bottom-delta.negative { background: #FEF2F2; color: #DC2626; }
    .fc-bottom-delta.neutral { background: #F8FAFC; color: var(--text-secondary); }
    .fc-bottom-hint { font-size: 11px; color: var(--text-tertiary); text-align: center; padding-bottom: 4px; }
    .fc-bottom-expand { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 0 14px; }
    .fc-expand-btn { border: 1px solid #E2E8F0; background: #F8FAFC; padding: 5px 14px; border-radius: 8px; font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: 0.2s; font-family: var(--font-main); display: flex; align-items: center; gap: 4px; }
    .fc-expand-btn:hover { background: #EFF6FF; border-color: var(--primary); color: var(--primary); }



    /* Expanded breakdown inside bottom card */
    .fc-breakdown { padding: 0 24px 20px; display: none; }
    .fc-bottom-card.expanded .fc-breakdown { display: block; }
    .fc-breakdown-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); margin-bottom: 10px; padding-top: 4px; border-top: 1px solid #F1F5F9; }
    .fc-breakdown-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #F8FAFC; gap: 8px; }
    .fc-breakdown-row:last-child { border-bottom: none; }
    .fc-breakdown-name { font-size: 12px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .fc-breakdown-detail { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; white-space: nowrap; }
    .fc-breakdown-right { display: grid; grid-template-columns: 50px 14px 50px 50px; align-items: center; justify-items: end; gap: 2px; flex-shrink: 0; }
    .fc-breakdown-old { font-size: 12px; font-weight: 700; color: var(--text-tertiary); }
    .fc-breakdown-arrow { font-size: 10px; color: #CBD5E1; }
    .fc-breakdown-new { font-size: 13px; font-weight: 800; }
    .fc-breakdown-delta { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
    .fc-breakdown-delta.pos { color: #059669; background: #ECFDF5; }
    .fc-breakdown-delta.neg { color: #DC2626; background: #FEF2F2; }
    .fc-breakdown-delta.neu { color: var(--text-secondary); background: #F1F5F9; }
    .fc-bottom-collapse { display: none; text-align: center; padding: 8px 0 16px; font-size: 11px; font-weight: 600; color: var(--text-tertiary); cursor: pointer; }
    .fc-bottom-card.expanded .fc-bottom-collapse { display: block; }
    .fc-bottom-card.expanded .fc-bottom-expand { display: none; }

    @media (max-width: 500px) { .desktop-only-title { display: none; } }

    /* Tutorial Modal */
    .fc-tut-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 4000; display: none; opacity: 0; transition: opacity 0.2s ease; }
    .fc-tut-overlay.active { display: block; opacity: 1; }
    .fc-tut-modal { position: fixed; z-index: 4001; left: 50%; top: 50%; translate: -50% -50%; width: 90vw; max-width: 400px; background: white; border-radius: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); display: none; flex-direction: column; opacity: 0; transform: translateY(20px) scale(0.95); transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16,1,0.3,1); overflow: hidden; }
    .fc-tut-modal.visible { opacity: 1; transform: translateY(0) scale(1); }
    .fc-tut-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #F1F5F9; background: #F8FAFC; }
    .fc-tut-title { font-size: 16px; font-weight: 800; color: #1E293B; }
    .fc-tut-content { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-height: 70vh; overflow-y: auto; }
    .fc-step-block { display: flex; gap: 14px; }
    .fc-step-badge.tut { width: 28px; height: 28px; font-size: 14px; background: #EFF6FF; color: #2563EB; flex-shrink:0; border: 1px solid #BFDBFE; display: flex; }
    .fc-step-text strong { display: block; font-size: 14px; color: #1E293B; margin-bottom: 4px; }
    .fc-step-text p { font-size: 12.5px; color: #475569; line-height: 1.5; margin: 0; }
    .fc-tut-chips { display: flex; gap: 8px; margin: 10px 0; overflow-x: auto; padding-bottom: 4px; }
    .fc-tut-chip { font-size: 10px; font-weight: 700; padding: 4px; border-radius: 6px; display: flex; align-items: center; gap: 4px; white-space: nowrap; flex: 1; justify-content: center; }
    .fc-tut-chip.attend { color:#2563EB; background:#EFF6FF; }
    .fc-tut-chip.skip { color:#F59E0B; background:#FEF3C7; }
    .fc-tut-chip.cancel { color:#DC2626; background:#FEF2F2; }
    .fc-tut-footer { padding: 16px 24px; border-top: 1px solid #F1F5F9; background: white; }
    .fc-tut-btn { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-size: 14px; font-weight: 700; font-family: var(--font-main); cursor: pointer; transition: transform 0.15s, opacity 0.15s; }
    .fc-tut-btn:active { transform: scale(0.97); opacity: 0.9; }

    /* Inline confirmation toast */
    .plan-confirm-toast {
        position: absolute; right: 20px; bottom: 12px;
        display: inline-flex; align-items: center; gap: 4px;
        font-size: 10px; font-weight: 700; color: #059669;
        background: #ECFDF5; border: 1px solid #A7F3D0;
        padding: 2px 8px; border-radius: 6px;
        opacity: 0; transition: opacity 0.25s;
        pointer-events: none; white-space: nowrap;
    }
    .plan-confirm-toast.visible { opacity: 1; }
    .plan-confirm-toast.warn { color: #D97706; background: #FFFBEB; border-color: #FDE68A; }

    /* Full list cascading entrance animation */
    @keyframes dayCascade {
        0% { opacity: 0; transform: translateY(16px) scale(0.98); }
        100% { opacity: 1; transform: translateY(0) scale(1); }
    }
    .plan-day-section.animate-cascade {
        animation: dayCascade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    /* Timetable scroll hints */
    .tt-grid-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
    .tt-scroll-hint {
        display: none; position: absolute; top: 50%; translate: 0 -50%;
        width: 26px; height: 26px; border-radius: 50%;
        background: rgba(15,23,42,0.4); color: white;
        align-items: center; justify-content: center; font-size: 10px;
        z-index: 10; cursor: pointer;
        box-shadow: 0 1px 4px rgba(0,0,0,0.12);
        transition: background 0.2s, opacity 0.25s;
    }
    .tt-scroll-hint.right { right: -2px; animation: scrollNudgeR 2.4s ease-in-out infinite; }
    .tt-scroll-hint.left { left: -2px; animation: scrollNudgeL 2.4s ease-in-out infinite; }
    .tt-scroll-hint:hover { background: rgba(15,23,42,0.7); }
    .tt-scroll-hint.active { display: flex; }
    @keyframes scrollNudgeR {
        0%, 100% { opacity: 0.5; transform: translateX(0); }
        50% { opacity: 0.8; transform: translateX(2px); }
    }
    @keyframes scrollNudgeL {
        0%, 100% { opacity: 0.5; transform: translateX(0); }
        50% { opacity: 0.8; transform: translateX(-2px); }
    }

    /* ===== DEMO MODE ONLY CSS ===== */
    .view-demo {
        display: none;
        padding: 32px 20px;
        max-width: 900px;
        margin: 0 auto;
    }

    .demo-card {
        background: white;
        border-radius: 20px;
        padding: 24px;
        border: 1px solid #E2E8F0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        margin-bottom: 20px;
    }

    .launch-btn {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        background: #0F172A;
        color: white;
        padding: 16px 32px;
        border-radius: 16px;
        font-weight: 700;
        font-size: 15px;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .launch-btn:hover {
        background: #1E293B;
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .mock-pdf-wrapper {
        width: 100%;
        overflow: hidden;
        border: 1px solid #94A3B8;
        border-radius: 2px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        background: white;
    }

    .mock-pdf-container {
        width: 600px;
        transform-origin: top left;
        padding: 0;
        padding-bottom: 20px;
        font-family: 'Times New Roman', Georgia, serif;
        font-size: 13px;
        color: #000;
        position: relative;
        line-height: 1.5;
    }

    @media (max-width: 600px) {
        .view-demo {
            padding: 24px 12px;
        }

        .demo-card {
            padding: 16px 12px;
        }
    }

    .pdf-title {
        text-align: center;
        font-size: 20px;
        font-weight: bold;
        padding: 20px 16px 14px;
    }

    .pdf-meta-row {
        display: flex;
        padding: 2px 24px;
        font-size: 13px;
    }

    .pdf-meta-label {
        font-weight: bold;
        min-width: 260px;
        flex-shrink: 0;
    }

    .pdf-meta-value {
        font-weight: normal;
    }

    .pdf-duration {
        padding: 10px 24px 12px;
        font-size: 13px;
    }

    .pdf-duration span {
        font-weight: bold;
    }

    .pdf-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 12px;
    }

    .pdf-table th {
        border: 1px solid #000;
        padding: 6px 8px;
        font-weight: bold;
        text-align: center;
        background: white;
    }

    .pdf-table td {
        border: 1px solid #000;
        padding: 5px 8px;
        text-align: center;
    }

    .pdf-table td:nth-child(2) {
        text-align: left;
    }

    .laser-scanner {
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, transparent, #3B82F6, transparent);
        animation: scanLine 2.5s ease-in-out infinite;
    }

    @keyframes scanLine {

        0%,
        100% {
            top: 0;
            opacity: 0;
        }

        10% {
            opacity: 1;
        }

        90% {
            opacity: 1;
        }

        50% {
            top: calc(100% - 2px);
        }
    }

    .tour-backdrop {
        position: fixed;
        inset: 0;
        z-index: 5000;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.35s ease;
    }

    .tour-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .tour-spotlight {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 5001;
        border-radius: 16px;
        box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        pointer-events: none;
        opacity: 0;
    }

    .tour-popover {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 5002;
        background: white;
        border-radius: 20px;
        padding: 24px;
        max-width: 360px;
        width: calc(100% - 32px);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        pointer-events: none;
    }

    .tour-popover.visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .tour-popover-arrow {
        position: absolute;
        width: 12px;
        height: 12px;
        background: white;
        transform: rotate(45deg);
        box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
    }

    .tour-step-badge {
        display: inline-block;
        background: #F1F5F9;
        color: var(--text-tertiary);
        font-size: 11px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 20px;
        margin-bottom: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .tour-title {
        font-size: 18px;
        font-weight: 800;
        color: var(--text-primary);
        margin-bottom: 6px;
    }

    .tour-desc {
        font-size: 13px;
        color: var(--text-secondary);
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .tour-skip {
        font-size: 12px;
        color: var(--text-tertiary);
        background: none;
        border: none;
        cursor: pointer;
        font-weight: 600;
        padding: 4px 0;
        transition: color 0.2s;
        font-family: var(--font-main);
    }

    .tour-skip:hover {
        color: var(--text-secondary);
    }

    .tour-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .tour-dots {
        display: flex;
        gap: 6px;
    }

    .tour-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #E2E8F0;
        transition: background 0.2s;
    }

    .tour-dot.active {
        background: var(--primary);
    }

    .tour-btn {
        padding: 8px 16px;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
    }

    .tour-btn-back {
        background: #F1F5F9;
        color: var(--text-secondary);
    }

    .tour-btn-next {
        background: var(--primary);
        color: white;
    }

    .tour-btn-next:hover {
        background: #2563EB;
    }

    @media (max-width: 500px) {
        .tour-popover {
            max-width: calc(100% - 32px);
            padding: 18px;
        }

        .tour-title {
            font-size: 16px;
        }

        .tour-desc {
            font-size: 12px;
        }
    }

/* ========== MIGRATION TOAST STYLES ========== */

        /* Base Toast Styles */
        #migration-toast {
            position: fixed;
            background: #FFFFFF;
            border: 1px solid #E2E8F0;
            border-radius: 20px;
            z-index: 9999;
            font-family: 'DM Sans', sans-serif;
            opacity: 0;
            display: none;
            flex-direction: column;
        }

        /* Modal Variant - Center Stage */
        #migration-toast.mt-modal {
            top: 50%;
            left: 50%;
            width: calc(100% - 48px);
            max-width: 420px;
            box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
            padding: 24px;
            transform: translate(-50%, -45%) scale(0.95);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
            gap: 14px;
        }
        #migration-toast.mt-modal.visible {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }

        /* Toast Variant - Bottom Right */
        #migration-toast.mt-toast {
            bottom: 24px;
            right: 24px;
            width: calc(100% - 48px);
            max-width: 400px;
            box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1), 0 8px 16px rgba(15, 23, 42, 0.05);
            padding: 20px;
            transform: translateY(150%);
            opacity: 0;
            transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
            gap: 12px;
        }
        #migration-toast.mt-toast.visible {
            opacity: 1;
            transform: translateY(0);
        }

        /* Elements */
        .mt-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }
        .mt-icon {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: #EFF6FF;
            color: #3B82F6;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            flex-shrink: 0;
        }
        .mt-toast .mt-icon {
            width: 36px; height: 36px; border-radius: 10px; font-size: 16px;
        }
        .mt-title {
            font-size: 15px;
            font-weight: 800;
            color: #0F172A;
            line-height: 1.4;
            margin-top: 0px;
        }
        .mt-toast .mt-title { font-size: 14px; }
        .mt-title code {
            background: #F1F5F9;
            padding: 2px 6px;
            border-radius: 6px;
            color: #2563EB;
            font-family: monospace;
            font-size: 12.5px;
        }
        .mt-close {
            background: none;
            border: none;
            color: #94A3B8;
            cursor: pointer;
            font-size: 18px;
            padding: 4px;
            border-radius: 6px;
            transition: all 0.2s;
            line-height: 1;
            margin-top: -2px;
            margin-right: -4px;
        }
        .mt-close:hover {
            background: #F1F5F9;
            color: #0F172A;
        }
        .mt-body {
            font-size: 13.5px;
            color: #475569;
            line-height: 1.5;
            padding-left: 52px;
        }
        .mt-toast .mt-body { font-size: 13px; padding-left: 48px; }
        
        .mt-actions {
            display: flex;
            gap: 10px;
            padding-left: 52px;
            margin-top: 6px;
        }
        .mt-toast .mt-actions { padding-left: 48px; margin-top: 4px; }
        
        .mt-btn {
            padding: 12px 18px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            text-decoration: none !important;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border: none;
            font-family: inherit;
            width: 100%;
            justify-content: center;
        }
        .mt-toast .mt-btn { padding: 10px 16px; font-size: 13.5px; }
        
        .mt-btn-primary {
            background: #25D366;
            color: #FFFFFF !important;
            box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
        }
        .mt-btn-primary:hover {
            background: #1EBE5C;
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(37, 211, 102, 0.3);
            color: #FFFFFF !important;
        }
        @media (max-width: 600px) {
            #migration-toast.mt-modal {
                width: calc(100% - 32px);
                padding: 20px;
            }
            #migration-toast.mt-toast {
                top: 12px; bottom: auto; right: 12px; left: 12px; width: auto; padding: 12px;
                transform: translateY(-150%);
            }
            #migration-toast.mt-toast.visible {
                transform: translateY(0);
            }
            .mt-body, .mt-actions {
                padding-left: 0 !important;
            }
            .mt-header {
                align-items: flex-start;
            }
            .mt-icon {
                width: 32px !important; height: 32px !important; font-size: 14px !important; 
            }
            .mt-title { font-size: 13.5px !important; }
            .mt-title code { font-size: 12px !important; padding: 1px 6px !important;}
            .mt-body { margin-top: -6px; font-size: 12.5px !important; line-height: 1.35; }
            .mt-actions { margin-top: 6px !important; }
            .mt-btn { padding: 10px 12px !important; font-size: 13px !important; }
            .mt-close { font-size: 16px; margin-top: 0; padding: 0;}
        }