.student-group-container {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* height устанавливается динамически через JavaScript */
}

.student-group-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    min-height: 0; /* Критически важно для вложенных flex контейнеров */
}

.tree-panel {
    flex: 0.5;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    overflow-x: hidden;
}

.tree-container {
    padding: 0.5em;
}

.details-panel {
    flex: 1;
    background-color: #ffffff;
    overflow-y: auto;
    padding: 1.5em;
    padding-top: 0;
}

.tree-item {
    user-select: none;
}

.tree-item-content {
    display: flex;
    align-items: center;
    padding: 0.2em 0.4em;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.85em;
}

.tree-item-content:hover {
    background-color: #f5f5f5;
}

.tree-item-content.selected {
    background-color: #e3f2fd;
}

/* Стили для треугольника раскрытия */
.tree-item-toggle {
    width: 14px;
    height: 14px;
    margin-right: 0.2em;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-item-toggle:before {
    content: '▶';
    font-size: 0.6em;
    transition: transform 0.2s;
}

.tree-item.expanded > .tree-item-content .tree-item-toggle:before {
    transform: rotate(90deg);
}

.tree-item-toggle.empty:before {
    content: '';
}

.tree-item-name {
    /* Убран flex: 1 чтобы кнопки не прижимались вправо */
}

.tree-children {
    margin-left: 1.5em;
}

.tree-children.hidden {
    display: none;
}

/* Уровни отступов */
.tree-item-content.level-0 {
    padding-left: 0.4em;
    font-weight: 600;
}

.tree-item-content.level-1 {
    padding-left: 1.9em;
    font-weight: 500;
}

.tree-item-content.level-2 {
    padding-left: 3.4em;
    font-size: 0.8em;
}

/* Детали */
.details-empty {
    text-align: center;
    padding: 3em 1em;
    color: #757575;
}

.details-header {
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid #e0e0e0;
}

.details-title {
    font-size: 1.25em;
    font-weight: 500;
    margin-bottom: 0.25em;
}

.details-type {
    font-size: 0.875em;
    color: #757575;
}

.details-section {
    margin-bottom: 1.5em;
}

.details-section h4 {
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 0.5em;
    color: #757575;
}

.details-list {
    list-style: none;
}

.details-list li {
    padding: 0.25em 0;
    font-size: 0.875em;
}

.details-stats {
    display: flex;
    gap: 2em;
    margin-bottom: 1em;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.25em;
    font-weight: 500;
}

/* Кнопки действий */
.tree-item-actions {
    display: none;
    gap: 0.1em;
    margin-left: 0.3em;
}

.tree-item-content.selected .tree-item-actions {
    display: inline-flex;
}

.tree-action-btn {
    background: none;
    border: none;
    padding: 0.2em;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    font-size: 0.8em;
}

.tree-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tree-action-btn.with-icon {
    font-size: 0.9em;
}

.tree-action-btn .icon {
    display: inline-block;
}

/* Inline категории */
.categories-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    margin-left: 0.5em;
}

.categories-inline {
    display: inline-flex;
    gap: 0.3em;
    /*flex-shrink: 0;*/
    flex-wrap: wrap;
}

.category-block {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 3px;
    padding: 0.1em 0.4em;
    font-size: 0.7em;
    color: #757575;
    white-space: nowrap;
}

.btn-add-categories {
    margin-left: 0.5em;
}

.inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.2em 0.5em;
    font-size: 0.75em;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.inline-btn:hover {
    background-color: #f5f5f5;
    border-color: #2196F3;
    color: #2196F3;
}

/* Модальное окно категорий */
.category-edit-container {
    padding: 1em;
}

.category-item {
    padding: 1em;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 6px;
    margin-bottom: 1.5em;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
}

.category-header h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 500;
}

.category-add {
    text-align: center;
    margin-top: 1em;
}

/* Стили для orphan секции */
.orphan-container {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 2px dashed #e0e0e0;
}

.orphan-root {
    padding: 0.5em;
}

.orphan-header {
    display: flex;
    align-items: center;
    padding: 0.4em;
    font-style: italic;
    color: #757575;
}

.orphan-title {
    font-weight: 500;
}

.orphan-count {
    margin-left: 0.5em;
    color: #999;
}

.orphan-actions {
    margin-left: auto;
}

.orphan-list-container {
    margin-left: 1.5em;
}

.orphan-item-content {
    padding-left: 0.4em;
    font-size: 0.85em;
}

.orphan-item-content:hover {
    background-color: #f5f5f5;
}

.orphan-item-content.selected {
    background-color: #e3f2fd;
}

/* ===== ПАНЕЛЬ КОНСТРЕЙНТОВ ===== */

/* Панель констрейнтов */
.constraints-panel {
    flex: 0 0 400px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    transition: flex-basis 0.3s ease;
    position: relative;
    min-height: 0; /* Важно для flex */
}

.constraints-panel.collapsed {
    flex-basis: 30px;
}

.constraints-panel-toggle {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.btn-panel-toggle {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    width: 20px;
    height: 60px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-panel-toggle:hover {
    background-color: #f5f5f5;
}

.toggle-icon:before {
    content: '◀';
    font-size: 0.8em;
    color: #757575;
    transition: transform 0.3s;
}

.constraints-panel.collapsed .toggle-icon:before {
    transform: rotate(180deg);
}

.constraints-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Критически важно */
}

.constraints-panel.collapsed .constraints-panel-content {
    display: none;
}

/* Список констрейнтов */
.constraints-list-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Критически важно для правильной работы overflow */
}

.constraints-list {
    flex: 1;
    overflow-y: auto;
    border-bottom: 1px solid #e0e0e0;
    padding: 1em;
    min-height: 0; /* Важно */
}

.constraint-group {
    margin-bottom: 1.5em;
}

.constraint-group-header {
    margin-bottom: 0.5em;
}

.constraint-group-header h5 {
    margin: 0;
    font-size: 0.9em;
    font-weight: 600;
    color: #757575;
}

.constraint-group-items {
    margin-left: 0.5em;
}

.constraint-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 3px;
}

.constraint-item:hover {
    background-color: #f5f5f5;
}

.constraint-item.selected {
    background-color: #e3f2fd;
}

.constraint-add-btn {
    background: none;
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 2px;
    margin-right: 0.5em;
    font-size: 0.9em;
}

.constraint-add-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.constraint-name {
    font-size: 0.85em;
}

/* Описание констрейнта */
.constraint-description {
    flex: 0 0 120px;
    padding: 1em;
    background-color: #caf9b563;
    overflow-y: auto;
}

.description-header h4 {
    margin: 0 0 0.5em 0;
    font-size: 1em;
    font-weight: 500;
}

.description-content {
    font-size: 0.85em;
    color: #757575;
}

.description-empty {
    text-align: center;
    color: #999;
    font-size: 0.85em;
}

/* Entity Badge Dashlet Styles */
.dashlet-body .entity-badge {
    padding: 0;
}

.dashlet-body .entity-badge .data-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 16px;
    margin: 0;
    transition: none;
}

.dashlet-body .entity-badge .data-card:hover {
    transform: none;
    box-shadow: none;
}

.dashlet-body .entity-badge .data-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dashlet-body .entity-badge .data-card-icon {
    font-size: 28px;
    color: var(--gray-600);
}

.dashlet-body .entity-badge .data-card-title {
    flex: 1;
}

.dashlet-body .entity-badge .data-card-title h3 {
    font-size: 16px;
    margin-bottom: 2px;
    color: var(--gray-900);
    font-weight: 600;
}

.dashlet-body .entity-badge .data-card-count {
    font-size: 13px;
    color: var(--gray-600);
}

.dashlet-body .entity-badge .data-card-stats {
    font-size: 12px;
    line-height: 1.6;
    color: var(--gray-600);
}

.dashlet-body .entity-badge .data-card-stats small {
    display: block;
}

.dashlet-body .entity-badge h3 {
    margin-top: 0;
}