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

    body.no-scroll {
        overflow: hidden;
        height: 100vh;
        touch-action: none;
    }

    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        background: #f5f3ef;
        min-height: 100vh;
        overflow-x: hidden;
        padding-bottom: 100px;
        /* space so bottom AI card does not overlap content */
    }

    .header {
        background: #ffffff;
        padding: 23px 16px 6px;
        border-bottom: 2px solid #e0e0e0;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .header.expanded {
        padding-bottom: 30px;
    }

    .top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-width: 1200px;
        margin: 0 auto;
    }

    .left-section {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    /* HEADER ICON BUTTONS (menu + notification) - BORDER ONLY STYLE */
    .icon-btn {
        width: 44px;
        height: 44px;
        background: transparent;
        border: 2.5px solid #444444;
        border-radius: 16px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        padding: 0;
        position: relative;
        transition: background-color 0.2s ease, border-color 0.2s ease;
    }

    .icon-btn:hover {
        background-color: #f5f5f5;
        border-color: #333333;
    }

    /* MENU ICON (3-level variant) */
    .menu-mini {
        width: 20px;
        height: 16px;
        position: relative;
    }

    .menu-mini::before,
    .menu-mini::after,
    .menu-mini span {
        content: "";
        position: absolute;
        left: 0;
        height: 2.5px;
        background: #444444;
        border-radius: 4px;
    }

    .menu-mini::before {
        top: 0;
        width: 20px;
    }

    .menu-mini span {
        top: 50%;
        transform: translateY(-50%);
        width: 14px;
    }

    .menu-mini::after {
        bottom: 0;
        width: 9px;
    }

    /* NOTIFICATION ICON (border-only bell + green dot) */
    .notif-rev svg {
        width: 27px;
        height: 27px;
        color: #444444;
    }

    .notif-dot {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 7px;
        height: 7px;
        background-color: rgb(255, 0, 0);
        border-radius: 25px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .notif-dot::before {
        content: "";
        position: absolute;
        width: 2px;
        height: 2px;
        background-color: rgb(255, 0, 0);
        border-radius: 35px;
        animation: notifPulse 1s infinite;
    }

    @keyframes notifPulse {
        0% {
            background-color: rgb(255, 0, 1);
            width: 2px;
            height: 2px;
        }

        100% {
            background-color: rgba(255, 0, 0, 0);
            width: 26px;
            height: 26px;
        }
    }

    .brand-container {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .brand-name {
        font-size: 18px;
        font-weight: 700;
        color: #2d3436;
        letter-spacing: 0.5px;
        line-height: 1;
    }

    .tagline {
        font-size: 11px;
        font-weight: 300;
        color: #7f8c8d;
        line-height: 1;
    }

    .expand-section {
        max-width: 1200px;
        margin: 0 auto;
    }

    .expand-arrow {
        display: flex;
        justify-content: center;
        margin-top: 2px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .expand-arrow svg {
        width: 24px;
        height: 24px;
        stroke: #95a5a6;
        transition: all 0.3s ease;
    }

    .expand-arrow:hover svg {
        stroke: #2d3436;
    }

    .expand-arrow.rotated svg {
        transform: rotate(180deg);
    }

    .expanded-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        color: #2d3436;
    }

    .expanded-content.show {
        max-height: 600px;
    }

    .content-inner {
        padding: 30px 20px 10px;
    }

    .info-section {
        margin-bottom: 25px;
    }

    .info-section h3 {
        font-size: 18px;
        margin-bottom: 10px;
        color: #2d3436;
        font-weight: 600;
    }

    .info-section p {
        font-size: 14px;
        line-height: 1.7;
        color: #5a6c7d;
        font-weight: 400;
    }

    .features {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        margin-top: 15px;
    }

    .feature-card {
        background: #f8f9fa;
        padding: 20px;
        border-radius: 12px;
        border: 1px solid #e9ecef;
        transition: all 0.3s ease;
    }

    .feature-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    }

    .feature-card h4 {
        font-size: 15px;
        margin-bottom: 8px;
        color: #2d3436;
        font-weight: 600;
    }

    .feature-card p {
        font-size: 13px;
        color: #5a6c7d;
        font-weight: 400;
        line-height: 1.5;
    }

    .content-body {
        max-width: 1200px;
        margin: 0 auto;
        padding: 16px 16px;
    }


    /* HERO / WELCOME AREA – illustration as background on right */
    .welcome-section {
        margin: -12px -16px 28px;
        padding: 16px 16px 20px;
        background-color: #f5f3ef;
        background-image: url("Image/Illustration.png");
        /* change path as needed */
        background-repeat: no-repeat;
        background-position: right bottom;
        background-size: auto 300px;
    }

    .welcome-content {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .welcome-text-content {
        max-width: 85%;
    }

   .welcome-text-content h3 {
        font-size: 25px;
        font-weight: 600;
        color: #2d3436;
        margin-bottom: 10px;
   }

    .attendance-ring {
        position: relative;
        width: 140px;
        height: 140px;
        margin-top: 14px;
        margin-left: 15px;
    }

    .ring-svg {
        width: 100%;
        height: 100%;
        transform: rotate(-90deg);
    }

    .ring-bg-circle {
        fill: none;
        stroke: #e8e5df;
        stroke-width: 18;
    }

    .ring-progress-circle {
        fill: none;
        stroke: #F4C542;
        stroke-width: 18;
        stroke-linecap: round;
        transition: stroke-dashoffset 0.5s ease;
    }

    .ring-center {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
    }

    .percentage {
        font-size: 32px;
        font-weight: 700;
        color: #2d3436;
        display: block;
    }

    .percentage-label {
        font-size: 12px;
        color: #8e8e93;
        font-weight: 500;
    }

    .fade-text {
        opacity: 0;
        transition: opacity 0.35s ease;
    }

    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    .section-header h3 {
        font-size: 20px;
        font-weight: 600;
        color: #2d3436;
    }

    .view-all {
        font-size: 14px;
        color: #8e8e93;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 6px;
        font-weight: 500;
        transition: color 0.3s ease;
    }

    .view-all:hover {
        color: #2d3436;
    }


    .full-bleed {
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }


/* --- NEW TIMELINE & FOCUS MODE CSS --- */
.schedule-window {
    height: 260px; /* Kept original height */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.schedule-window::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(253, 251, 247, 0) 0%, rgba(253, 251, 247, 1) 100%);
    z-index: 20;
    pointer-events: none;
}

.scroll-area {
    overflow-y: auto;
    padding: 10px 12px 20px 20px; /* Critical padding for focus mode */
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #E5E7EB transparent;
    scroll-behavior: smooth;
}

.timeline-line {
    position: absolute;
    left: 18px;
    top: 10px; bottom: 20px;
    width: 2px;
    background: #E5E7EB;
    z-index: 0;
    transition: opacity 0.2s ease;
}

/* --- ITEM WRAPPER --- */
.class-item {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dot {
    position: absolute;
    left: -8px; top: 6px;
    width: 10px; height: 10px;
    background: #FFFFFF;
    border: 2px solid #9CA3AF;
    border-radius: 50%;
    z-index: 2;
    transition: opacity 0.2s;
}

/* --- COMPACT VIEW --- */
.view-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
}

.time-compact { font-size: 0.85rem; font-weight: 600; color: #6B7280; width: 60px; }
.subject-compact { font-size: 0.9rem; font-weight: 600; color: #1F2937; flex-grow: 1; }

.status-tag { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; display: none; }
.tag-green { color: #15803D; background: #DCFCE7; display: inline-block; }
.tag-red { color: #991B1B; background: #FEE2E2; display: inline-block; }
.tag-gray { color: #4B5563; background: #F3F4F6; display: inline-block; }

.class-item.is-past .view-compact { opacity: 0.6; }
.class-item.is-past .subject-compact { text-decoration: line-through; }
.class-item.is-past .dot { background: #D1D5DB; border-color: #D1D5DB; }

/* --- EXPANDED VIEW --- */
.view-expanded { display: none; }
.class-item.active .view-compact { display: none; }
.class-item.active .view-expanded { display: block; animation: fadeIn 0.3s; }
.class-item.active .dot { border-color: #8B80F9; background: #8B80F9; width: 12px; height: 12px; left: -9px; top: 18px; }

.active-card-style {
    background-color: #F9FAFB;
    margin: 0 0 0 -5px;
    padding: 15px;
    border-left: 4px solid #8B80F9;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    min-height: 105px;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.row-header { display: flex; justify-content: space-between; align-items: flex-start; }
.time-text { font-size: 0.85rem; font-weight: 700; color: #6B7280; display: block; margin-bottom: 2px; }
.active-time { color: #6366F1; }
.subject-text { font-size: 1rem; font-weight: 700; color: #111827; margin: 0; }
.details-text { font-size: 0.85rem; color: #6B7280; margin-top: 2px; }

.btn-container { display: flex; gap: 8px; margin-top: 10px; }
.choice-btn {
    flex: 1; padding: 8px 0; border-radius: 8px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; background: transparent;
    transition: all 0.2s;
}
.btn-attend { background-color: #F0FDF4; color: #15803D; border: 1px solid #DCFCE7; }
.btn-skip { background-color: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.btn-na { background-color: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }

.edit-status-link {
    font-size: 0.75rem; color: #6366F1; font-weight: 600; cursor: pointer;
    text-decoration: underline; margin-top: 8px; display: inline-block;
}

/* --- REMARKS INTERNAL STYLES --- */
.remark-label { font-size: 0.75rem; color: #6B7280; font-weight: 600; margin-top: 8px; display: block; margin-bottom: 2px; }
.remark-input-line {
    width: 100%; background: transparent; border: none;
    border-bottom: 2px solid #D1D5DB;
    font-family: inherit; font-size: 0.95rem; color: #1F2937;
    padding: 4px 0; outline: none; border-radius: 0;
}
.remark-input-line:focus { border-bottom: 2px solid #8B80F9; }
.remark-input-line::placeholder { color: #D1D5DB; }

.remark-footer { margin-top: 10px; display: flex; justify-content: flex-end; }
.btn-action-small {
    padding: 6px 24px; border-radius: 6px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none;
}
.btn-mode-skip { background: #F3F4F6; color: #6B7280; }
.btn-mode-save { background: #8B80F9; color: #FFFFFF; }

/* Button Loader Spinner */
.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- FOCUS MODE ANIMATION STATES --- */
.scroll-area.focus-mode .timeline-line { opacity: 0; }
.scroll-area.focus-mode .class-item { opacity: 0.3; transform: scale(0.99); pointer-events: none; }

/* THE ACTIVE ITEM IN FOCUS */
.scroll-area.focus-mode .class-item.focused-item {
    opacity: 1; transform: scale(1); pointer-events: auto;
    padding-left: 0; z-index: 10;
}
.scroll-area.focus-mode .class-item.focused-item .dot { opacity: 0; }
.scroll-area.focus-mode .class-item.focused-item .active-card-style {
    margin-left: -8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-radius: 0px 12px 12px 0px;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }


    /* Subject Card Colors */
    .subject-card.lavender {
        background-color: #a2a8eb;
    }

    .subject-card.orange {
        background-color: #ffc266;
    }

    .subject-card.mint {
        background-color: #9cd9b9;
    }

    .subject-card.peach {
        background-color: #ffbdab;
    }

    /* Date-wise Records Styling */
    .record-card {
        background: white;
        border-radius: 20px;
        padding: 24px;
        margin-bottom: 16px;
        border: 1.5px solid #e0e0e0;
    }

    .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }

    .card-header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .status-badge {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        text-transform: capitalize;
    }

    .status-badge::before {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    .status-badge.present {
        background: #e6f7ed;
        color: #2e7d32;
    }

    .status-badge.present::before {
        background: #4ade80;
    }

    .status-badge.absent {
        background: #fff0f0;
        color: #d84315;
    }

    .status-badge.absent::before {
        background: #ef4444;
    }

    .status-badge.not-held {
        background: #f5f5f5;
        color: #616161;
    }

    .status-badge.not-held::before {
        background: #bdbdbd;
    }

    .edit-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        background: white;
        border: 1.5px solid #e0e0e0;
        padding: 6px 16px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 500;
        color: #616161;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .edit-btn:hover {
        background: #f5f5f5;
        border-color: #bdbdbd;
    }

    .remarks-label {
        font-size: 11px;
        font-weight: 700;
        color: #9e9e9e;
        letter-spacing: 0.05em;
        margin-bottom: 4px;
    }

    .remarks-content {
        font-size: 14px;
        color: #424242;
        line-height: 1.5;
    }


    .install-strip {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        margin: 0 -20px 35px -20px;
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }

    .install-strip.hidden {
        display: none;
    }

    .install-content {
        max-width: 1200px;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .install-text {
        color: white;
        font-size: 15px;
        font-weight: 500;
        letter-spacing: 0.3px;
        cursor: pointer;
        flex: 1;
    }

    .close-strip {
        background: rgba(255, 255, 255, 0.2);
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }

    .close-strip:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    .close-strip svg {
        color: white;
    }

        /* --- NOTEBOOK SECTION CONTAINER --- */
    .notebook-section {
        /* Increased padding ensures the tilted corners don't get cut off */
        padding: -6px 1px;
        margin-bottom: 18px;
        margin-top: -16px;
        overflow: visible;
    }

    /* --- THE SHEET OF PAPER --- */
    .page {
        position: relative;
        width: 100%;
        min-height: auto;

        /* Typography */
        font-family: "Gaegu", cursive;
        font-size: 1.1rem;
        color: #2c3e50;

        /* The Paper Texture & Lines */
        background-color: #ffffff;
        background-image: linear-gradient(transparent 95%, #aebcd0 95%);
        background-size: 100% 1.2rem;
        line-height: 1.2rem;

        /* Layout - Increased left padding to 6.5rem to fit the new margin position */
        padding: 0.8rem 1rem 0.8rem 5rem;
        
        border-radius: 2px;

        /* THE PINNED EFFECT */
        transform-origin: 15px 15px;
        transform: rotate(-2deg);
        box-shadow: 5px 8px 20px rgba(0, 0, 0, 0.12);
        border: none;
    }

    /* --- THE RED MARGIN LINE --- */
    .margin {
        position: absolute;
        /* Moved to the right (5.5rem) to make space for the bigger logo */
        left: 4.5rem;
        
        top: 0;
        bottom: 0;
        width: 0;
        border-left: 2px solid #e63946;
        opacity: 0.8;
    }

    /* --- REMOVE OLD CSS PIN/DOT --- */
    .page::before {
        content: none;
    }
    .page::after {
        content: none;
    }

    /* --- CONTENT SPACING --- */
    .page p {
        margin: 0;
        padding-top: 0;
    }

    /* --- LOGO POSITIONING --- */
    .note-logo {
        position: absolute;
        
        /* Centered in the margin space */
        left: 0px;
        top: 50%;
        transform: translateY(-50%) rotate(-3deg);
        
        /* Increased Size */
        width: 72px;
        height: 72px;
        
        object-fit: contain;
        
        /* Pure Overlay - No blending */
        z-index: 20;
        pointer-events: none;
    }

    /* --- TEACHER SIGNATURE --- */
    .teacher-mark {
        position: absolute;
        bottom: 0.5rem;
        right: 1.5rem;
        transform: rotate(-8deg);
        opacity: 0.9;
    }

    .teacher-sign {
        font-family: "Cedarville Cursive", cursive;
        font-size: 1.4rem;
        color: #c62828;
        font-weight: bold;
    }




    /* MOBILE ADJUSTMENTS */
    @media (max-width: 768px) {
        .brand-name {
            font-size: 16px;
        }

        .tagline {
            font-size: 11px;
        }

        .features {
            grid-template-columns: 1fr;
        }

        .welcome-section {
            background-size: auto 275px;
        }

        .attendance-ring {
            width: 120px;
            height: 120px;
        }

        .percentage {
            font-size: 28px;
        }

        .class-card {
            min-width: 280px;
        }

        .subject-grid {
            grid-template-columns: 1fr;
        }
    }

    /* ---------- AI BOARD (BOTTOM SHEET) ---------- */

    .ai-board-overlay {
        position: fixed;
        inset: 0;
        z-index: 900;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        pointer-events: none;
    }

    .ai-board {
        pointer-events: auto;
        width: min(600px, 100%);
        height: 80vh;
        margin: 0 auto;
        border-radius: 24px 24px 0 0;
        padding: 20px 20px 16px;

        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 24px 40px rgba(15, 23, 42, 0.25);

        backdrop-filter: blur(24px) saturate(140%);
        -webkit-backdrop-filter: blur(24px) saturate(140%);

        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        opacity: 0;
        transition: transform 0.28s ease-out, opacity 0.28s ease-out;
    }

    .ai-board.visible {
        transform: translateY(0);
        opacity: 1;
    }

    .ai-board-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
    }

    .ai-title {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        letter-spacing: 0.02em;
        background: linear-gradient(120deg, #8b5cf6, #fda4af);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .ai-close-btn {
        border: none;
        outline: none;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 999px;
        width: 32px;
        height: 32px;
        font-size: 20px;
        font-weight: 500;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
        transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    }

    .ai-close-btn:hover {
        background: rgba(255, 255, 255, 0.95);
        transform: translateY(-1px);
    }

    .ai-close-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    }

    .ai-board-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 16px;
        font-size: 14px;
        overflow-y: auto;
    }

    .ai-user-card-wrapper {
        display: flex;
        justify-content: flex-end;
    }

    .ai-user-card {
        max-width: 80%;
        padding: 12px 16px;
        border-radius: 18px;
        border: 1px solid rgba(255, 255, 255, 0.85);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
        line-height: 1.4;
    }

    .ai-status-row {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: #1f2933;
    }

    .ai-status-text {
        font-weight: 500;
        letter-spacing: 0.02em;
    }

    .ai-response {
        font-size: 14px;
        line-height: 1.5;
        color: #020617;
        padding-top: 10px;
        white-space: pre-wrap;
    }

    .ai-copy-btn {
        margin-top: 6px;
        align-self: flex-start;
        display: inline-flex;
        align-items: center;
        gap: 6px;

        padding: 6px 10px;
        border-radius: 999px;
        border: 1px solid rgba(148, 163, 184, 0.6);
        background: rgba(255, 255, 255, 0.9);
        font-size: 12px;
        color: #0f172a;
        cursor: pointer;
        transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    }

    .ai-copy-btn:hover {
        background: #ffffff;
        box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
        transform: translateY(-1px);
    }

    .ai-copy-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25);
    }

    /* BOARD LOADER */

    .ai-status-loader {
        transform: rotate(80deg);
        max-width: 30px;
        max-height: 30px;
    }

    .ai-status-loader .stripe {
        display: inline-block;
        width: 3px;
        height: 14px;
        animation: aiStatusLoaderAnim 1.2s ease-in-out infinite;
    }

    .ai-status-loader .stripe:nth-child(1) {
        background-color: #8b5cf6;
        animation-delay: 0.15s;
        margin-bottom: -5px;
    }

    .ai-status-loader .stripe:nth-child(2) {
        background-color: #fda4af;
        animation-delay: 0.3s;
        margin-bottom: 5px;
    }

    .ai-status-loader .stripe:nth-child(3) {
        background-color: #c4b5fd;
        animation-delay: 0.45s;
        margin-bottom: -7px;
    }

    .ai-status-loader .stripe:nth-child(4) {
        background-color: #f9a8d4;
        animation-delay: 0.6s;
        margin-bottom: 7px;
    }

    @keyframes aiStatusLoaderAnim {
        20% {
            transform: scale(1, 2.2);
        }

        40% {
            transform: scale(1);
        }
    }

    /* ---------- FIXED AI CARD CONTAINER ---------- */

    .ai-card-container {
        position: fixed;
        bottom: 16px;
        left: 0;
        right: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 0 17px;
        z-index: 1000;
        pointer-events: none;
    }

    .ai-card-container .see-more-btn {
        pointer-events: auto;
    }

    /* ---------- AI CARD ---------- */

    .see-more-btn {
        position: relative;
        background-color: #262626;
        height: 4.5rem;
        width: 100%;
        max-width: 540px;
        text-align: left;
        padding: 0.75rem;
        color: #f9fafb;
        font-size: 1rem;
        font-weight: 700;
        border-radius: 0.8rem;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.5s ease;
        transform-origin: left;
        background-clip: padding-box;
        text-decoration: none;

        display: flex;
        align-items: center;
        gap: -2rem;
    }

    .see-more-btn::before,
    .see-more-btn::after {
        content: "";
        position: absolute;
        border-radius: 9999px;
        filter: blur(16px);
        z-index: 10;
        transition: all 0.5s ease;
        pointer-events: none;
    }

    .see-more-btn::before {
        width: 3rem;
        height: 3rem;
        right: 0.25rem;
        top: 0.25rem;
        background-color: #8b5cf6;
    }

    .see-more-btn::after {
        width: 5rem;
        height: 5rem;
        right: 2rem;
        top: 0.75rem;
        background-color: #fda4af;
    }

    .see-more-btn:hover {
        border-color: #fecdd3;
        text-decoration: none;
        color: #f9fafb;
    }

    .see-more-btn:hover::before {
        right: 3rem;
        bottom: -2rem;
        top: auto;
        filter: blur(8px);
        box-shadow: 20px 20px 20px 30px #a21caf;
    }

    .see-more-btn:hover::after {
        right: -2rem;
    }

    .divider {
        width: 2px;
        height: 18px;
        background: rgba(255, 255, 255, 0.7);
        border-radius: 4px;
        margin-left: 1rem;
        margin-right: 0.5rem;
    }

    .prompt-area {
        position: relative;
        z-index: 20;
        flex: 1;
        display: flex;
        align-items: center;
        overflow: hidden;
    }

    .prompt-display {
        flex: 1;
        position: relative;
        display: flex;
        align-items: center;
    }

    .typewriter-text {
        font-family: "Courier New", Courier, monospace;
        font-size: 1.05rem;
        letter-spacing: -1px;
        white-space: nowrap;
        overflow: hidden;
        border-right: 2px solid #f9fafb;
        padding-right: 2px;
        box-sizing: border-box;
        animation: blink-caret 0.8s step-end infinite;
    }

    @keyframes blink-caret {

        from,
        to {
            border-color: transparent;
        }

        50% {
            border-color: #f9fafb;
        }
    }

    .prompt-input {
        display: none;
        letter-spacing: 0;
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
        font-family: "Poppins", system-ui, sans-serif;
        font-size: 1rem;
        color: #f9fafb;
    }

    .prompt-input::placeholder {
        color: #9ca3af;
    }

    .send-btn {
        display: none;
        margin-left: 0.5rem;
        width: 2rem;
        height: 2rem;
        border-radius: 9999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: #ffffff;
        font-size: 1.1rem;
        font-weight: 600;
        align-items: center;
        justify-content: center;
        padding: 0;
        cursor: pointer;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .send-btn.visible {
        display: flex;
    }

    .logo-loader-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ==================================================
   AI Card – WebP Loader
   ================================================== */
    .ai-loader-webp {
        width: 56px;
        height: auto;
        display: block;
        margin: 0 auto;
        pointer-events: none;
        user-select: none;
    }


    /* ---------------- PERIODICAL RECORDS SECTION STYLES ---------------- */

    :root {
        --page-bg: #ffffff;
        --text-main: #111827;
        --text-muted: #6b7280;

        --metric-bg: #ffe3ec;
        --metric-border: #f8cfdc;
        --metric-accent: #ff4f7d;

        /* summary card sky-blue background */
        --info-bg: linear-gradient(135deg, #e0f2ff 0%, #bfdbfe 100%);
        --info-border: rgba(148, 163, 184, 0.5);

        /* keep yellow subject background */
        --subject-2-bg: #ffc460;

        --card-radius: 18px;
        --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
    }

    .periodical-section {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 40px;
    }

    .periodical-header {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 8px;
    }

    .periodical-header h2 {
        font-size: 22px;
        font-weight: 700;
        color: #2d3436;
    }

    /* DATE PICKER */
    .date-picker-container {
        max-width: 420px;
        width: 100%;
    }

    .custom-flatpickr {
        position: relative;
    }

    .custom-flatpickr input {
        width: 100%;
        padding: 12px 16px;
        padding-right: 52px;
        font-size: 15px;
        color: transparent;
        background: #ffffff;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        outline: none;
        transition: all 0.2s ease;
        cursor: pointer;
        caret-color: transparent;
    }

    .custom-flatpickr input:hover {
        border-color: #9ca3af;
        box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6);
    }

    .custom-flatpickr input:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.7);
    }

    .custom-flatpickr input::placeholder {
        color: transparent;
    }

    .date-display {
        position: absolute;
        left: 16px;
        right: 52px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        font-weight: 500;
    }

    .date-part {
        color: var(--text-main);
        white-space: nowrap;
        position: relative;
        padding-bottom: 2px;
    }

    .date-part.empty {
        color: #9ca3af;
    }

    .date-part::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: #9ca3af;
        opacity: 0.7;
    }

    .date-separator {
        color: #9ca3af;
        font-weight: 600;
        flex-shrink: 0;
    }

    .calendar-icon {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        font-size: 20px;
        transition: color 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-icon svg {
        width: 20px;
        height: 20px;
    }

    .custom-flatpickr input:hover~.calendar-icon,
    .custom-flatpickr input:focus~.calendar-icon {
        color: #4b5563;
    }

    .date-picker-helper {
        margin-top: 6px;
        font-size: 12px;
        color: var(--text-muted);
        margin-left: auto;
        width: fit-content;
        padding-right: 215px;
    }

    /* BENTO GRID */
    .bento-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
        margin-top: 16px;
    }

    /* Base card */
    .card {
        border-radius: var(--card-radius);
        padding: 8px 16px 14px;
        box-shadow: var(--shadow-soft);
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        overflow: hidden;
        border: none;
        position: relative;
    }

    .card-title {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 6px;
    }

    .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .card-footer {
        margin-top: 8px;
        text-align: center;
        font-size: 12px;
        color: var(--text-muted);
    }

    .span-2 {
        grid-column: span 2;
    }

    .span-full {
        grid-column: 1 / -1;
    }

    /* Metric cards */
    .metric-card {
        background: transparent;
        /* no fill, show page background */
        border: 1px solid #e5e7eb;
        /* light border only */
        box-shadow: none;
        /* remove shadow just for metric cards */
    }

    .metric-icon {
        position: absolute;
        top: 12px;
        right: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0.9;
    }

    .metric-icon svg {
        width: 22px;
        height: 22px;
    }



    /* Edit pencil for major card */
    .major-edit-icon {
        position: absolute;
        left: 14px;
        bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0.9;
    }

    .major-edit-icon svg {
        width: 24px;
        height: 24px;
    }


    /* Circle graph */
    .circle-shell {
        width: 95%;
        max-width: 300px;
        aspect-ratio: 1 / 1;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .circle-shell svg {
        width: 100%;
        height: 100%;
        transform: rotate(-90deg);
    }

    .circle-outer-ring {
        fill: none;
        stroke: #111827;
        stroke-width: 8;
        opacity: 0.15;
    }

    .circle-inner-value {
        fill: none;
        stroke: #9a7acf;
        stroke-width: 8;
        stroke-linecap: round;
        stroke-dasharray: 377;
        stroke-dashoffset: 94;
    }

    .circle-center {
        position: absolute;
        width: 52%;
        height: 52%;
        background: #fff5f8;
        border-radius: 999px;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    }

    .circle-center span {
        font-size: 22px;
        font-weight: 700;
        color: #111827;
    }

    /* Half circle */
    .half-shell {
        margin-top: 10px;
        width: 105%;
        max-width: 360px;
        aspect-ratio: 2 / 1;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        margin-bottom: 0;
    }

    .half-shell svg {
        width: 100%;
        height: 100%;
    }

    .half-outer-ring {
        fill: none;
        stroke: #111827;
        stroke-width: 8;
        stroke-linecap: round;
        opacity: 0.15;
    }

    .half-inner-value {
        fill: none;
        stroke: #9776cd;
        stroke-width: 8;
        stroke-linecap: round;
        pathLength: 100;
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
    }

    .half-center-text {
        position: absolute;
        top: 83%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 22px;
        font-weight: 700;
        color: var(--text-main);
        line-height: 1;
    }

    /* Major selection panel */
    .major-modal {
        position: absolute;
        inset: 0;
        background: rgba(255, 255, 255, 0.98);
        display: none;
        z-index: 10;
        border-radius: inherit;
        padding: 12px 14px 10px;
    }

    .major-modal-content {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .major-modal-subtitle {
        font-size: 12px;
        color: var(--text-muted);
        margin-bottom: 8px;
    }

    .major-modal-list {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 10px;
        overflow-y: auto;
        padding-right: 2px;
    }

    .major-modal-list label {
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        font-size: 13px;
    }

    .major-modal-list input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    .major-modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 4px;
    }

    .btn-ghost,
    .btn-primary {
        border-radius: 999px;
        padding: 4px 10px;
        font-size: 12px;
        border: none;
        cursor: pointer;
    }

    .btn-ghost {
        background: #f3f4f6;
        color: #111827;
    }

    .btn-primary {
        background: #111827;
        color: #ffffff;
    }

    /* Attendance summary card */
    .info-card {
        background: var(--info-bg);
        align-items: stretch;
        color: #0f172a;
    }

    .summary-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .summary-title {
        font-size: 15px;
        font-weight: 600;
    }

    .summary-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .summary-icon svg {
        width: 20px;
        height: 20px;
        color: #0f172a;
        opacity: 0.9;
    }

    .info-card-body {
        font-size: 13px;
        color: #0f172a;
    }

    .info-card-body ul {
        list-style: disc;
        padding-left: 18px;
        margin: 0;
    }

    .info-card-body li {
        margin-bottom: 4px;
    }

    /* Subject cards for periodical section */
    .card.subject-card {
        aspect-ratio: 1.2 / 1;
        padding: 12px 16px 14px;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        min-height: 120px;
    }

    .subject-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        max-height: 48px;
        overflow: hidden;
        margin-bottom: 4px;
    }

    .card.subject-card .subject-name {
        font-size: 14px;
        font-weight: 600;
        color: #111827;
        line-height: 1.2;
        flex: 1;
        word-break: break-word;
        white-space: normal;
        transition: font-size 0.1s ease-out;
    }

    .card.subject-card .subject-icon {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex-shrink: 0;
        width: auto;
        height: auto;
        background: none;
        margin-bottom: 0;
    }

    .card.subject-card .subject-icon svg {
        width: 22px;
        height: 22px;
    }

    .subject-meta-group {
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-top: 4px;
        flex-grow: 1;
    }

    .subject-meta {
        font-size: 12px;
        color: #374151;
        margin: 0;
        line-height: 1.4;
    }

    .card.subject-card .subject-percentage {
        position: absolute;
        right: 16px;
        bottom: 14px;
        font-size: 22px;
        font-weight: 700;
        color: #111827;
        z-index: 1;
    }

    .card.subject-card.purple {
        background: #9d9ee7;
        border: none;
    }

    .card.subject-card.mint {
        background: linear-gradient(135deg, #a8ddc4 0%, #7cc9a5 100%);
        border: none;
    }

    .card.subject-card.peach {
        background: linear-gradient(135deg, #ffccbc 0%, #ffab91 100%);
        border: none;
    }

    .card.subject-card.subject-2 {
        background: var(--subject-2-bg);
        border: none;
    }

    /* ---------------- DATE-WISE RECORDS SECTION STYLES (NEW) ---------------- */

    :root {
        --bg: #f5f5fb;
        --card-bg: #ffffff;
        --primary: #5b4bff;
        --primary-soft: #ebe9ff;
        --text-main: #222222;
        --text-muted: #777777;
        --border-soft: #e2e2f0;
        --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
        --status-present: #16a34a;
        --status-absent: #dc2626;
        --status-notheld: #6b7280;
    }

    /* .app-shell styles removed and replaced with .periodical-section */

    .app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding-top: 24px;
        /* Added padding to separate from previous section */
        margin-bottom: 8px;
    }

    .app-header .title-block {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
        min-width: 0;
    }

    .app-header h1 {
        font-size: 1.35rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        white-space: nowrap;
    }

    .app-header .subtitle {
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    .month-year-select {
        display: inline-flex;
        align-items: center;
        padding: 4px 8px;
        border-radius: 12px;
        border: 1px solid var(--border-soft);
        background: #f9fafb;
        gap: 6px;
        flex-shrink: 0;
        min-width: 0;
        max-width: 160px;
    }

    .month-year-select .edit-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        opacity: 0.9;
    }

    .month-year-select .edit-icon svg {
        width: 16px;
        height: 16px;
        display: block;
        stroke: #374151;
        /* Set a default stroke color */
        fill: #374151;
    }

    .month-year-select select {
        border: none;
        background: transparent;
        padding: 2px 0;
        font-size: 0.85rem;
        color: var(--text-main);
        outline: none;
        cursor: pointer;
        appearance: none;
        text-align: left;
        flex: 0 0 auto;
        min-width: 0;
        white-space: nowrap;
    }

    .date-strip-wrapper {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 4px;
    }

    .date-strip {
        flex: 1;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 4px 2px 2px;
        scroll-behavior: smooth;
    }

    .date-strip::-webkit-scrollbar {
        display: none;
    }

    .date-item {
        flex: 0 0 auto;
        min-width: 52px;
        border-radius: 14px;
        border: 1px solid transparent;
        padding: 8px 4px;
        background: #f3f4ff;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        cursor: pointer;
        font-size: 0.76rem;
        color: var(--text-muted);
        transition: all 0.15s ease;
        flex-shrink: 0;
    }

    .date-item .day-number {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 0.03em;
    }

    .date-item.selected {
        background: var(--primary);
        border-color: transparent;
        color: #ffffff;
        box-shadow: none;
        transform: none;
    }

    .date-item:not(.selected):hover {
        background: #e5e7ff;
        border-color: #e0e7ff;
        color: #111827;
    }

    .cards-container {
        margin-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .empty-state {
        border-radius: 20px;
        border: 1px dashed #d1d5db;
        padding: 18px;
        background: #f9fafb;
        text-align: center;
        font-size: 0.9rem;
        color: var(--text-muted);
    }

    .record-card {
        border-radius: 20px;
        padding: 14px 14px 10px;
        background: linear-gradient(135deg, #fefce8, #f9fafb);
        border: 1px solid #facc15;
        box-shadow: 0 8px 18px rgba(234, 179, 8, 0.15);
        display: flex;
        flex-direction: column;
        gap: 6px;
        position: relative;
        overflow: hidden;
    }

    .record-card:nth-child(2n) {
        background: linear-gradient(135deg, #eff6ff, #f9fafb);
        border-color: #60a5fa;
        box-shadow: 0 8px 18px rgba(37, 99, 235, 0.15);
    }

    .record-card:nth-child(3n) {
        background: linear-gradient(135deg, #f5f3ff, #f9fafb);
        border-color: #a855f7;
        box-shadow: 0 8px 18px rgba(168, 85, 247, 0.18);
    }

    .record-card:nth-child(4n) {
        background: linear-gradient(135deg, #fff7ed, #ecfdf5);
        border-color: #fb923c;
        box-shadow: 0 8px 18px rgba(251, 146, 60, 0.18);
    }

    .card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
    }

    .card-header-left {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
        flex: 1 1 0%;
    }

    .subject-name {
        font-size: 1rem;
        font-weight: 700;
    }

    /* ==== CLEAN, SINGLE-LINE INFO ROW (time | room | faculty) ==== */
    .meta-line {
        font-size: 0.82rem;
        color: #4b5563;
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 4px;
        flex-wrap: nowrap;
        /* keep in one line as much as possible */
    }

    .meta-item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        /* prevent internal wrapping */
        flex: 0 0 auto;
    }

    .meta-item.faculty {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .meta-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: transparent;
        border: none;
        outline: none;
    }

    .meta-icon svg {
        width: 16px;
        height: 16px;
        display: block;
        stroke: currentColor;
        fill: none;
        background: transparent;
    }

    .meta-text {
        font-size: 0.8rem;
    }

    .status-pill {
        border-radius: 999px;
        padding: 3px 10px;
        font-size: 0.78rem;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: rgba(31, 41, 55, 0.08);
        color: #111827;
        white-space: nowrap;
        width: 80px;
        justify-content: center;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    .status-dot {
        width: 7px;
        height: 7px;
        border-radius: 999px;
        background: currentColor;
        flex-shrink: 0;
    }

    .status-present {
        background: rgba(22, 163, 74, 0.12);
        color: var(--status-present);
    }

    .status-absent {
        background: rgba(220, 38, 38, 0.10);
        color: var(--status-absent);
    }

    .status-notheld {
        background: rgba(55, 65, 81, 0.12);
        color: var(--status-notheld);
    }

    .remarks {
        font-size: 0.84rem;
        color: #4b5563;
        margin-top: 2px;
    }

    .remarks-label {
        font-size: 0.74rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #9ca3af;
    }

    .card-footer {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-top: 8px;
    }

    .edit-card-btn {
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.55);
        padding: 6px 12px;
        font-size: 0.82rem;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        background: rgba(255, 255, 255, 0.18);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
        color: #111827;
        transition: background 0.12s, transform 0.08s, box-shadow 0.12s, border-color 0.12s;
    }

    .edit-card-btn svg {
        width: 16px;
        height: 16px;
        display: block;
        stroke: currentColor;
        fill: none;
    }

    .edit-card-btn:hover {
        background: rgba(255, 255, 255, 0.26);
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
    }

    .edit-card-btn:active {
        transform: translateY(1px) scale(0.97);
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
    }

    .edit-card-btn-label {
        font-weight: 500;
    }

    .modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.28);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
        z-index: 40;
    }

    .modal-backdrop.hidden {
        display: none;
    }

    .modal {
        width: 100%;
        max-width: 420px;
        background: #ffffff;
        border-radius: 20px;
        padding: 18px 18px 16px;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .modal h3 {
        font-size: 1.05rem;
        font-weight: 700;
    }

    .modal-subject {
        font-size: 0.9rem;
        color: var(--text-muted);
    }

    .form-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-top: 4px;
    }

    .form-group label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
    }

    .modal select,
    .modal textarea {
        border-radius: 10px;
        border: 1px solid #d1d5db;
        padding: 6px 8px;
        font-size: 0.9rem;
        outline: none;
        resize: vertical;
        min-height: 70px;
    }

    .modal select:focus,
    .modal textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 1px rgba(88, 80, 238, 0.35);
    }

    .modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 4px;
    }

    .btn {
        border-radius: 999px;
        border: 1px solid transparent;
        padding: 6px 14px;
        font-size: 0.85rem;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        transition: background 0.12s, transform 0.08s, box-shadow 0.12s;
    }

    .btn-secondary {
        background: #f9fafb;
        border-color: #e5e7eb;
        color: #374151;
    }

    .btn-secondary:hover {
        background: #e5e7eb;
    }

    .btn-primary {
        background: var(--primary);
        color: #ffffff;
        box-shadow: 0 8px 18px rgba(88, 80, 238, 0.35);
    }

    .btn-primary:hover {
        background: #4338ca;
    }

    .btn:active {
        transform: translateY(1px);
        box-shadow: none;
    }

    @media (max-width: 640px) {
        body {
            /* body background style is kept from Attenza original for consistency */
        }

        .app-shell {
            /* This class is removed in the HTML to avoid conflicts */
            padding: 16px 0 24px;
            border-radius: 0;
        }

        .app-header {
            flex-direction: row;
            align-items: center;
        }

        .app-header .title-block {
            flex: 1;
        }

        .app-header h1 {
            font-size: 1.15rem;
        }

        .card-header {
            align-items: flex-start;
        }
    }
