#sidebar *, #context-menu, .notes-content, .invite-content, .delete-confirm-content, .tier-limit-content {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

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

        body {
            /* remove flex so sidebar does not push the main canvas layout */
            min-height: 100vh;
            background-color: #f5f5f7;
            color: #1d1d1f;
            margin: 0;
            padding-top: var(--header-height);
        }

        #sidebar {
            box-sizing: border-box;
            width: 385px;
            min-width: 400px;
            max-width: 600px;
            background-color: #ffffff;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: fixed; /* overlay on the left, independent from main */
            left: 0;
            top: var(--header-height);
            height: calc(100vh - var(--header-height));
            border-right: 1px solid #e5e5e7;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            z-index: 2200;
            transform: translateX(0);
            transition: transform 0.25s ease;
        }

        body.sidebar-collapsed #sidebar {
            transform: translateX(-100%);
            border-right: none;
            box-shadow: none;
        }

        .resize-handle {
            position: absolute;
            top: 0;
            right: 0;
            width: 15px;
            height: 100%;
            cursor: col-resize;
            z-index: 10;
        }

        #sidebar .section {
            padding: 15px;
        }

       #sidebar .section-header {
            padding-top: 10px;
            padding-left: 30px;
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 16px;
            color: #474646;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        #templates-section {
            display: flex;
            flex-direction: column;
            border-bottom: 1px solid #e5e5e7;
            min-height: 150px;
            position: relative;
            overflow: auto;
        }

        #sidebar .templates-header {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: 95px;
            padding-top: 10px;
            background-color: white;
        }

        .templates-content {
            flex: 1;
            min-height: 200px;
            overflow-y: auto;
            position: relative;
            background-color: #f8f8fa;
        }

        #students-section {
            flex-shrink: 0;
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 100px;
        }

        .students-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .students-content {
            background-color: #f2f2f5;
            font-size: 14px;
            line-height: 1.5;
            color: #3a3a3c;
            border: 1px solid #e5e5e7;
            overflow-y: auto;
            flex: 1;
        }

        #sidebar .file-system {
            list-style: none;
            min-height: 100%;
            padding-bottom: 10px;
            position: relative;
        }

        #sidebar .folder,
        #sidebar .file {
            margin: 1px 0;
            cursor: pointer;
            user-select: none;
            font-size: 14px;
        }

        .folder-content,
        .file-content {
            display: flex;
            align-items: center;
            border-radius: 6px;
            transition: all 0.2s ease;
        }

        #sidebar .folder-content {
            padding: 0px 8px;
        }

        #sidebar .file-content {
            padding: 4px 8px;
        }

        .folder-content:hover,
        .file-content:hover {
            background-color: #f0f0f5;
        }

        .file-selected {
            background-color: #f0f0f5;
        }

        .folder-content.active,
        .file-content.active {
            background-color: #e6f2ff;
            color: #007AFF;
        }

        #sidebar .folder-arrow {
            margin-right: 6px;
            width: 16px;
            text-align: center;
            transition: transform 0.2s;
            font-size: 10px;
            color: #8b8b8d;
            cursor: pointer;
        }

        .folder.expanded>.folder-content>.folder-arrow {
            transform: rotate(90deg);
        }

        .folder-name,
        .file-name {
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #sidebar .file-name {
            padding-left: 22px;
        }

        #sidebar .folder-children {
            display: none;
            padding-left: 16px;
        }

        #sidebar .folder.expanded>.folder-children {
            display: block;
        }

        .context-menu {
            position: absolute;
            background-color: #ffffff;
            border: 1px solid #e5e5e7;
            border-radius: 10px;
            padding: 5px 0;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            z-index: 2300;
            display: none;
            min-width: 160px;
            backdrop-filter: blur(10px);
        }

        .context-menu-item {
            padding: 8px 15px;
            font-size: 14px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        #sidebar .context-menu-item {
            padding: 8px 15px;
        }

        .context-menu-item:hover {
            background-color: #f0f0f5;
            color: #007AFF;
        }

        .context-menu-item.disabled {
            color: #c0c0c0;
            cursor: not-allowed;
        }

        .context-menu-item.disabled:hover {
            background-color: transparent;
            color: #c0c0c0;
        }

        #sidebar .action-buttons {
            position: absolute;
            right: 15px;
            margin-top: 10px;
            display: flex;
            gap: 20px;
        }

        #sidebar .editable-input {
            background-color: #ffffff;
            border: 1px solid #007AFF;
            border-radius: 6px;
            padding: 4px 8px;
            color: #1d1d1f;
            font-size: 14px;
            width: 100%;
            outline: none;
        }

        .folder-actions {
            opacity: 0;
            transition: opacity 0.2s;
            display: flex;
            gap: 5px;
        }

        .folder-content:hover .folder-actions {
            opacity: 1;
        }

        #sidebar .action-btn {
            background: none;
            border: none;
            color: #8b8b8d;
            cursor: pointer;
            font-size: 14px;
            padding: 5px 7px;
            border-radius: 4px;
            transition: all 0.2s;
            opacity: 0.4;
        }

        #sidebar .action-btn:hover {
            transform: scale(1.1);
            opacity: 1;
        }

        .add-folder-in-folder img {
            width: 24px;
            height: 24px;
        }

        .add-file-in-folder img {
            width: 22px;
            height: 22px;
        }

        #add-file-btn img {
            width: 22px;
            height: 22px;
            position: relative;
            top: -7px;
        }

        #add-pdf-btn img {
            width: 22px;
            height: 22px;
            position: relative;
            top: -7px;
        }

        #add-folder-btn img {
            width: 24px;
            height: 24px;
            position: relative;
            top: -6px;
        }

        .add-file-to-student img {
            width: 18px;
            height: 18px;
            position: relative;
        }

        .add-folder-to-student img {
            width: 20px;
            height: 20px;
            position: relative;
        }

        .add-item-button {
            transition: all 0.2s;
            cursor: pointer;
            opacity: 0.4;
        }

        .add-item-button:hover {
            transform: scale(1.1);
            opacity: 1;
        }

        /* Стили для учеников */
        .students-list {
            list-style: none;
        }

        #sidebar .student {
            margin-bottom: 8px;
            background-color: white;
            border: 1px solid #e5e5e7;
            transition: all 0.2s;
        }

        #sidebar .student-content {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            justify-content: space-between; /* .student-left left, .student-right right */
        }

        .student-content:hover {
            background-color: #f9f9f9;
        }

        /* Left part: arrow + name */
        .student-left {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
        }

        /* Right part of student row: sticks to the right as a group */
        .student-right {
            display: flex;
            align-items: center;
            gap: 0;
            justify-content: flex-end;
        }

        /* Status is always visible */
        .student-right .student-status {
            margin: 0;
        }

        /* Actions container: collapsed by default so status is at the right edge */
        .student-actions {
            display: flex;
            align-items: center;
            gap: 6px;
            max-width: 0;
            overflow: hidden;
            opacity: 0;
            transition: max-width 0.1s ease, opacity 0.1s ease;
        }

        .student-content:hover .student-actions {
            max-width: 420px;
            overflow: visible;
            opacity: 1;
        }

        /* When student is expanded, always show actions (no hover needed) */
        .student.expanded .student-actions {
            max-width: 420px;
            overflow: visible;
            opacity: 1;
        }

        #sidebar .student-arrow {
            margin-right: 8px;
            width: 16px;
            text-align: center;
            transition: transform 0.2s;
            font-size: 10px;
            color: #8b8b8d;
            cursor: pointer;
        }

        .student.expanded .student-arrow {
            transform: rotate(90deg);
        }

        #sidebar .student-name {
            flex: 1;
            font-size: 14px;
            margin-right: 10px;
            max-width: 120px;
            min-width: 60px;
            overflow: hidden;
        }

        #sidebar .student-status {
            width: 10px;
            min-width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-right: 4px;
        }

        .student-status.online {
            background-color: #4CAF50;
        }

        .student-status.offline {
            background-color: #FFC107;
        }

        #sidebar .share-link {
            font-size: 12px;
            color: #007AFF;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .share-link:hover {
            background-color: #f0f0f5;
            transform: scale(1.05);
        }

        .share-link.copied {
            color: #4CAF50;
            background-color: #E8F5E9;
        }

        #sidebar .invite-btn {
            font-size: 12px;
            color: #007AFF;
            cursor: pointer;
            padding: 4px 10px;
            border-radius: 999px;
            border: 1px solid rgba(0, 122, 255, 0.25);
            background: rgba(0, 122, 255, 0.06);
            transition: all 0.2s;
            white-space: nowrap;
        }

        #sidebar .invite-btn:hover {
            background: rgba(0, 122, 255, 0.10);
            transform: translateY(-1px);
        }

        #sidebar .invite-btn:active {
            transform: translateY(0px);
            background: rgba(0, 122, 255, 0.14);
        }

        #sidebar .add-student-btn {
            font-size: 22px;
            font-weight: bold;
            color: #474646;
            background: none;
            border: none;
            cursor: pointer;
            padding: 3px;
            border-radius: 4px;
            transition: all 0.2s;
            position: relative;
            right: 20px;
            top: -4px;
        }

        .add-student-btn:hover {
            background-color: #f0f0f5;
            transform: scale(1.1);
        }

        /* Стили для материалов учеников */
        .student-materials {
            display: none;
            background-color: #f8f8fa;
            border-top: 1px solid #e5e5e7;
        }

        .student.expanded .student-materials {
            display: block;
        }

        .student-materials-title {
            font-size: 12px;
            font-weight: 600;
            color: #474646;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex: 1;
        }

        .student-materials-actions {
            display: flex;
            gap: 10px;
        }

        .student-materials-content {
            min-height: 50px;
            max-height: 300px;
            overflow: auto;
            position: relative;
        }

        /* Стили для разделителя между секциями */
        .section-divider {
            height: 8px;
            cursor: row-resize;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s;
        }

        .section-divider:hover {
            background-color: #e5e5e7;
        }

        .section-divider::before {
            content: '';
            width: 30px;
            height: 2px;
            background-color: #c0c0c0;
            border-radius: 1px;
        }

        .section-divider.resizing {
            background-color: #e5e5e7;
        }

        .student-root-folder>.folder-content>.folder-actions {
            opacity: 1;
        }

        .add-items-block {
            display: flex;
            margin-left: auto;
            gap: 5px;
        }

        #sidebar .student-materials-content .folder-content,
        #sidebar .student-materials-content .file-content {
            padding: 0px 8px 0px 32px;
        }

        #root-context-menu {
            position: absolute;
        }

        #students-root-context-menu {
            position: absolute;
        }

        .student-note {
            opacity: 0.6;
            width: 24px;
            cursor: pointer;
            position: relative;
            top: 6px;
        }

        .student-note:active {
            opacity:1;
            scale: 0.8;
        }

        /* Стили для модального окна заметок */
        .notes-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 2000;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .notes-modal.active {
            display: flex;
            opacity: 1;
        }

        .notes-content {
            background-color: white;
            border-radius: 12px;
            width: 800px;
            height: 600px;
            max-width: 90vw;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            transform: scale(0.8);
            transition: transform 0.3s ease;
        }

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

        .notes-header {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0px 12px;
            border-bottom: 1px solid #e5e5e7;
        }

        .notes-title {
            font-size: 18px;
            font-weight: 600;
            color: #1d1d1f;
        }

        .notes-close {
            position: absolute;
            right: 0px;
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #8b8b8d;
            transition: color 0.2s;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .notes-close:hover {
            color: #1d1d1f;
            background-color: #f0f0f5;
        }

        .notes-body {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .notes-textarea {
            flex: 1;
            border: 1px solid #e5e5e7;
            border-radius: 0px 0px 8px 8px;
            padding: 16px;
            font-size: 16px;
            line-height: 1.5;
            resize: none;
            outline: none;
            transition: border-color 0.2s;
            font-family: inherit;
        }

        .notes-textarea:focus {
            border-color: #007AFF;
        }

        .notes-textarea::placeholder {
            color: #8b8b8d;
        }

        .invite-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 3200;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .invite-modal.active {
            display: flex;
            opacity: 1;
        }

        .invite-content {
            background-color: white;
            border-radius: 12px;
            width: 520px;
            max-width: 92vw;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            transform: scale(0.92);
            transition: transform 0.3s ease;
            border: 1px solid #e5e5e7;
        }

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

        .invite-header {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 12px 12px;
            border-bottom: 1px solid #e5e5e7;
            position: relative;
        }

        .invite-title {
            font-size: 16px;
            font-weight: 600;
            color: #1d1d1f;
        }

        .invite-close {
            position: absolute;
            right: 10px;
            top: 8px;
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #8b8b8d;
            transition: color 0.2s;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .invite-close:hover {
            color: #1d1d1f;
            background-color: #f0f0f5;
        }

        .invite-body {
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .invite-link-row {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .invite-link-input {
            flex: 1;
            height: 40px;
            border: 1px solid #e5e5e7;
            border-radius: 10px;
            padding: 0 12px;
            font-size: 13px;
            color: #1d1d1f;
            outline: none;
            background: #f8f8fa;
        }

        .invite-link-input:focus {
            border-color: #007AFF;
            box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
            background: #ffffff;
        }

        .invite-copy-btn {
            width: 42px;
            height: 40px;
            border-radius: 10px;
            border: 1px solid #e5e5e7;
            background: #ffffff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.15s ease, transform 0.02s ease;
        }

        .invite-copy-btn:hover {
            background: #f0f0f5;
        }

        .invite-copy-btn:active {
            transform: translateY(1px);
        }

        .invite-copy-icon {
            width: 18px;
            height: 18px;
            opacity: 0.85;
        }

        .invite-copy-status {
            font-size: 12px;
            color: #4CAF50;
            text-align: right;
        }

        .delete-confirm-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 3200;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .delete-confirm-modal.active {
            display: flex;
            opacity: 1;
        }

        .tier-limit-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 3200;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .tier-limit-modal.active {
            display: flex;
            opacity: 1;
        }

        .tier-limit-content {
            background-color: #ffffff;
            border-radius: 12px;
            width: fit-content;
            max-width: 92vw;
            min-width: 390px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            transform: scale(0.92);
            transition: transform 0.3s ease;
            border: 1px solid #e5e5e7;
        }

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

        .tier-limit-header {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 12px 12px;
            padding-right: 44px;
            position: relative;
        }

        .tier-limit-title {
            font-size: 16px;
            font-weight: 600;
            color: #1d1d1f;
            max-width: 340px;
            text-align: center;
            line-height: 1.25;
            white-space: normal;
        }

        .tier-limit-close {
            position: absolute;
            right: 10px;
            top: 8px;
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #8b8b8d;
            transition: color 0.2s;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .tier-limit-close:hover {
            color: #1d1d1f;
            background-color: #f0f0f5;
        }

        .tier-limit-body {
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .tier-limit-text {
            font-size: 14px;
            line-height: 1.5;
            color: #1d1d1f;
        }

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

        .tier-limit-actions .delete-confirm-btn {
            min-width: 220px;
        }

        .delete-confirm-content {
            background-color: #ffffff;
            border-radius: 12px;
            width: fit-content;
            max-width: 92vw;
            min-width: 320px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            transform: scale(0.92);
            transition: transform 0.3s ease;
            border: 1px solid #e5e5e7;
        }

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

        .delete-confirm-header {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 12px 40px 12px 12px;
            border-bottom: 1px solid #e5e5e7;
            position: relative;
        }

        .delete-confirm-title {
            font-size: 14px;
            font-weight: 600;
            color: #1d1d1f;
            line-height: 1.3;
            text-align: left;
            width: 100%;
        }

        .delete-confirm-close {
            position: absolute;
            right: 10px;
            top: 8px;
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #8b8b8d;
            transition: color 0.2s;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .delete-confirm-close:hover {
            color: #1d1d1f;
            background-color: #f0f0f5;
        }

        .delete-confirm-body {
            padding: 12px;
            display: flex;
            flex-direction: column;
        }

        .delete-confirm-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .delete-confirm-btn {
            height: 38px;
            padding: 0 14px;
            border-radius: 10px;
            border: 1px solid #e5e5e7;
            background: #ffffff;
            cursor: pointer;
            font-size: 13px;
            color: #1d1d1f;
            transition: background-color 0.15s ease, transform 0.02s ease;
        }

        .delete-confirm-btn:hover {
            background: #f0f0f5;
        }

        .delete-confirm-btn:active {
            transform: translateY(1px);
        }

        .delete-confirm-btn-danger {
            border-color: rgba(255, 59, 48, 0.35);
            background: rgba(255, 59, 48, 0.08);
            color: #FF3B30;
        }

        .delete-confirm-btn-danger:hover {
            background: rgba(255, 59, 48, 0.12);
        }
