<div class="card department-workspace-control-card">
    <div class="card-header-row">
        <h2>Рабочая область кафедры</h2>
        <button type="button" class="btn btn-md btn-secondary" id="department-workspace-refresh">Обновить</button>
    </div>

    <div class="department-workspace-filter-grid">
        <div class="form-group" id="department-workspace-department-field">
            <label for="department-workspace-department">Кафедра</label>
            <select id="department-workspace-department" data-native-select="true">
                <option value="">Загрузка...</option>
            </select>
        </div>
        <div class="form-group">
            <label for="department-workspace-start">Начало периода</label>
            <input type="date" id="department-workspace-start">
        </div>
        <div class="form-group">
            <label for="department-workspace-end">Окончание периода</label>
            <input type="date" id="department-workspace-end">
        </div>
    </div>

    <div class="form-alert" id="department-workspace-alert" role="alert"></div>
</div>

<div class="department-workspace-grid department-workspace-grid-wide department-workspace-actions-grid">
    <div class="card create-card department-subject-import-card">
        <div class="card-header-row">
            <h2>Загрузка дисциплин</h2>
        </div>
        <form id="department-subject-import-form" class="stack-form">
            <div class="subject-import-slots-panel">
                <div class="card-header-row">
                    <label class="schedule-section-label" style="margin:0">Дисциплины для загрузки</label>
                    <button type="button" class="btn btn-sm btn-secondary" id="subject-import-add">Добавить строку</button>
                </div>
                <div id="subject-import-rows" class="subject-import-rows-list"></div>
            </div>
            <button type="submit" class="btn btn-md btn-secondary">Загрузить</button>
            <div class="form-alert" id="department-subject-import-alert" role="alert"></div>
        </form>
    </div>

    <div class="card create-card department-teacher-assign-card">
        <div class="card-header-row">
            <h2>Добавить преподавателя</h2>
        </div>
        <form id="department-teacher-assign-form" class="stack-form">
            <div class="form-group">
                <label for="department-teacher-select">Преподаватель</label>
                <select id="department-teacher-select" data-native-select="true">
                    <option value="">Загрузка...</option>
                </select>
            </div>
            <div class="form-group">
                <label for="department-teacher-assign-comment">Комментарий</label>
                <input type="text" id="department-teacher-assign-comment" placeholder="Например, ведет лабораторные работы">
            </div>
            <button type="submit" class="btn btn-md btn-secondary">Привязать к кафедре</button>
            <div class="form-alert" id="department-teacher-assign-alert" role="alert"></div>
        </form>
    </div>

    <div class="card create-card department-teacher-request-card">
        <div class="card-header-row">
            <h2>Заявка на преподавателя</h2>
        </div>
        <form id="department-teacher-request-form" class="stack-form">
            <div class="form-group">
                <label for="teacher-request-username">Логин</label>
                <input type="text" id="teacher-request-username" placeholder="ivanov_teacher" maxlength="50" required>
            </div>
            <div class="form-group">
                <label for="teacher-request-fullname">ФИО</label>
                <input type="text" id="teacher-request-fullname" placeholder="Иванов Иван Иванович" maxlength="255" required>
            </div>
            <div class="form-group">
                <label for="teacher-request-jobtitle">Должность</label>
                <input type="text" id="teacher-request-jobtitle" placeholder="Доцент" maxlength="255">
            </div>
            <div class="form-group">
                <label for="teacher-request-comment">Комментарий</label>
                <input type="text" id="teacher-request-comment" placeholder="Что важно проверить администратору">
            </div>
            <button type="submit" class="btn btn-md btn-primary">Отправить заявку</button>
            <div class="form-alert" id="department-teacher-request-alert" role="alert"></div>
        </form>
    </div>

    <div class="card department-teachers-card">
        <div class="card-header-row">
            <h2>Преподаватели и нагрузка</h2>
        </div>
        <div class="metric-grid" id="department-teachers-list">Загрузка...</div>
    </div>
</div>

<div class="card department-workspace-table-card">
    <div class="card-header-row">
        <h2>Заявки кафедры</h2>
        <span class="muted" id="department-teacher-request-count">0 заявок</span>
    </div>
    <div class="table-wrap">
        <table>
            <thead>
                <tr>
                    <th>Статус</th>
                    <th>Логин</th>
                    <th>ФИО</th>
                    <th>Должность</th>
                    <th>Комментарий</th>
                    <th>Рассмотрение</th>
                </tr>
            </thead>
            <tbody id="department-teacher-requests-tbody">
                <tr><td colspan="6" class="loading-row">Загрузка...</td></tr>
            </tbody>
        </table>
    </div>
</div>

<div class="card department-workspace-table-card">
    <div class="card-header-row">
        <h2>Дисциплины кафедры</h2>
        <span class="muted" id="department-subject-count">0 дисциплин</span>
    </div>
    <div class="table-wrap">
        <table>
            <thead>
                <tr>
                    <th>Код</th>
                    <th>Название</th>
                    <th>Описание</th>
                    <th>Комментарии</th>
                </tr>
            </thead>
            <tbody id="department-subjects-tbody">
                <tr><td colspan="4" class="loading-row">Загрузка...</td></tr>
            </tbody>
        </table>
    </div>
</div>

<div class="card department-workspace-table-card" id="department-comments-card" hidden>
    <div class="card-header-row">
        <h2 id="department-comments-title">Комментарии</h2>
        <button type="button" class="btn btn-sm btn-ghost" id="department-comments-close">Скрыть</button>
    </div>

    <form id="department-comment-form" class="form-row">
        <input type="hidden" id="department-comment-subject-id">
        <div class="form-group">
            <label for="department-comment-text">Новый комментарий</label>
            <input type="text" id="department-comment-text" placeholder="Добавьте примечание по дисциплине">
        </div>
        <button type="submit" class="btn btn-md btn-primary">Сохранить</button>
    </form>
    <div class="form-alert" id="department-comment-alert" role="alert"></div>
    <div class="department-comment-list" id="department-comment-list">Выберите дисциплину</div>
</div>
