/* E-Notes Redesigned - Subject Cards, Weeks Modal & Content Modal with 65/35 Layout */

/* ==================== SEARCH FILTER ==================== */

.enotes-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #E3E8F1;
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    box-shadow: 0 1px 2px rgba(11, 27, 51, 0.04), 0 2px 8px rgba(11, 27, 51, 0.04);
    transition: border-color 0.2s cubic-bezier(0.22, 0.61, 0.36, 1),
                box-shadow 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.enotes-search-wrapper:focus-within {
    border-color: #0055EF;
    box-shadow: 0 0 0 3px rgba(0, 85, 239, 0.13), 0 2px 8px rgba(11, 27, 51, 0.05);
}

.search-icon {
    color: #63708A;
    font-size: 0.92rem;
    margin-right: 0.7rem;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.enotes-search-wrapper:focus-within .search-icon {
    color: #0055EF;
}

.enotes-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #0B1B33;
    background: transparent;
}

.enotes-search-input::placeholder {
    color: #9AA5B8;
    font-weight: 400;
}

.enotes-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 0.4rem;
    padding: 0;
    background: #EFF2F8;
    border: none;
    border-radius: 50%;
    color: #4B5B76;
    font-size: 0.68rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.enotes-search-clear:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #DC2626;
}

.enotes-search-clear:active {
    transform: scale(0.92);
}

.enotes-search-clear:focus-visible {
    outline: 2px solid #0055EF;
    outline-offset: 2px;
}

.enotes-search-stats {
    margin-top: 0.55rem;
    min-height: 1.15rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #63708A;
    letter-spacing: 0.01em;
}

/* Searching found nothing: say what was tried, and offer the way back. */
.no-results-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 3rem 1.5rem;
    margin: 0;
    background: rgba(255, 255, 255, 0.7);
    border: 1px dashed #E3E8F1;
    border-radius: 20px;
    text-align: center;
}

.no-results-state i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 0.85rem;
    background: rgba(0, 85, 239, 0.08);
    border-radius: 17px;
    color: #0055EF;
    font-size: 1.25rem;
    opacity: 1;
}

.no-results-state h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #0B1B33;
}

.no-results-state p {
    margin: 0 0 1.1rem;
    max-width: 34ch;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #4B5B76;
}

.no-results-state .btn {
    border-radius: 999px;
    font-weight: 600;
}

/* ── The class the notes belong to ────────────────────────────────────────── */

.enotes-class-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    padding: 0.35rem 0.72rem 0.35rem 0.62rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #E3E8F1;
    border-radius: 999px;
    font-size: 0.78rem;
    color: #4B5B76;
    box-shadow: 0 1px 2px rgba(11, 27, 51, 0.04);
}

.enotes-class-chip i {
    color: #0055EF;
    font-size: 0.72rem;
}

.enotes-class-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #63708A;
}

.enotes-class-chip strong {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0B1B33;
}

/* ── Download panel ────────────────────────────────────────────────────────── */

.enotes-download {
    margin: 0.85rem 0;
}

.enotes-download-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: #ffffff;
    border: 1px solid #E3E8F1;
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4B5B76;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(11, 27, 51, 0.04), 0 2px 8px rgba(11, 27, 51, 0.04);
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.enotes-download-trigger i {
    color: #E02424;
    font-size: 0.8rem;
}

.enotes-download-trigger:hover,
.enotes-download-trigger[aria-expanded="true"] {
    border-color: rgba(0, 85, 239, 0.35);
    color: #0B1B33;
    box-shadow: 0 2px 4px rgba(11, 27, 51, 0.05), 0 14px 30px -10px rgba(11, 27, 51, 0.16);
}

.enotes-download-trigger:focus-visible {
    outline: 2px solid #0055EF;
    outline-offset: 2px;
}

.enotes-download-options {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.8rem;
    background: #ffffff;
    border: 1px solid #E3E8F1;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(11, 27, 51, 0.04);
}

.enotes-download-options select {
    padding: 0.55rem 0.7rem;
    background: #F8FAFD;
    border: 1px solid #E3E8F1;
    border-radius: 10px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #0B1B33;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.enotes-download-options select:hover {
    background: #ffffff;
    border-color: #C9D2E0;
}

.enotes-download-options select:focus-visible {
    outline: 2px solid #0055EF;
    outline-offset: 1px;
}

.enotes-download-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 38px;
    padding: 0.5rem 0.9rem;
    background: #0055EF;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 6px 14px -8px rgba(0, 85, 239, 0.9);
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.enotes-download-go:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 18px -8px rgba(0, 85, 239, 0.95);
}

.enotes-download-go:disabled {
    opacity: 0.6;
    cursor: progress;
}

.enotes-download-go:focus-visible {
    outline: 2px solid #0055EF;
    outline-offset: 2px;
}

.enotes-download-status {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #63708A;
}

@media (max-width: 560px) {
    .enotes-download-options {
        grid-template-columns: 1fr 1fr;
    }

    .enotes-download-go {
        grid-column: 1 / -1;
    }
}

/* ==================== SUBJECT CARDS GRID ==================== */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .subjects-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== SUBJECT CARD ==================== */

.subject-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.subject-card:active {
    transform: translateY(-2px);
}

.status-graded {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #1e293b;
    font-size: 0.95rem;
}

.graded-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #16a34a;
    font-weight: 600;
}

.teacher-feedback {
    background: #f8fafc;
    border-left: 4px solid #16a34a;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.teacher-feedback strong {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.teacher-feedback p {
    margin: 0;
    color: #334155;
    font-style: italic;
}

.final-score-badge {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

.final-score-badge i {
    color: #d97706;
}

.submission-modal-footer .status-success {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #16a34a;
    font-weight: 500;
}

/* The subject tiles and the note reader are drawn further down, in
   "E-NOTES — THE THREE STAGES": one owner per class, no cascade races. */


/* ==================== TERMS MODAL ==================== */
.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.terms-modal-content {
    background: #ffffff;
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-modal-overlay.active .terms-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.terms-modal-header {
    padding: 2rem;
    background: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.terms-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.terms-modal-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.terms-modal-body {
    padding: 2rem;
    overflow-y: auto;
    background: #f8fafc;
}

.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.terms-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.terms-modal-content {
    background: white;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.terms-modal-overlay.active .terms-modal-content {
    transform: scale(1) translateY(0);
}

.terms-modal-header {
    padding: 1.5rem;
    color: white;
    position: relative;
}

.terms-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terms-modal-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.terms-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Terms List */
.terms-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.term-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.term-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.term-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.term-item-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.term-item-info {
    flex: 1;
}

.term-item-info h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.term-details {
    margin: 0.25rem 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.term-item-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.term-item:hover .term-item-arrow {
    background: var(--primary-color);
    color: white;
}

/* ==================== WEEKS MODAL ==================== */
.weeks-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.weeks-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.weeks-modal-content {
    background: #ffffff;
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.weeks-modal-overlay.active .weeks-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.weeks-modal-header {
    padding: 2rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.weeks-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.weeks-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weeks-modal-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.weeks-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

/* Weeks List */
.weeks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.week-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.week-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

/* A week card carries an icon, a topic that can be long and the badges that say
   what the week holds: the card wraps its own contents rather than growing past
   the edge of the screen. */
.week-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.week-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.week-item-info {
    flex: 1;
    min-width: 0;
}

.week-item-info h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.week-topic {
    margin: 0.25rem 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.week-item-indicators {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.week-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
}

.week-badge.assignment {
    background: #FEF3C7;
    color: #92400E;
}

.week-badge.content {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ==================== CONTENT MODAL (65/35 Layout) ==================== */

.content-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.content-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.content-modal-content {
    background: white;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-modal-overlay.active .content-modal-content {
    transform: scale(1);
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .content-modal-content {
        width: 90vw;
        height: 90vh;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .content-modal-content {
        width: 85vw;
        height: 85vh;
        max-width: 1200px;
    }
}

/* Mobile: Better viewport handling */
@media (max-width: 767px) {
    .content-modal-content {
        width: 100vw;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        max-width: 100vw;
        border-radius: 0;
    }
}

.content-modal-header {
    padding: 1.25rem 1.5rem;
    color: white;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    flex: 1;
}

.content-modal-subtitle {
    margin: 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.btn-close-modal,
.btn-back-modal {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.btn-close-modal:hover,
.btn-back-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.content-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f172a; /* Dark sleek background */
    position: relative;
}

/* WEEK DASHBOARD UI */
.week-dashboard {
    padding: 3rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    /* The dashboard is the modal's scroll container. Without this the parent
       `.content-modal-body` clips it (`overflow: hidden`), and on small screens
       the practice tasks sit below the study materials in a single column, so
       the last cards — and the tap that opens the submit form — fall out of
       reach. Growing to the body's height and scrolling internally keeps every
       card reachable at any viewport size. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    animation: dashboardFade 0.5s ease-out;
}

@keyframes dashboardFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-header {
    margin-bottom: 3rem;
    text-align: center;
}

.dashboard-header h2 {
    font-size: 2.25rem;
    color: white;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-section h3 {
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-section h3 i {
    font-size: 1rem;
}

/* Content Cards */
.content-item-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.content-item-card:hover {
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.content-item-card .item-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.note-item .item-icon-box { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.assignment-item .item-icon-box { background: linear-gradient(135deg, #0055EF, #059669); }

.content-item-card .item-main-info {
    flex: 1;
}

.content-item-card .item-title {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.content-item-card .item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.item-status-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-weight: 600;
}

.status-tag-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-tag-submitted { background: rgba(16, 185, 129, 0.1); color: #0055EF; }
.status-tag-graded { background: rgba(99, 102, 241, 0.1); color: #818cf8; }

.content-item-card .item-action-arrow {
    color: rgba(255, 255, 255, 0.2);
    font-size: 1.25rem;
    transition: transform 0.3s;
}

.content-item-card:hover .item-action-arrow {
    color: white;
    transform: translateX(5px);
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Full-Screen Note Reader */
.note-reader-overlay {
    position: fixed; /* Super high to cover everything */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9000;
    display: none; /* Controlled by JS flex */
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.note-reader-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.note-reader-content {
    background: #ffffff;
    width: 100%;
    max-width: 1000px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ACADEMIC TREE TRANSFORMATION */
.academic-tree-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 2000;
    display: none;
    flex-direction: column; /* Vertical stack: Header then Tree */
    overflow: hidden; /* Parent does not scroll */
    opacity: 0;
    transition: opacity 0.5s ease;
}

.academic-tree-overlay.active {
    opacity: 1;
}

.tree-header {
    flex-shrink: 0;
    height: 70px; /* Slimmer header */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
}

.tree-header h2 {
    font-size: 1.4rem; /* Smaller title */
    color: white;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
}

.btn-exit-tree {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-exit-tree:hover {
    background: white;
    color: #0f172a;
    transform: rotate(90deg);
}

.tree-container {
    display: flex;
    align-items: center;
    gap: 4rem;
    padding: 2rem 5rem;
    min-width: max-content;
}

/* Base Node Style - Minimalist Floating */
.branch-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    padding: 1.5rem;
    background: transparent;
    border: none;
    min-width: 140px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    opacity: 0.6;
    filter: grayscale(0.4);
}

.branch-node.active {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.1);
}

.branch-node:hover {
    transform: translateY(-8px) scale(1.15);
    opacity: 1;
    filter: grayscale(0);
}

.node-icon-box {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: all 0.4s ease;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.branch-node.active .node-icon-box {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 25px var(--node-color);
}

.node-info {
    text-align: center;
}

.node-title {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.node-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Colors */
.node-session { --node-color: #0055EF; } /* Green */
.node-term { --node-color: #f59e0b; }    /* Amber */
.node-week { --node-color: #ec4899; }    /* Pink */

.branch-node .node-icon-box {
    background: var(--node-color);
}

/* Branch Groups */
.tree-level {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    position: relative;
    padding: 3rem 1rem 3rem 5rem; /* Vertical padding inside the scrollable lane */
    justify-content: flex-start; /* Start from top to ensure all nodes are reachable */
    max-height: 75vh; /* Independent vertical lane height */
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbars for cleaner look */
    transition: all 0.5s ease;
    flex-shrink: 0; /* CRITICAL: Prevents overlapping on mobile */
    scroll-snap-align: center; /* Snap level to center of screen */
    min-width: 300px; /* Base width for desktop */
}

.tree-level::-webkit-scrollbar {
    display: none;
}

/* The Vertical Trunk */
.tree-level:not(.level-0)::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 2rem;
    bottom: 2rem;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sprout-animation {
    animation: sprout 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Horizontal Curved Connectors */
.branch-node::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 50%;
    width: 2.5rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%);
}

.branch-node::after {
    content: '';
    position: absolute;
    right: -3.5rem;
    top: 50%;
    width: 3.5rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%);
}

/* Remove connectors for end/start nodes */
.level-0 .branch-node::before,
.level-content .branch-node::after {
    display: none;
}

/* Active Path Glowing */
.branch-node.active::before,
.branch-node.active::after {
    background: var(--node-color, #6366f1);
    box-shadow: 0 0 10px var(--node-color, #6366f1);
    opacity: 0.8;
}

@keyframes sprout {
    from { opacity: 0; transform: translateX(-30px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.tree-container {
    flex: 1; /* Take all remaining vertical space */
    display: flex;
    align-items: center; /* Vertical alignment of the lanes */
    gap: 8rem; /* Increased gap for cleaner connectors */
    padding: 0 10vw;
    min-width: 100%;
    overflow-x: auto; /* Horizontal panning */
    overflow-y: hidden; /* Canvas itself doesn't scroll vertically anymore */
    scroll-behavior: smooth;
    position: relative;
    scrollbar-width: none;
    scroll-snap-type: x mandatory; /* Enable app-like snapping */
}

/* Custom Scrollbar for better visibility on dark background */
.tree-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.tree-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.tree-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.note-reader-header {
    padding: 1.5rem 3rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.note-reader-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #0f172a;
    font-weight: 800;
}

.btn-return-journey {
    padding: 0.6rem 1.2rem;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-return-journey:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.note-reader-body {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 6rem;
    background: #fff;
    font-family: 'Georgia', serif; /* Classic reading font */
}

@media (max-width: 768px) {
    .note-reader-body {
        padding: 2rem;
    }
    .note-reader-header {
        padding: 1rem 1.5rem;
    }
}


/* Workspace Internal Layouts */
.workspace-meta-badges {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.workspace-instructions-box {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 2.5rem;
}

.workspace-instructions-box h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.workspace-actions {
    display: flex;
    justify-content: center;
}

.btn-launch-editor {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-launch-editor:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 25px -5px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.note-viewer {
    background: white;
    max-width: 800px;
    margin: 0 auto;
}

.note-viewer .ql-editor {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: #334155;
}

.obtained-score-badge {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.teacher-feedback-alert {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #1d4ed8;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.feedback-body {
    color: #1e40af;
    line-height: 1.6;
    font-style: italic;
    font-size: 1rem;
}



/* Notes Section (65%) */
.content-notes-section {
    flex: 0 0 65%;
    overflow-y: auto;
    padding: 2rem;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.content-section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.content-section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notes-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.note-item {
    background: #ffffff;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.note-item h4 {
    margin: 0 0 1.25rem 0;
    font-size: 1.15rem;
    color: #1e293b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.note-item h4::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: #6366f1;
    border-radius: 99px;
}

/* Assignment Section (35%) */
.content-assignment-section {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #f8fafc;
    box-shadow: inset 10px 0 20px -10px rgba(0, 0, 0, 0.05);
}

.content-assignment-section .content-section-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.assignment-scrollable-content {
    flex: 1;
    padding: 1.5rem 2rem;
}

.assignment-item {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.assignment-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.assignment-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.assignment-header-row h4 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 700;
    line-height: 1.4;
}

.assignment-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.assignment-status-badge.status-pending {
    background: #fffbeb;
    color: #b45309;
}

.assignment-status-badge.status-submitted {
    background: #f0fdf4;
    color: #15803d;
}

.assignment-status-badge.status-overdue {
    background: #fef2f2;
    color: #991b1b;
}

.assignment-status-badge.status-available {
    background: #eff6ff;
    color: #1d4ed8;
}

.assignment-status-badge.status-graded {
    background: #faf5ff;
    color: #7e22ce;
}

.assignment-deadline,
.assignment-max-score {
    margin: 0.5rem 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assignment-instructions {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    max-height: 200px;
    overflow-y: auto;
}

.assignment-instructions h4 {
    margin: 0 0 0.5rem 0;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    position: sticky;
    top: 0;
    background: #f9fafb;
    padding-bottom: 0.5rem;
}

.btn-submit-assignment {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    margin-top: 1rem;
}

.btn-submit-assignment:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-submit-assignment:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit-assignment:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== CONTENT RENDERING ==================== */

/* Quill.js Read-Only Content */
.quill-rendered-content .ql-editor,
.assignment-instructions-content .ql-editor {
    font-size: var(--font-size-base);
    line-height: 1.8;
    color: var(--text-secondary);
}

.quill-rendered-content .ql-editor h1,
.assignment-instructions-content .ql-editor h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin: 1.5rem 0 1rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h2,
.assignment-instructions-content .ql-editor h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin: 1.25rem 0 0.75rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h3,
.assignment-instructions-content .ql-editor h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h4,
.assignment-instructions-content .ql-editor h4 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor p,
.assignment-instructions-content .ql-editor p {
    margin: 0.5rem 0;
}

.quill-rendered-content .ql-editor strong,
.assignment-instructions-content .ql-editor strong {
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor img,
.assignment-instructions-content .ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.quill-rendered-content .ql-editor ul,
.assignment-instructions-content .ql-editor ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.quill-rendered-content .ql-editor ul ul,
.assignment-instructions-content .ql-editor ul ul {
    padding-left: 2rem;
    list-style-type: circle;
}

.quill-rendered-content .ql-editor li,
.assignment-instructions-content .ql-editor li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.empty-content {
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.6;
    padding: 3rem 1rem;
    font-style: italic;
}

.empty-content p {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
}

.quill-image {
    margin: 1.5rem 0;
    text-align: center;
}

.quill-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .quill-image {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }

    .quill-image img {
        width: 100%;
        height: 250px;
        object-fit: cover;
    }
}

.quill-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.quill-list li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
}

.quill-list.indent-1 {
    padding-left: 3rem;
    list-style-type: circle;
}

.quill-list.indent-2 {
    padding-left: 4.5rem;
    list-style-type: square;
}

/* ==================== SUBMISSION MODAL ==================== */

.submission-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.submission-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.submission-modal-content {
    background: #ffffff;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.submission-modal-overlay.active .submission-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Tablet & Desktop sizes */
@media (min-width: 768px) and (max-width: 1024px) {
    .submission-modal-content {
        width: 90vw;
        height: 90vh;
    }
}

@media (min-width: 1024px) {
    .submission-modal-content {
        width: 85vw;
        height: 85vh;
        max-width: 1200px;
    }
}

/* Mobile: Full screen with dynamic viewport height */
@media (max-width: 767px) {
    .submission-modal-content {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        border-radius: 0;
    }

    .submission-modal-header {
        padding: 1rem 1.25rem;
    }

    .submission-modal-header h2 {
        font-size: 1.15rem;
    }

    .submission-instructions-section {
        padding: 1rem 1.25rem;
        max-height: 35vh;
    }

    .submission-instructions-content {
        max-height: 200px;
    }

    .submission-editor-section {
        padding: 1rem 1.25rem;
    }

    .submission-modal-footer {
        padding: 0.875rem 1.25rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-save-submission {
        width: 100%;
        min-width: auto;
    }

    #submission-status-message {
        width: 100%;
        text-align: center;
    }
}

.submission-modal-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-bottom: 2px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.submission-modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #15803d;
}

.submission-modal-header h2 i {
    color: #16a34a;
    font-size: 1.4rem;
}

.btn-close-modal {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.submission-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    background: #f8fafc;
}

/* Instructions Section */
.submission-instructions-section {
    background: white;
    border-bottom: 2px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
    max-height: 40vh;
    overflow-y: auto;
}

.submission-instructions-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submission-instructions-section h3 i {
    color: #3b82f6;
}

.submission-deadline,
.submission-max-score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-right: 0.5rem;
}

.submission-deadline {
    background: #fef3c7;
    color: #92400e;
}

.submission-deadline i {
    color: #f59e0b;
}

.submission-max-score {
    background: #dbeafe;
    color: #1e40af;
}

.submission-max-score i {
    color: #3b82f6;
}

.submission-instructions-content {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
}

.submission-instructions-content .ql-editor {
    padding: 0;
}

.tooltip-container {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    overflow: visible;
}

.tooltip-popover {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: max-content;
    max-width: 400px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.tooltip-container:hover .tooltip-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-popover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
}

.submission-instructions-content {
    padding: 1.25rem;
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
}

.submission-instructions-content .ql-editor {
    padding: 0;
}

.submission-meta-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.instructions-badge {
    background: #f1f5f9;
    color: #4710EB;
    border: none;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
    cursor: default;
    transition: all 0.2s ease;
}

.instructions-badge:hover {
    background: #e2e8f0;
    color: #000033;
}

.deadline-badge {
    background: #fffbeb;
    color: #b45309;
}

.deadline-badge i {
    color: #f59e0b;
}

.score-badge {
    background: #f0fdf4;
    color: #15803d;
}

.score-badge i {
    color: #22c55e;
}

/* Editor Section */
.submission-editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.editor-header-badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

#submission-quill-editor {
    flex: 1;
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.submission-editor-section h3 i {
    color: #16a34a;
}

#submission-quill-editor .ql-toolbar {
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    background: #f8fafc;
    padding: 0.65rem 1rem !important;
}

#submission-quill-editor .ql-container {
    border: none !important;
    font-size: 1rem;
    font-family: inherit;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#submission-quill-editor .ql-editor {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    color: #334155;
    line-height: 1.7;
}

#submission-quill-editor .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal;
    left: 1.25rem;
}

/* Image scaling in editor */
#submission-quill-editor .ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Quill Tooltip Fixes */
.ql-snow .ql-tooltip {
    z-index: 3000 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    padding: 8px 12px !important;
}

.ql-snow .ql-tooltip input[type=text] {
    border-radius: 4px !important;
    border: 1px solid #cbd5e1 !important;
    padding: 4px 8px !important;
}

/* Adjust tooltip when near right edge */
.ql-snow .ql-tooltip.ql-flip {
    transform: translateX(-90%) !important;
}

/* Tiny Inline Editor Spinner */
.inline-editor-spinner {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.submission-modal-footer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
}

#submission-status-message {
    flex: 1;
}

.btn-save-submission {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    min-width: 180px;
}

.btn-save-submission:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.btn-save-submission:active:not(:disabled) {
    transform: translateY(0);
}

.btn-save-submission:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-save-submission.btn-submitted {
    background: #94a3b8 !important;
    color: #f8fafc !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.8;
}

/* Status Messages */
.status-success,
.status-graded {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-graded {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.status-submitted {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ==================== LOADING & EMPTY STATES ==================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.spinner-small {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.content-modal-header {
    padding: 1.25rem 2.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-text h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.header-subtitle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.header-subtitle .separator {
    color: #cbd5e1;
}

.header-subtitle i {
    color: #6366f1;
}

.btn-back-modal {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f1f5f9;
    border: none;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateX(-3px);
}

.empty-icon-wrapper {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 2.5rem;
    color: #cbd5e1;
}

.empty-content {
    text-align: center;
    padding: 4rem 2rem;
    color: #94a3b8;
}

.empty-content p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

/* Quill Disabled State */
.ql-container.ql-disabled {
    background-color: #f8fafc;
    border-color: #e2e8f0 !important;
}

.ql-container.ql-disabled .ql-editor {
    color: #64748b;
    cursor: not-allowed;
}

.submission-editor-wrapper.locked {
    position: relative;
}

.submission-editor-wrapper.locked::after {
    content: 'Read Only';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #64748b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
    pointer-events: none;
}

.grading-badges-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto; /* Push to the right */
}

/* Compact Grading UI */
.obtained-score-badge {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.5rem 0.875rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #bfdbfe;
    box-shadow: 0 2px 4px rgba(29, 78, 216, 0.1);
}

.comment-pulsing-btn {
    background: #fdf2f8;
    color: #db2777;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #fbcfe8;
    position: relative;
    transition: all 0.2s ease;
}

.comment-pulsing-btn:hover {
    background: #fbcfe8;
    transform: scale(1.1);
}

.comment-pulsing-btn.pulse {
    animation: commentPulse 2s infinite;
}

@keyframes commentPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(219, 39, 119, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(219, 39, 119, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(219, 39, 119, 0);
    }
}

/* Tooltip Styling */
.comment-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #1e293b;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    width: 250px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    line-height: 1.5;
    font-style: italic;
}

.comment-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 10px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #1e293b transparent;
}

.comment-pulsing-btn:hover .comment-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.comment-tooltip h5 {
    margin: 0 0 4px 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-style: normal;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

@media (max-width: 768px) {
    .weeks-modal-content {
        max-height: 90vh;
        border-radius: 12px;
    }

    .content-modal-content {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .content-notes-section {
        flex: 0 0 auto;
        padding: 1rem;
        min-height: 50vh;
    }

    .content-assignment-section {
        flex: 0 0 auto;
        padding: 1rem;
        min-height: 40vh;
    }

    /* Smaller gutters leave more room for the task cards on a phone. */
    .week-dashboard {
        padding: 1.5rem 1rem;
    }

    .content-modal-header h2 {
        font-size: var(--font-size-lg);
    }
}

@media (max-width: 480px) {
    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .subject-card-name {
        font-size: var(--font-size-base);
    }

    .weeks-modal-header h2 {
        font-size: var(--font-size-xl);
    }

    /* Assignment items more compact on mobile */
    .assignment-item {
        padding: 1rem;
    }

    .assignment-instructions {
        max-height: 150px;
    }

    .btn-submit-assignment {
        padding: 0.75rem 1rem;
        font-size: var(--font-size-sm);
    }
}

@media (min-width: 1024px) {
    .content-modal-body {
        flex-direction: row;
    }

    .content-notes-section {
        flex: 0 0 65%;
        border-bottom: none;
        border-right: 2px solid #e5e7eb;
    }

    .content-assignment-section {
        flex: 0 0 35%;
        border-top: none;
    }
}
/* Mobile Optimization for Tree Journey */
@media (max-width: 768px) {
    .tree-level {
        min-width: 85vw;
        padding-left: 3rem;
    }
    
    .tree-container {
        gap: 12rem;
        padding: 0 7.5vw;
    }
    
    .branch-node {
        font-size: 0.9rem;
    }

    .tree-header h2 {
        font-size: 1.1rem;
    }
}

.submission-editor-wrapper.locked[data-lock-reason="Overdue"]::after {
 content: 'Overdue';
 position: absolute;
 top: 10px;
 right: 10px;
 background: #ef4444;
 color: white;
 padding: 4px 10px;
 border-radius: 6px;
 font-size: 11px;
 font-weight: 700;
 text-transform: uppercase;
 z-index: 10;
 pointer-events: none;
 box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==================== E-NOTES — THE THREE STAGES ==================== */
/*
   Subjects -> weeks -> one week.

   The idea: the app speaks cool and clean (white cards, Inter, brand blue),
   and the note itself is a leaf of paper. Nothing else in the flow is allowed
   to be warm or serif. That single contrast is what makes a note feel like
   something the school handed the parent, rather than another list row.

   Signature: the bound leaf — warm off-white paper, a spine in the subject's
   own colour, serif prose set at a real reading measure, and a dashed "tear
   here" line above any homework.
*/

.enotes-stage {
    /* Ink */
    --en-ink: #0B1B33;
    --en-ink-soft: #4B5B76;
    --en-ink-faint: #63708A;
    /* Brand */
    --en-brand: #0055EF;
    --en-brand-deep: #0A3AA8;
    --en-brand-wash: rgba(0, 85, 239, 0.08);
    /* Paper — also used, faintly, under the stage head */
    --en-paper: #FDFCF8;
    --en-paper-line: #E8E1D0;
    --en-paper-ink: #242C38;
    /* Chrome */
    --en-line: #E3E8F1;
    --en-line-soft: #EFF2F8;
    /* Homework is its own colour, never the subject's */
    --en-home: #4F46E5;
    --en-home-wash: rgba(79, 70, 229, 0.09);
    /* Shape + depth */
    --en-radius: 18px;
    --en-shadow-1: 0 1px 2px rgba(11, 27, 51, 0.04), 0 2px 8px rgba(11, 27, 51, 0.04);
    --en-shadow-2: 0 2px 4px rgba(11, 27, 51, 0.05), 0 14px 30px -10px rgba(11, 27, 51, 0.16);
    --en-shadow-3: 0 4px 8px rgba(11, 27, 51, 0.05), 0 28px 56px -16px rgba(11, 27, 51, 0.22);
    /* Motion */
    --en-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --en-read: 'Iowan Old Style', 'Sitka Text', Charter, 'Palatino Linotype', Palatino, Georgia, 'Noto Serif', serif;

    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    animation: enStageIn 0.32s var(--en-ease) both;
}

@keyframes enStageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ── Stage head ───────────────────────────────────────────────────────────── */

.enotes-stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.enotes-stage-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
    min-width: 0;
    flex: 1 1 220px;
}

/* A title with no subject mark in front of it stacks heading over hint. */
.enotes-stage-title > h3,
.enotes-stage-title > p {
    flex-basis: 100%;
}

.enotes-stage-title > div {
    min-width: 0;
}

.enotes-stage-title h3 {
    margin: 0;
    font-size: clamp(1.15rem, 2.2vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.022em;
    line-height: 1.2;
    color: var(--en-ink);
    overflow-wrap: anywhere;
}

.enotes-stage-title p {
    margin: 0.28rem 0 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--en-ink-faint);
    letter-spacing: 0.005em;
}

/* The subject's own colour, as a chip at the head of its stage. */
.enotes-subject-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    color: #ffffff;
    font-size: 1.05rem;
    box-shadow: 0 8px 18px -8px var(--en-shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.enotes-stage-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem 0.5rem 0.7rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--en-line);
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--en-ink-soft);
    cursor: pointer;
    transition: background 0.2s var(--en-ease), border-color 0.2s var(--en-ease),
                color 0.2s var(--en-ease), transform 0.2s var(--en-ease);
    -webkit-tap-highlight-color: transparent;
}

.enotes-stage-back i {
    font-size: 0.72rem;
    transition: transform 0.2s var(--en-ease);
}

.enotes-stage-back:hover {
    background: #ffffff;
    border-color: rgba(0, 85, 239, 0.35);
    color: var(--en-brand);
}

.enotes-stage-back:hover i {
    transform: translateX(-2px);
}

.enotes-stage-back:active {
    transform: scale(0.97);
}

.enotes-stage-back:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

.enotes-term-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    padding: 0.5rem 0.95rem;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--en-ink-soft);
    cursor: pointer;
    box-shadow: var(--en-shadow-1);
    transition: border-color 0.2s var(--en-ease), color 0.2s var(--en-ease),
                box-shadow 0.2s var(--en-ease);
}

.enotes-term-chip i:first-child {
    color: var(--en-brand);
    font-size: 0.78rem;
}

.enotes-term-chip i:last-child {
    font-size: 0.62rem;
    opacity: 0.6;
}

.enotes-term-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enotes-term-chip:hover {
    border-color: rgba(0, 85, 239, 0.35);
    color: var(--en-ink);
    box-shadow: var(--en-shadow-2);
}

.enotes-term-chip:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

/* No other terms means no affordance to press. */
.enotes-term-chip.is-static {
    cursor: default;
    background: rgba(255, 255, 255, 0.65);
    border-style: dashed;
    color: var(--en-ink-faint);
    box-shadow: none;
}

.enotes-term-chip.is-static i:first-child {
    color: var(--en-ink-faint);
}

.enotes-term-chip.is-static:hover {
    border-color: var(--en-line);
    color: var(--en-ink-faint);
    box-shadow: none;
}

/* ── Loading, empty, error ────────────────────────────────────────────────── */

/* The status a screen reader hears while a skeleton is on screen. */
.enotes-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.enotes-stage-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    padding: 2.75rem 1rem;
    color: var(--en-ink-faint);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.enotes-stage-loading p {
    margin: 0;
}

/* A ring with a brand-coloured arc, sized to sit with text rather than over it. */
.enotes-stage-loading .spinner-small {
    width: 30px;
    height: 30px;
    margin: 0;
    border: 2.5px solid rgba(0, 85, 239, 0.14);
    border-top-color: var(--en-brand);
    border-right-color: rgba(0, 85, 239, 0.45);
    border-radius: 50%;
    animation: enSpin 0.75s linear infinite;
}

@keyframes enSpin {
    to { transform: rotate(360deg); }
}

/* Skeleton placeholders: the shape of what is coming, not a spinner in a void. */
.enotes-skeleton {
    position: relative;
    overflow: hidden;
    background: #DFE6F0;
    border-radius: 10px;
}

.enotes-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: enSweep 1.4s var(--en-ease) infinite;
}

@keyframes enSweep {
    to { transform: translateX(100%); }
}

.enotes-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 0.8rem;
}

.enotes-skeleton-tile {
    height: 132px;
    border-radius: var(--en-radius);
}

.enotes-skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.enotes-skeleton-row {
    height: 74px;
    border-radius: 16px;
}

.enotes-skeleton-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.6rem 1.7rem;
    background: var(--en-paper);
    border: 1px solid var(--en-paper-line);
    border-radius: 4px 20px 20px 4px;
}

.enotes-skeleton-title {
    height: 1.6rem;
    width: 58%;
    margin-bottom: 0.5rem;
    border-radius: 8px;
}

.enotes-skeleton-line {
    height: 0.72rem;
    border-radius: 6px;
}

.enotes-skeleton-line:nth-child(4) { width: 92%; }
.enotes-skeleton-line:nth-child(5) { width: 97%; }
.enotes-skeleton-line:nth-child(6) { width: 84%; }
.enotes-skeleton-line:nth-child(7) { width: 95%; }
.enotes-skeleton-line:nth-child(8) { width: 66%; }

/* An empty stage is an invitation, not a shrug. */
#enotes-content-container .empty-state,
.enotes-stage > .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 3rem 1.5rem;
    margin: 0;
    background: rgba(255, 255, 255, 0.7);
    border: 1px dashed var(--en-line, #E3E8F1);
    border-radius: 20px;
    text-align: center;
    color: #4B5B76;
}

#enotes-content-container .empty-state i,
.enotes-stage > .empty-state i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin: 0 0 0.85rem;
    border-radius: 18px;
    background: rgba(0, 85, 239, 0.08);
    color: #0055EF;
    font-size: 1.4rem;
    opacity: 1;
}

#enotes-content-container .empty-state p,
.enotes-stage > .empty-state p {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #4B5B76;
    max-width: 30ch;
    line-height: 1.5;
}

.enotes-stage-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: var(--en-radius);
    box-shadow: var(--en-shadow-1);
}

/* The alert glyph is the stage's error mark. It is a direct child only, so the
   same rule cannot reach the icons inside the two action buttons. */
.enotes-stage-error > i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
    font-size: 1.35rem;
}

.enotes-stage-error p {
    margin: 0;
    max-width: 34ch;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--en-ink-soft);
    line-height: 1.5;
}

.enotes-stage-error-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.2rem;
}

/* The shared .btn family is only a fallback here: these two actions carry the
   stage's own shape so they never inherit another screen's button skin. */
.enotes-stage-error-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.05rem;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--en-ink-soft);
    cursor: pointer;
    box-shadow: var(--en-shadow-1);
    transition: border-color 0.2s var(--en-ease), color 0.2s var(--en-ease),
                box-shadow 0.2s var(--en-ease);
}

.enotes-stage-error-actions .btn i {
    font-size: 0.72rem;
}

.enotes-stage-error-actions .btn:hover {
    border-color: rgba(0, 85, 239, 0.35);
    color: var(--en-ink);
    box-shadow: var(--en-shadow-2);
}

.enotes-stage-error-actions .btn:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

/* ── Stage 0: the subjects ────────────────────────────────────────────────── */

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 0.8rem;
    max-width: none;
    margin: 0;
    padding: 0;
}

button.subject-node {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.72rem;
    width: 100%;
    margin: 0;
    padding: 1rem 1rem 0.85rem;
    text-align: left;
    font: inherit;
    color: inherit;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: var(--en-radius);
    box-shadow: var(--en-shadow-1);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: enTileIn 0.42s var(--en-ease) both;
    animation-delay: var(--delay, 0s);
    transition: transform 0.24s var(--en-ease), box-shadow 0.24s var(--en-ease),
                border-color 0.24s var(--en-ease);
}

@keyframes enTileIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

button.subject-node:hover {
    transform: translateY(-3px);
    border-color: var(--bg, var(--en-brand));
    box-shadow: var(--en-shadow-2);
}

button.subject-node:active {
    transform: translateY(-1px) scale(0.994);
}

button.subject-node:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 3px;
}

.node-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--bg, #6B7280);
    color: #ffffff !important;
    font-size: 1.08rem;
    border: none;
    box-shadow: 0 7px 16px -7px var(--shadow-hover, rgba(11, 27, 51, 0.5)),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform 0.24s var(--en-ease), box-shadow 0.24s var(--en-ease);
}

button.subject-node:hover .node-circle {
    background: var(--bg, #6B7280);
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 0 10px 22px -8px var(--shadow-hover, rgba(11, 27, 51, 0.55)),
                inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.node-label {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.012em;
    line-height: 1.25;
    color: var(--en-ink);
    text-align: left;
    transition: color 0.2s var(--en-ease);
}

.subject-node:hover .node-label {
    color: var(--en-ink);
}

.subject-node .node-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--en-ink-soft);
    line-height: 1;
}

.subject-node .node-weeks {
    padding: 0.24rem 0.5rem;
    background: var(--en-line-soft);
    border-radius: 7px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    transition: background 0.2s var(--en-ease), color 0.2s var(--en-ease);
}

.subject-node:hover .node-weeks {
    background: var(--en-brand-wash);
    color: var(--en-brand);
}

.subject-node .node-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 7px;
    background: var(--en-home-wash);
    color: var(--en-home);
    font-size: 0.6rem;
}

/* ── Stage 1: the weeks ───────────────────────────────────────────────────── */

.enotes-week-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.enotes-week-card {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    width: 100%;
    padding: 0.8rem 0.95rem;
    text-align: left;
    font: inherit;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: 16px;
    cursor: pointer;
    box-shadow: var(--en-shadow-1);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.22s var(--en-ease), box-shadow 0.22s var(--en-ease),
                border-color 0.22s var(--en-ease);
}

.enotes-week-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 85, 239, 0.32);
    box-shadow: var(--en-shadow-2);
}

.enotes-week-card:active {
    transform: translateY(0) scale(0.996);
}

.enotes-week-card:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

/* The week number is a plate, not a badge: tabular figures keep the column
   of numbers aligned down the list. */
.enotes-week-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(155deg, var(--en-brand) 0%, var(--en-brand-deep) 100%);
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 8px 16px -8px rgba(0, 85, 239, 0.75);
    transition: transform 0.22s var(--en-ease), box-shadow 0.22s var(--en-ease);
}

.enotes-week-card:hover .enotes-week-badge {
    transform: scale(1.04);
    box-shadow: 0 10px 20px -8px rgba(0, 85, 239, 0.85);
}

.enotes-week-badge .wk-label {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.72;
    line-height: 1;
}

.enotes-week-badge .wk-num {
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.enotes-week-main {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}

.enotes-week-topic {
    font-size: 0.9375rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--en-ink);
    overflow-wrap: anywhere;
}

.enotes-week-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--en-ink-faint);
}

.enotes-week-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
}

.enotes-week-meta i {
    font-size: 0.66rem;
    opacity: 0.75;
}

.enotes-week-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.16rem 0.5rem;
    background: var(--en-home-wash);
    border-radius: 6px;
    color: var(--en-home);
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.005em;
}

.enotes-week-flag i {
    font-size: 0.62rem;
    opacity: 1;
}

.enotes-week-go {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: #C3CBD9;
    transition: color 0.22s var(--en-ease), transform 0.22s var(--en-ease);
}

.enotes-week-card:hover .enotes-week-go {
    color: var(--en-brand);
    transform: translateX(3px);
}

/* ── Stage 2: the week, read as one leaf of paper ─────────────────────────── */

.enotes-week-scroll {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-height: min(72vh, 780px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0.55rem 0.55rem 0.15rem;
    scrollbar-width: thin;
    scrollbar-color: #C9D2E0 transparent;
    scrollbar-gutter: stable;
}

.enotes-week-scroll:focus-visible {
    outline: 2px solid rgba(0, 85, 239, 0.5);
    outline-offset: 3px;
    border-radius: 16px;
}

.enotes-week-scroll::-webkit-scrollbar {
    width: 9px;
}

.enotes-week-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.enotes-week-scroll::-webkit-scrollbar-thumb {
    background: #C9D2E0;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

.enotes-week-scroll::-webkit-scrollbar-thumb:hover {
    background: #A9B5C8;
    background-clip: padding-box;
}

/* On a wide screen the reader leaves a column of empty air; the page inside it
   is a page, so it stops where the measure does instead of running the full
   width of the panel. */
.enotes-week-scroll > .enotes-note-block,
.enotes-week-scroll > .enotes-assignment,
.enotes-skeleton-page {
    width: 100%;
    max-width: 760px;
    align-self: center;
}

/* The leaf: warm paper, a spine in the subject's colour, and a page-corner
   radius that only rounds where a page would lift. */
.enotes-note-block {
    position: relative;
    padding: 1.6rem 1.75rem 1.5rem;
    background: var(--en-paper);
    background-image: radial-gradient(115% 90% at 0% 0%, rgba(0, 85, 239, 0.03), transparent 58%);
    border: 1px solid var(--en-paper-line);
    border-left: 4px solid var(--en-subject, var(--en-brand));
    border-radius: 4px 20px 20px 4px;
    box-shadow: 0 1px 2px rgba(58, 44, 20, 0.04), 0 16px 32px -20px rgba(58, 44, 20, 0.35);
}

.enotes-note-head {
    padding-bottom: 0.9rem;
    margin-bottom: 1.15rem;
    border-bottom: 1px solid rgba(58, 44, 20, 0.12);
}

.enotes-note-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #5A5245;
}

/* The dash beside it is where the subject's colour appears, so the label itself
   stays dark enough to read at 11px. */
.enotes-note-kicker::before {
    content: '';
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--en-subject, var(--en-brand));
}

.enotes-note-head h2 {
    margin: 0.5rem 0 0.45rem;
    font-family: var(--en-read);
    font-size: clamp(1.35rem, 2.6vw, 1.6rem);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.24;
    color: var(--en-paper-ink);
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.enotes-note-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6B6353;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* Prose. One measure, generous leading, and no text-decoration noise. */
.enotes-note-body {
    font-family: var(--en-read);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--en-paper-ink);
    max-width: 66ch;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.enotes-note-body p {
    margin: 0 0 0.95em;
}

.enotes-note-body > :last-child {
    margin-bottom: 0;
}

.enotes-note-body h2,
.enotes-note-body h3,
.enotes-note-body h4 {
    font-family: var(--en-read);
    color: var(--en-paper-ink);
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.enotes-note-body h2 {
    margin: 1.6em 0 0.55em;
    font-size: 1.32em;
    font-weight: 700;
    line-height: 1.28;
}

.enotes-note-body h2:first-child {
    margin-top: 0;
}

.enotes-note-body h3 {
    margin: 1.4em 0 0.45em;
    font-size: 1.14em;
    font-weight: 700;
    line-height: 1.32;
}

.enotes-note-body h4 {
    margin: 1.2em 0 0.35em;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6B6355;
}

.enotes-note-body ul,
.enotes-note-body ol {
    margin: 0 0 0.95em;
    padding-left: 1.35em;
}

.enotes-note-body li {
    margin-bottom: 0.4em;
    padding-left: 0.15em;
}

.enotes-note-body li::marker {
    color: var(--en-subject, var(--en-brand));
    font-size: 0.9em;
}

.enotes-note-body ol > li::marker {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.enotes-note-body strong {
    font-weight: 700;
    color: #17202C;
}

.enotes-note-body em {
    font-style: italic;
}

.enotes-note-body blockquote {
    margin: 0 0 0.95em;
    padding: 0.7em 1em;
    background: rgba(0, 85, 239, 0.045);
    border-left: 3px solid rgba(0, 85, 239, 0.4);
    border-radius: 0 8px 8px 0;
    color: #3B4658;
    font-style: italic;
}

.enotes-note-body blockquote > :last-child {
    margin-bottom: 0;
}

.enotes-note-body figure {
    margin: 0 0 1.1em;
}

.enotes-note-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 18px -10px rgba(58, 44, 20, 0.5);
}

.enotes-note-body code {
    padding: 0.1em 0.35em;
    background: rgba(58, 44, 20, 0.07);
    border-radius: 5px;
    font-size: 0.88em;
}

.enotes-note-body a {
    color: var(--en-brand);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-decoration-color: rgba(0, 85, 239, 0.4);
    transition: text-decoration-color 0.2s var(--en-ease);
}

.enotes-note-body a:hover {
    text-decoration-color: var(--en-brand);
}

.enotes-note-body hr {
    margin: 1.6em 0;
    border: 0;
    border-top: 1px solid rgba(58, 44, 20, 0.15);
}

.enotes-note-empty {
    margin: 0;
    color: #6B6353;
    font-style: italic;
}

/* Homework is a slip tucked behind the page: white, indigo, and a dashed tear
   line under its head so it reads as something to act on, not to read. */
.enotes-assignment {
    padding: 1.4rem 1.6rem 1.35rem;
    background: #FFFFFF;
    border: 1px solid rgba(79, 70, 229, 0.22);
    border-left: 4px solid var(--en-home);
    border-radius: 4px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(11, 27, 51, 0.04), 0 16px 32px -22px rgba(79, 70, 229, 0.5);
}

.enotes-assignment-head {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px dashed rgba(79, 70, 229, 0.35);
}

.enotes-assignment-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    width: 100%;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--en-home);
}

.enotes-assignment-kicker i {
    font-size: 0.66rem;
}

.enotes-assignment-head h3 {
    flex: 1;
    min-width: 0;
    margin: 0.15rem 0 0;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.32;
    color: var(--en-ink);
    overflow-wrap: anywhere;
}

.enotes-assignment-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--en-ink-faint);
    font-variant-numeric: tabular-nums;
}

.enotes-assignment .enotes-note-body {
    font-size: 1rem;
    line-height: 1.68;
    color: #2B3442;
    max-width: 62ch;
}

.enotes-assignment-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.enotes-assignment-status.status-pending   { background: rgba(245, 158, 11, 0.13); color: #A16207; }
.enotes-assignment-status.status-submitted { background: var(--en-brand-wash);      color: #0046C7; }
.enotes-assignment-status.status-graded    { background: rgba(16, 185, 129, 0.13); color: #047857; }
.enotes-assignment-status.status-overdue   { background: rgba(239, 68, 68, 0.12);  color: #B91C1C; }
.enotes-assignment-status.status-available { background: var(--en-home-wash);       color: var(--en-home); }

.enotes-assignment-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1.15rem;
    padding: 0.62rem 1.1rem;
    border: none;
    border-radius: 11px;
    background: linear-gradient(155deg, var(--en-home) 0%, #4338CA 100%);
    color: #ffffff;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    box-shadow: 0 8px 18px -10px rgba(79, 70, 229, 0.9);
    cursor: pointer;
    transition: transform 0.2s var(--en-ease), box-shadow 0.2s var(--en-ease),
                filter 0.2s var(--en-ease);
}

.enotes-assignment-go:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 12px 24px -10px rgba(79, 70, 229, 0.95);
}

.enotes-assignment-go:active {
    transform: translateY(0);
}

.enotes-assignment-go:focus-visible {
    outline: 2px solid var(--en-home);
    outline-offset: 3px;
}

/* ── Search hits ──────────────────────────────────────────────────────────── */

.enotes-match-groups {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.enotes-match-group-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--en-ink-soft);
}

.enotes-match-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
}

.enotes-match-term {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--en-ink-faint);
}

.enotes-match-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.enotes-match {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.7rem 0.9rem;
    text-align: left;
    font: inherit;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: 13px;
    cursor: pointer;
    transition: transform 0.2s var(--en-ease), border-color 0.2s var(--en-ease),
                box-shadow 0.2s var(--en-ease);
}

.enotes-match:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 85, 239, 0.32);
    box-shadow: var(--en-shadow-2);
}

.enotes-match:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

.enotes-match-week {
    flex: 0 0 auto;
    padding: 0.22rem 0.5rem;
    background: var(--en-line-soft);
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--en-ink-soft);
    font-variant-numeric: tabular-nums;
}

.enotes-match-topic {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--en-ink);
    overflow-wrap: anywhere;
}

.enotes-match-flag {
    padding: 0.16rem 0.45rem;
    background: var(--en-home-wash);
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 650;
    color: var(--en-home);
}

.enotes-match > i {
    font-size: 0.68rem;
    color: #C3CBD9;
}

.enotes-match:hover > i {
    color: var(--en-brand);
}

.search-highlight {
    padding: 0.05em 0.22em;
    background: rgba(250, 204, 21, 0.35);
    border-radius: 4px;
    font-weight: 700;
    color: #713F12;
}

/* ── Term chooser ─────────────────────────────────────────────────────────── */

.enotes-term-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.enotes-term-option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    width: 100%;
    padding: 0.85rem 1rem;
    text-align: left;
    font: inherit;
    background: #ffffff;
    border: 1px solid var(--en-line);
    border-radius: 15px;
    cursor: pointer;
    box-shadow: var(--en-shadow-1);
    transition: transform 0.2s var(--en-ease), border-color 0.2s var(--en-ease),
                box-shadow 0.2s var(--en-ease);
}

.enotes-term-option:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 85, 239, 0.32);
    box-shadow: var(--en-shadow-2);
}

.enotes-term-option:focus-visible {
    outline: 2px solid var(--en-brand);
    outline-offset: 2px;
}

.enotes-term-option.is-current {
    border-color: rgba(0, 85, 239, 0.4);
    background: linear-gradient(180deg, rgba(0, 85, 239, 0.05), #ffffff 70%);
}

.enotes-term-name {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--en-ink);
}

.enotes-term-meta {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--en-ink-faint);
    font-variant-numeric: tabular-nums;
}

.enotes-term-now {
    margin-left: auto;
    padding: 0.16rem 0.5rem;
    background: var(--en-brand-wash);
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--en-brand);
}

.enotes-term-option > i {
    margin-left: auto;
    font-size: 0.68rem;
    color: #C3CBD9;
}

.enotes-term-option:hover > i {
    color: var(--en-brand);
}

/* ── Small screens ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .enotes-stage {
        gap: 1.1rem;
    }

    .enotes-stage-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.7rem;
    }

    .enotes-stage-back {
        align-self: flex-start;
    }

    /* In a column, a 220px flex-basis would become 220px of height. */
    .enotes-stage-title {
        flex: 0 1 auto;
    }

    .enotes-term-chip {
        align-self: flex-start;
    }

    .enotes-stage-title h3 {
        font-size: 1.2rem;
    }

    .subject-grid {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
        gap: 0.65rem;
    }

    button.subject-node {
        padding: 0.85rem 0.85rem 0.75rem;
        gap: 0.6rem;
    }

    .node-circle {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .node-label {
        font-size: 0.875rem;
    }

    .enotes-note-block {
        padding: 1.25rem 1.15rem 1.15rem;
        border-radius: 3px 15px 15px 3px;
    }

    .enotes-note-body {
        font-size: 1.03125rem;
        line-height: 1.72;
    }

    .enotes-note-head h2 {
        font-size: 1.3rem;
    }

    .enotes-assignment {
        padding: 1.15rem 1.1rem 1.1rem;
        border-radius: 3px 15px 15px 3px;
    }

    .enotes-week-scroll {
        max-height: 76vh;
        padding-right: 0.55rem;
    }

    .enotes-week-card {
        gap: 0.75rem;
        padding: 0.7rem 0.8rem;
    }

    .enotes-week-badge {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .enotes-week-topic {
        font-size: 0.875rem;
    }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .enotes-stage,
    button.subject-node,
    .enotes-skeleton::after,
    .enotes-stage-loading .spinner-small {
        animation: none !important;
    }

    .enotes-stage-back,
    .enotes-term-chip,
    button.subject-node,
    .node-circle,
    .enotes-week-card,
    .enotes-week-badge,
    .enotes-week-go,
    .enotes-assignment-go,
    .enotes-match,
    .enotes-term-option {
        transition: none !important;
    }

    button.subject-node:hover,
    .enotes-week-card:hover,
    .enotes-match:hover,
    .enotes-term-option:hover {
        transform: none;
    }
}
