 /* ===== ОБЩИЕ СТИЛИ layout ===== */
        .layout {

            --right-work-height: 676px;
            --select-block-height: 112px;

            display: flex;

            gap: 20px;

            align-items: flex-start;
        }
        
        .left-column {

            width: 40%;

            min-width: 0;
        }

        .right-column {

            width: 60%;

            min-width: 0;

            display: flex;

            flex-direction: column;

        }
        
        /* ===== ОБЩИЕ СТИЛИ BODY ===== */
        
        html {

            scrollbar-gutter: stable;
        }

        body {

            /* Шрифт страницы */
            font-family: 'Inter', sans-serif;

            /* Максимальная ширина контента */
            max-width: 1600px;

            /* Центрирование */
            margin: 10px auto;

            /* Внутренние отступы */
            padding: 20px;

            /* Цвет фона */
            background: #f5f5f5;
        }

        /* ===== ГЛАВНЫЙ ЗАГОЛОВОК ===== */

        h1 {

            text-align: center;
        }

        .app-topbar {

            max-width: 1600px;

            margin: 0 auto 16px;

            display: flex;

            align-items: center;

            justify-content: space-between;

            gap: 18px;

            padding: 12px 16px;

            box-sizing: border-box;

            border: 1px solid #e5e7eb;

            border-radius: 14px;

            background: rgba(255, 255, 255, 0.94);

            box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
        }

        .app-brand {

            min-width: 0;

            display: flex;

            align-items: center;

            gap: 10px;
        }

        .app-brand-mark {

            width: 36px;

            height: 36px;

            display: block;

            flex: 0 0 auto;

            object-fit: contain;
        }

        .app-brand-text {

            min-width: 0;

            display: flex;

            flex-direction: column;

            gap: 1px;
        }

        .app-brand-text strong {

            color: #111827;

            font-size: 15px;

            line-height: 18px;
        }

        .app-brand-text span {

            color: #6b7280;

            font-size: 13px;

            line-height: 16px;
        }

        .app-topbar-actions {

            min-width: 0;

            display: flex;

            align-items: center;

            justify-content: flex-end;

            gap: 10px;
        }

        .app-user-pill {

            max-width: min(520px, 48vw);

            overflow: hidden;

            text-overflow: ellipsis;

            white-space: nowrap;

            padding: 0;

            color: #b45309;

            font-size: 13px;

            font-weight: 600;
        }

        .teacher-entry {

            max-width: 1600px;

            margin: -4px auto 14px;

            display: flex;

            justify-content: flex-end;
        }

        .teacher-entry a,
        .teacher-link,
        .teacher-secondary-button,
        .student-password-button {

            display: inline-flex;

            align-items: center;

            justify-content: center;

            min-height: 32px;

            padding: 6px 12px;

            box-sizing: border-box;

            border: 1px solid #e5e7eb;

            border-radius: 10px;

            background: white;

            color: #111827;

            font: inherit;

            font-size: 13px;

            font-weight: 600;

            text-decoration: none;

            box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        }

        .teacher-entry a:hover,
        .teacher-link:hover,
.teacher-secondary-button:hover {

            background: #f9fafb;
        }

.teacher-admin-add-button {
    justify-self: start;
    min-height: 32px;
    min-width: auto;
    padding: 6px 12px;
    width: auto;
}

        .teacher-link {

            min-height: auto;

            padding: 0;

            border: 0;

            background: transparent;

            color: #4b5563;

            box-shadow: none;
        }

        .teacher-link:hover {

            color: #111827;

            background: transparent;
        }

        .teacher-template-button {

            min-height: 32px;

            padding: 6px 9px;

            color: #4b5563;

            font-size: 13px;

            box-shadow: none;
        }

        .student-bar[hidden],
        .student-modal[hidden] {

            display: none;
        }

        #student_name {

            min-width: 0;

            overflow: hidden;

            text-overflow: ellipsis;

            white-space: nowrap;

            display: inline-flex;
        }

        .student-logout,
.teacher-logout-button {

            flex: 0 0 auto;

            display: inline-flex;

            align-items: center;

            justify-content: center;

            min-height: 32px;

            min-width: 112px;

            padding: 6px 12px;

            box-sizing: border-box;

            border: 1px solid #fecaca;

            border-radius: 10px;

            background: #fff7f7;

            color: #991b1b;

            font: inherit;

            font-size: 13px;

            font-weight: 600;

            box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);

            cursor: pointer;
        }

        .student-logout:hover,
        .teacher-logout-button:hover {

            background: #fee2e2;
        }

        .password-cancel-button {

            background: #f9fafb;

            color: #374151;

            border: 1px solid #e5e7eb;
        }

        .password-cancel-button:hover {

            background: #f3f4f6;
        }

        .student-modal {

            position: fixed;

            inset: 0;

            z-index: 100;

            display: flex;

            align-items: flex-start;

            justify-content: center;

            padding: 56px 20px 20px;

            box-sizing: border-box;

            overflow-y: auto;

            background: rgba(245,245,245,0.88);

            backdrop-filter: blur(4px);
        }

        .student-card {

            position: relative;

            width: 420px;

            max-width: calc(100vw - 40px);

            height: 300px;

            display: grid;

            grid-template-rows: 28px 42px 42px 38px 34px 34px;

            gap: 14px;

            padding: 26px 24px;

            box-sizing: border-box;

            border: 1px solid #e5e7eb;

            border-radius: 16px;

            background: white;

            box-shadow: 0 18px 40px rgba(17,24,39,0.14);
        }

        .student-card h2 {

            margin: 0 0 4px;

            color: #111827;

            font-size: 20px;

            line-height: 28px;
        }

        .student-card input,
        .student-card select {

            width: 100%;

            height: 42px;

            padding: 10px 12px;

            box-sizing: border-box;

            border: 1px solid #d1d5db;

            border-radius: 10px;

            font: inherit;
        }

        .student-class-fields {

            display: grid;

            grid-template-columns: 1fr 1fr;

            gap: 10px;
        }

        .student-card input:focus,
        .student-card select:focus {

            border-color: #e98a3a;

            outline: none;

            box-shadow: 0 0 0 3px rgba(233, 138, 58, 0.16);
        }

        .student-card button {

            height: 42px;

            border-radius: 10px;
        }

        .student-teacher-link {

            height: 38px;

            display: inline-flex;

            align-items: center;

            justify-content: center;

            color: #374151;

            font-size: 14px;

            text-decoration: none;

            border: 1px solid #e5e7eb;

            border-radius: 10px;

            background: #f9fafb;
        }

        .student-card .student-teacher-link {

            margin-top: 2px;

            margin-bottom: 0;
        }

        .password-change-card {

            height: 372px;

            grid-template-rows: 28px 42px 42px 42px 38px 38px 34px;
        }

        .student-teacher-link:hover {

            background: #f3f4f6;
        }

        .login-demo-hint {

            position: absolute;

            top: calc(100% + 12px);

            left: 24px;

            right: 24px;

            margin: 0;

            display: flex;

            align-items: center;

            color: #6b7280;

            font-size: 13px;

            line-height: 17px;
        }

        .login-demo-hint + .login-demo-hint {

            top: calc(100% + 36px);
        }

        .student-error {

            min-height: 34px;

            color: #dc2626;

            font-size: 14px;

            line-height: 17px;
        }

        /* ===== ОКНО ЧАТА ===== */

        .chat {

            background: white;

            border-radius: 16px;

            padding: 20px;

            border: 1px solid #e5e7eb;

            overflow-y: auto;

            margin-bottom: 8px;

            box-shadow: 0 2px 8px rgba(0,0,0,0.05);

            display: flex;

            flex-direction: column;

            gap: 10px;

            min-width: 0;

            height: 570px;

            scrollbar-gutter: stable;
        }

        /* ===== ОБЩИЙ СТИЛЬ СООБЩЕНИЙ ===== */

        .message {

            padding: 12px;

            border-radius: 10px;

            margin-bottom: 15px;

            white-space: pre-wrap;

            word-break: break-word;

            max-width: 75%;

            
        }

        /* ===== СООБЩЕНИЕ ПОЛЬЗОВАТЕЛЯ ===== */

        .user {

            align-self: flex-end;

            background: #e98a3a;

            color: white;

            max-width: 75%;
        }

        /* ===== СООБЩЕНИЕ AI ===== */

        .assistant {

            align-self: flex-start;

            background: transparent;

            border: none;

            max-width: 75%;

            padding-left: 0;
        }


        /* ===== ПОЛЯ ВВОДА ===== */

        textarea {

            display: block;

            width: 100%;

            padding: 13px 55px 13px 48px;

            border-radius: 18px;

            box-sizing: border-box;

            min-height: 46px;

            max-height: 220px;

            overflow-y: hidden;

            resize: none;

            font-size: 15px;

            line-height: 20px;

            font-family: 'Inter', sans-serif;

            border: 1px solid #d1d5db;

            background: white;

            transition:
                border-color 0.2s,
                box-shadow 0.2s;

            outline: none;
        }

        textarea:focus {

            border-color: #e98a3a;

            box-shadow:
                0 0 0 3px
                rgba(233, 138, 58, 0.16);
        }

        /* ===== ВЫПАДАЮЩИЕ СПИСКИ ===== */

        select {

            padding: 5px;

            margin-right: 10px;
        }

        /* ===== КНОПКА ===== */

        button {

            padding: 10px 20px;

            border: none;

            border-radius: 8px;

            background: #e98a3a;

            color: white;

            cursor: pointer;

            font-size: 16px;

            cursor: pointer;

            transition: 0.2s;
        }

        .send-button:hover {

           background: #1f2937;

           transform: scale(1.05);
        }

        .send-button:disabled {

            opacity: 0.5;

            cursor: not-allowed;
        }

        .input-area {

            position: sticky;

            bottom: 0;

            display: flex;

            flex-direction: column;

            gap: 8px;

            padding: 0;

            background: transparent;

            border: none;

            border-radius: 0;

            box-shadow: none;
        }

        .input-wrapper {

            position: relative;

            width: 100%;

            background: white;

            border: 1px solid #e5e7eb;

            border-radius: 18px;

            box-shadow:
                0 2px 8px rgba(0,0,0,0.04);
        }

        .send-button {

            position: absolute;

            right: 10px;

            bottom: 5px;

            width: 36px;

            height: 36px;

            border: none;

            border-radius: 50%;

            background: #111827;

            color: white;

            font-size: 16px;

            cursor: pointer;

            display: flex;

            align-items: center;

            justify-content: center;

            transition: 0.2s;
            
            padding: 0;


        }

        .upload-button {

            position: absolute;

            left: 12px;

            bottom: 5px;

            width: 36px;

            height: 36px;

            display: flex;

            align-items: center;

            justify-content: center;

            cursor: pointer;

            border-radius: 50%;

            transition:
                background 0.2s;

            z-index: 2;
        }

        .upload-button:hover {

            background: #f3f4f6;
        }
    
        /* ===== ЭФФЕКТ НАВЕДЕНИЯ ===== */

        button:hover {

            background: #d97706;
        }

        /* ===== БЕЛЫЕ БЛОКИ ===== */

        .block {

            background: white;

            padding: 15px;

            border-radius: 10px;

            margin-bottom: 20px;

            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }



/*Точечки */

.message.loading {

    padding: 2px 10px 2px 0px;

    margin-bottom: 4px;

    line-height: 0.8;

    min-height: 14px;
    
}

.typing {

    display: inline-flex;

    align-items: center;

    margin-left: -24px;

    gap: 4px;
}

.typing span {

    width: 6px;

    height: 6px;

    border-radius: 50%;

    background: #9ca3af;

    animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) {

    animation-delay: 0.2s;
}

.typing span:nth-child(3) {

    animation-delay: 0.4s;
}

@keyframes bounce {

    0%, 80%, 100% {

        transform: scale(0.7);

        opacity: 0.5;
    }

    40% {

        transform: scale(1);

        opacity: 1;
    }
}

/*Превью*/
#imagePreview {

    display: flex;

    gap: 8px;

    flex-wrap: wrap;
}

.preview-image {

    width: 72px;

    height: 72px;

    border-radius: 12px;

    border: 1px solid #e5e7eb;

    object-fit: cover;
}

.preview-wrapper {

    position: relative;

    display: inline-block;
}

.remove-image {

    position: absolute;

    top: -6px;

    right: -6px;

    width: 20px;

    height: 20px;

    border: none;

    border-radius: 50%;

    background: #111827;

    color: white;

    cursor: pointer;

    font-size: 14px;

    line-height: 20px;

    padding: 0;
}

/* Баббл пользователя */
/* Общий user-bubble */
.message.user {
    background: #fff1df;
    color: #7c3a08;
    max-width: 75%;
    border-radius: 14px;
    padding: 8px 12px;
    margin: 4px 0;
    display: flex;
    flex-direction: column; /* текст сверху, картинка снизу */
    gap: 6px;
    word-break: break-word;
}

/* Текст внутри bubble */
.message.user .text-content {
    white-space: pre-wrap;
}

/* Картинка внутри bubble */
.message.user .image-message {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    align-self: flex-end;
}

/* Left task panel */
.left-column > .block {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.left-column > .block > h3,
.left-column > .block > .block,
.left-column > .block > #select_block {
    width: 100%;
}

.left-column > .block > h3 {
    order: 0;
}

.left-column h3 {
    margin: 0 0 12px;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
}

.left-column > .block > .block {
    order: 2;
    flex: 0 1 auto;
    box-sizing: border-box;
    max-height: calc(
        var(--right-work-height)
        - var(--select-block-height)
        - 14px
    );
    overflow: hidden;
    padding: 18px;
    margin: 0;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: white;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

[hidden] {
    display: none !important;
}

.teacher-page .teacher-topbar-actions .teacher-link {
    display: none !important;
}

.left-column > .block > .block {
    display: flex;
    flex-direction: column;
}

.left-column #problem_view {
    order: 1;
    flex: 0 1 auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #111827;
}

.left-column #problem_view {
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.5;
    overflow-wrap: anywhere;
    scrollbar-gutter: stable;
}

.left-column #problem_view ol {
    box-sizing: border-box;
    max-width: 100%;
    padding-left: 24px;
}

.left-column #problem_view li {
    overflow-wrap: anywhere;
}

.left-column #problem_view mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.left-column #problem_image {
    order: 2;
    flex: 0 0 auto;
    margin-top: 12px !important;
}

.left-column #problem_image img {
    max-height: 220px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
}

#select_block {
    order: 1;
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
    padding: 18px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: white;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

#select_block h3 {
    width: 100%;
    margin-bottom: 10px;
}

#select_block select {
    flex: 0 0 auto;
    width: 54px;
    min-height: 40px;
    margin: 0;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    color: #111827;
    font: inherit;
}

#select_block #group_select {
    width: 104px;
}

.progress-block {
    width: 100%;
    margin-top: 18px;
    padding: 18px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: white;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.progress-header h3 {
    margin: 0;
}

#progress_summary {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.progress-table {
    max-height: 360px;
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 2px;
}

.progress-grid {
    min-width: max-content;
}

.progress-matrix {
    display: inline-flex;
    flex-direction: column;
    min-width: max-content;
    width: max-content;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-matrix-head {
    display: grid;
    grid-template-columns: 54px max-content;
    align-items: center;
    background: #f9fafb;
    border-bottom: 1px solid #eef2f7;
}

.progress-section {
    display: grid;
    grid-template-columns: 54px max-content;
    align-items: center;
    border-bottom: 1px solid #eef2f7;
}

.progress-section:last-child {
    border-bottom: 0;
}

.progress-section-title {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-sizing: border-box;
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    border-right: 1px solid #d1d5db;
    background: #ffffff;
}

.progress-cells {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 38px;
    align-items: center;
    gap: 0;
    width: max-content;
}

.progress-number,
.progress-cell-placeholder {
    width: 38px;
    height: 32px;
    box-sizing: border-box;
}

.progress-number {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    background: #f9fafb;
    border-right: 1px solid #eef2f7;
}

.progress-number:last-child {
    border-right: 0;
}

.progress-cell {
    position: relative;
    width: 38px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    border: 0;
    border-right: 1px solid #eef2f7;
    border-radius: 0;
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
}

.progress-cell:hover {
    background: #f3f4f6;
    color: #111827;
    transform: none;
}

.progress-cell.current {
    box-shadow: inset 0 0 0 2px #e98a3a;
}

.progress-cell.tried {
    background: #fef3c7;
    color: #92400e;
}

.progress-cell.passed {
    background: #dcfce7;
    color: #166534;
}

.progress-cell-placeholder {
    box-sizing: border-box;
    border-right: 1px solid #eef2f7;
    background: #ffffff;
}

.progress-major-start {
    border-left: 1px solid #cbd5e1;
}

.progress-matrix-head .progress-major-start {
    border-left-color: #cbd5e1;
    background: #f9fafb;
}

.progress-cell strong {
    font-size: 12px;
    font-weight: 700;
}

.progress-override-marker {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.progress-override-pass {
    background: #16a34a;
}

.progress-override-fail {
    background: #dc2626;
}

.progress-empty {
    padding: 12px;
    color: #6b7280;
    font-size: 14px;
}

.teacher-page {
    max-width: 1600px;
}

.teacher-page-title {
    margin-bottom: 18px;
}

.teacher-topbar {
    margin-bottom: 16px;
}

.teacher-topbar-main {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.teacher-topbar-title {
    color: #111827;
    font-size: 17px;
    font-weight: 700;
}

.teacher-topbar-subtitle {
    margin-top: 2px;
    color: #6b7280;
    font-size: 13px;
}

.teacher-topbar-actions {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.teacher-tabs {
    flex: 1 1 auto;
    min-width: 260px;
    max-width: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin: 0;
    padding: 0;
}

.teacher-tab {
    min-height: 34px;
    padding: 7px 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #4b5563;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.teacher-tab:hover {
    color: #111827;
    background: transparent;
}

.teacher-tab.is-active {
    color: #111827;
    background: transparent;
    box-shadow: inset 0 -2px 0 #e98a3a;
}

.teacher-panel {
    padding: 18px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: white;
    box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

@media (max-width: 900px) {
    .teacher-topbar {
        flex-wrap: wrap;
    }

    .teacher-tabs {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        justify-content: flex-start;
        padding-top: 2px;
    }
}

.teacher-panel + .teacher-panel {
    margin-top: 18px;
}

.teacher-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.teacher-panel-header h2 {
    margin: 0;
    font-size: 20px;
}

.teacher-panel-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.teacher-panel-header p,
#teacher_students_summary,
#teacher_progress_summary {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 13px;
}

#teacher_journal_summary {
    color: #6b7280;
    font-size: 13px;
}

.teacher-students-table {
    overflow-x: auto;
}

.teacher-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
}

.teacher-journal-panel .teacher-filters {
    margin-bottom: 14px;
}

.teacher-classes-list {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.teacher-create-class-panel {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef2f7;
}

.teacher-class-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 120px auto;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    background: white;
}

.teacher-class-row:last-child {
    border-bottom: 0;
}

.teacher-class-row:hover {
    background: #f9fafb;
}

.teacher-class-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.teacher-class-main strong {
    overflow: hidden;
    color: #111827;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-class-main span,
.teacher-class-meta {
    color: #6b7280;
    font-size: 13px;
}

.teacher-class-meta {
    text-align: right;
    white-space: nowrap;
}

.teacher-class-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.teacher-delete-class-button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #9ca3af;
    font: inherit;
    font-size: 20px;
    line-height: 26px;
    cursor: pointer;
}

.teacher-delete-class-button:hover {
    color: #b91c1c;
    background: #fee2e2;
}

.teacher-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.teacher-admin-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

[data-legacy-admin-tab],
[data-teacher-view="admin"] > .teacher-panel-header,
.teacher-admin-tabs {
    display: none !important;
}

.teacher-admin-tab {
    min-height: 30px;
    padding: 5px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4b5563;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.teacher-admin-tab.active {
    background: white;
    color: #b45309;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.teacher-admin-section {
    min-width: 0;
}

.teacher-admin-section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.teacher-admin-section-header h3 {
    margin: 0;
    font-size: 15px;
}

.teacher-admin-section-header-stacked {
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
}

.teacher-admin-teacher-form,
.teacher-admin-school-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto minmax(120px, auto);
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.teacher-admin-teacher-form input,
.teacher-admin-school-form input {
    min-height: 34px;
    padding: 7px 10px;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 13px;
}

.teacher-admin-school-form input {
    grid-column: 1 / 3;
}

#admin_teacher_result,
#admin_school_result,
#admin_class_add_result,
#admin_import_result {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.teacher-admin-status-error {
    color: #991b1b !important;
}

.teacher-admin-filter {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    color: #6b7280;
    font-size: 13px;
}

.teacher-admin-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(190px, 240px) minmax(180px, 1fr) 80px 80px 190px;
    align-items: end;
    gap: 10px;
    width: 100%;
}

.teacher-admin-filter select {
    width: 100%;
    min-height: 32px;
    padding: 5px 34px 5px 9px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 13px;
}

.teacher-admin-filter:nth-child(1) {
    grid-column: 1;
}

.teacher-admin-filter:nth-child(2) {
    grid-column: 2;
}

.teacher-admin-th-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.teacher-admin-th-filter span {
    padding: 0 9px;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}

.teacher-admin-th-filter select {
    width: 100%;
    min-height: 30px;
    padding: 5px 34px 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
}

.teacher-admin-filter select,
.teacher-admin-th-filter select,
.teacher-admin-inline-select,
.teacher-filters select {
    appearance: none;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
}

.teacher-admin-table {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.teacher-admin-classes-table {
    overflow-x: hidden;
}

.teacher-admin-list {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    box-sizing: border-box;
    font-size: 13px;
}

.teacher-admin-classes-list {
    min-width: 0;
}

.teacher-admin-list .admin-class-col-school {
    width: 30%;
}

.teacher-admin-list .admin-class-col-class {
    width: 30%;
}

.teacher-admin-list .admin-class-col-base {
    width: 16%;
}

.teacher-admin-list .admin-class-col-actions {
    width: 24%;
}

.teacher-admin-classes-list-admin .admin-class-col-school {
    width: 22%;
}

.teacher-admin-classes-list-admin .admin-class-col-class {
    width: 24%;
}

.teacher-admin-classes-list-admin .admin-class-col-base {
    width: 12%;
}

.teacher-admin-classes-list-admin .admin-class-col-actions {
    width: 16%;
}

.teacher-admin-classes-list-admin .admin-class-col-teacher {
    width: 26%;
}

.teacher-admin-list th,
.teacher-admin-list td {
    padding: 8px 9px;
    box-sizing: border-box;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.teacher-admin-list th {
    background: #f9fafb;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    vertical-align: top;
}

.teacher-admin-th-plain {
    display: inline-block;
    padding: 1px 9px 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teacher-admin-cell-text {
    display: block;
    overflow: hidden;
    padding: 0 9px;
    text-overflow: ellipsis;
}

.teacher-admin-class-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-left: 9px;
}

.teacher-admin-class-cell .teacher-admin-cell-text {
    flex: 1 1 auto;
    padding: 0;
}

.teacher-admin-school-cell,
.teacher-admin-teacher-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-left: 9px;
}

.teacher-admin-school-cell .teacher-admin-cell-text,
.teacher-admin-teacher-cell .teacher-admin-cell-text {
    flex: 1 1 auto;
    padding: 0;
}

.teacher-admin-class-buttons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
}

.teacher-admin-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    color: #7c3a08;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    cursor: pointer;
}

.teacher-admin-icon-button:hover {
    background: #fff1df;
}

.teacher-admin-reset-password:hover {
    color: #92400e;
}

.teacher-admin-class-name-edit {
    display: grid;
    grid-template-columns: minmax(58px, 0.6fr) minmax(52px, 1fr);
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.teacher-admin-class-count {
    color: #6b7280;
    font-weight: 500;
}

.teacher-admin-class-journal-button {
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 32px;
    min-width: 112px;
    padding: 6px 12px;
    border: 1px solid #fde3bf;
    border-radius: 10px;
    background: #fff8f0;
    color: #b45309;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    white-space: nowrap;
}

.teacher-admin-list .teacher-admin-class-journal-button {
    min-width: 88px;
    padding-right: 9px;
    padding-left: 9px;
}

.teacher-admin-class-journal-button:hover {
    background: #ffefd8;
}

.teacher-admin-class-journal-button:disabled {
    border-color: #e5e7eb;
    background: #f3f4f6;
    color: #9ca3af;
    box-shadow: none;
    cursor: default;
}

.teacher-admin-list tr:last-child td {
    border-bottom: 0;
}

.teacher-admin-row-archived td {
    background: #f3f4f6;
    color: #4b5563;
}

.teacher-admin-row-archived .teacher-admin-cell-text,
.teacher-admin-row-archived .teacher-admin-inline-select {
    color: #4b5563;
}

.teacher-admin-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.teacher-hidden-file-input {
    display: none;
}

.teacher-admin-action {
    min-height: 32px;
    min-width: 112px;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    color: #374151;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    cursor: pointer;
}

.teacher-admin-list .teacher-admin-action {
    min-width: 88px;
    padding-right: 10px;
    padding-left: 10px;
    white-space: nowrap;
}

.teacher-admin-actions-add-class {
    flex-wrap: wrap;
    max-width: none;
    overflow: visible;
}

.teacher-admin-actions-add-class .teacher-admin-action {
    min-width: auto;
    padding-right: 9px;
    padding-left: 9px;
}

.teacher-admin-action:hover {
    background: #f9fafb;
}

.teacher-admin-action-archive {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(254, 226, 226, 0.65);
    color: #991b1b;
}

.teacher-admin-action-archive:hover {
    background: rgba(254, 202, 202, 0.8);
}

.teacher-admin-action-restore {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(220, 252, 231, 0.72);
    color: #166534;
}

.teacher-admin-action-restore:hover {
    background: rgba(187, 247, 208, 0.84);
}

.teacher-admin-action-save {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(220, 252, 231, 0.72);
    color: #166534;
}

.teacher-admin-action-save:hover {
    background: rgba(187, 247, 208, 0.84);
}

.teacher-admin-action-cancel {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(254, 226, 226, 0.65);
    color: #991b1b;
}

.teacher-admin-action-cancel:hover {
    background: rgba(254, 202, 202, 0.8);
}

.teacher-admin-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.teacher-admin-create-class-toggle {
    margin-bottom: 0;
}

.teacher-admin-inline-select {
    min-height: 30px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 5px 34px 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background-color: white;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
}

.teacher-admin-inline-input {
    min-height: 30px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background-color: white;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
}

.teacher-admin-inline-select option {
    background: white;
    color: #111827;
    font: inherit;
}

.teacher-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #6b7280;
    font-size: 13px;
}

.teacher-filters select {
    min-height: 38px;
    padding: 8px 34px 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background-color: white;
    font: inherit;
    font-size: 14px;
}

.teacher-import-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.teacher-import-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}

.teacher-import-teacher-field {
    grid-column: 1;
}

.teacher-import-school-field {
    grid-column: 1;
}

.teacher-import-common-field {
    min-width: 0;
}

.teacher-import-file-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.teacher-import-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.teacher-single-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.teacher-import-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #6b7280;
    font-size: 13px;
}

.teacher-import-form input,
.teacher-import-form select,
.teacher-single-form input {
    min-height: 38px;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 14px;
}

#teacher_import_result {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.teacher-student-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.teacher-student-cell strong {
    min-width: 0;
    flex: 1 1 auto;
}

.teacher-student-icon-button {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #9ca3af;
    font: inherit;
    font-size: 18px;
    line-height: 20px;
    cursor: pointer;
    opacity: 0.35;
}

.teacher-reset-student-password {
    font-size: 13px;
}

.teacher-student-icon-button:hover {
    opacity: 1;
}

.teacher-reset-student-password:hover {
    color: #92400e;
    background: #fef3c7;
}

.teacher-remove-student:hover {
    color: #b91c1c;
    background: #fee2e2;
}

.teacher-journal tbody tr:hover .teacher-student-icon-button {
    opacity: 0.9;
}

.teacher-journal-table {
    overflow: auto;
    max-height: min(520px, 56vh);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.teacher-journal {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.teacher-journal th,
.teacher-journal td {
    height: 34px;
    padding: 0 8px;
    box-sizing: border-box;
    border-right: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    text-align: center;
    white-space: nowrap;
}

.teacher-journal th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f9fafb;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}

.teacher-journal thead tr:nth-child(2) th {
    top: 34px;
}

.teacher-block-heading {
    border-bottom-color: #d1d5db;
}

.teacher-task-heading {
    min-width: 44px;
}

.teacher-chapter-summary-heading {
    min-width: 58px;
    color: #111827;
    background: #f3f4f6;
}

.teacher-journal .teacher-student-column {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 240px;
    max-width: 240px;
    text-align: left;
    background: white;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teacher-journal th.teacher-student-column {
    z-index: 3;
    background: #f9fafb;
}

.teacher-journal .teacher-total-column {
    min-width: 64px;
    font-weight: 700;
    background: #ffffff;
}

.teacher-journal th.teacher-total-column {
    background: #f9fafb;
}

.teacher-journal-cell {
    position: relative;
    min-width: 44px;
    color: #6b7280;
    background: #f9fafb;
    font-weight: 700;
}

.teacher-journal-cell.tried {
    background: #fef3c7;
    color: #92400e;
}

.teacher-journal-cell.passed {
    background: #dcfce7;
    color: #166534;
}

.teacher-clickable-cell {
    cursor: pointer;
}

.teacher-clickable-cell:hover {
    box-shadow: inset 0 0 0 2px #e98a3a;
}

.teacher-override-marker {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.teacher-override-pass {
    background: #16a34a;
}

.teacher-override-fail {
    background: #dc2626;
}

.teacher-chapter-summary {
    min-width: 58px;
}

.teacher-chapter-summary strong,
.teacher-chapter-summary span {
    display: block;
    line-height: 1.15;
}

.teacher-chapter-summary strong {
    font-size: 12px;
}

.teacher-chapter-summary span {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.72;
}

.teacher-journal .teacher-major-start {
    border-left: 1px solid #cbd5e1;
}

.teacher-dialog[hidden] {
    display: none;
}

.teacher-dialog {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.teacher-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.24);
}

.teacher-dialog-panel {
    position: relative;
    z-index: 1;
    width: min(360px, 100%);
    padding: 18px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.teacher-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.teacher-dialog-header h2 {
    margin: 0;
    font-size: 18px;
}

.teacher-dialog-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 20px;
    line-height: 26px;
    cursor: pointer;
}

.teacher-dialog-panel p {
    margin: 8px 0;
    color: #4b5563;
}

.teacher-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.teacher-confirm-actions {
    justify-content: flex-end;
}

.teacher-confirm-accept {
    border-color: #fde3bf;
    background: #fff8f0;
    color: #b45309;
}

.teacher-confirm-accept:hover {
    background: #ffefd8;
}

.teacher-pass-button {
    background: #dcfce7;
    color: #166534;
}

.teacher-fail-button {
    background: #fee2e2;
    color: #991b1b;
}

.teacher-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.teacher-table th,
.teacher-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    white-space: nowrap;
}

.teacher-table th {
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    background: #f9fafb;
}

.teacher-table tbody tr {
    cursor: pointer;
}

.teacher-table tbody tr:hover,
.teacher-row-selected {
    background: #f8fafc;
}

.teacher-detail[hidden] {
    display: none;
}

.teacher-class-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.teacher-class-filter select {
    min-width: 110px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 14px;
}

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .left-column,
    .right-column {
        width: 100%;
    }

    #select_block select {
        flex-basis: 100%;
        width: 100%;
    }
}
