/* ============================================
 * style.css — examAI.ru
 * Дизайн приведён к стилю style2 (DocuBrowser)
 * ============================================ */

/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    padding-top: 52px;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Шапка */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #2c3e50;
    color: white;
    padding: 0 20px;
    margin-bottom: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    gap: 20px;
}

.header-inner-center {
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.logo:hover {
    text-decoration: none;
}

.logo span {
    color: #3498db;
}

/* Логотип на страницах без входа — та же высота, что и меню (как в torg) */
.header-inner-center .logo {
    flex: 1;
    justify-content: center;
    padding: 15px 0;
}

/* Навигация */
.nav {
    display: flex;
    gap: 5px;
}

.nav a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 15px 12px;
}

.nav a:hover {
    background: #34495e;
    text-decoration: none;
}

.nav a.active {
    background: #3498db;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: stretch;
}

.nav-user {
    color: #ecf0f1;
    padding: 15px 12px;
    display: flex;
    align-items: center;
    border-left: 1px solid #34495e;
    white-space: nowrap;
}

.nav-link-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    text-decoration: none;
    padding: 15px 12px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-link-btn:hover {
    background: #c0392b;
}

.inline-form {
    display: inline;
}

.role-badge {
    background: #3498db;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 8px;
}

/* Основной контент */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовки */
h1 {
    margin-bottom: 20px;
    color: #2c3e50;
}

h2 {
    margin: 20px 0 10px;
    color: #2c3e50;
}

h3 {
    color: #2c3e50;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0 16px;
    height: 34px;
    line-height: 34px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .05s;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(1.06);
}

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

.btn:focus-visible {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

.btn-primary { background: #3498db; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-success:hover { background: #229954; }
.btn-danger  { background: #e74c3c; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #95a5a6; box-shadow: none; }
.btn-secondary:hover { background: #7f8c8d; }

.btn:disabled {
    background: #bdc3c7;
    border-color: #bdc3c7;
    color: #fff;
    cursor: default;
    transform: none;
    box-shadow: none;
    opacity: 1;
}

.btn-sm {
    padding: 0 12px;
    height: 30px;
    line-height: 30px;
    font-size: 13px;
}

input.submit {
    display: inline-block;
    padding: 0 20px;
    height: 34px;
    line-height: 34px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: #3498db;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    transition: background .15s, box-shadow .15s;
}

input.submit:hover { background: #2980b9; }
input.submit:disabled { opacity: .55; cursor: default; }

/* Таблицы */
.grid-table {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}

.grid-table-header,
.grid-table-row {
    display: grid;
    gap: 0;
    align-items: center;
}

.grid-table-header > div,
.grid-table-row > div {
    padding: 10px 12px;
    overflow-wrap: anywhere;
}

.grid-table-header {
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.grid-table-header > div {
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.grid-table-row {
    border-bottom: 1px solid #eee;
}

.grid-table-row:last-child {
    border-bottom: none;
}

/* Таблица плановых смен: подсказка под датой отдельной строкой и кнопка удаления
   по центру своей колонки (в узкой колонке она прилипала к правому краю таблицы). */
.swHint {
    font-size: 13px;
    color: #8a8f98;
    margin-top: 3px;
}

.grid-table-header > div.swDel,
.grid-table-row > div.swDel {
    text-align: center;
}

.grid-table-row:hover {
    background: #f8f9fa;
}

/* Тулбар (как в torg: контрагенты) */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.toolbar-left {
    display: flex;
    gap: 5px;
    align-items: center;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar select {
    height: 34px;
    padding: 0 12px;
    max-width: 200px;
}

/* Форма фильтров результатов */
.results-filter-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.results-filter-form input[type=text],
.results-filter-form input[type=date] {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d5dbdb;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #2c3e50;
    box-sizing: border-box;
}

.results-filter-form input[type=text] {
    width: 130px;
}

.rf-label {
    font-size: 13px;
    color: #7f8c8d;
}

.results-filter-form input[type=date] {
    width: 132px;
}

.results-filter-form input:focus {
    outline: none;
    border-color: #3498db;
}

/* Кликабельные строки таблицы */
.grid-table-row.clickable {
    cursor: pointer;
}

/* Статусы пользователей (аналог debt-positive/debt-negative в torg) */
.status-active {
    color: #27ae60;
    font-weight: 600;
}

.status-blocked {
    color: #e74c3c;
    font-weight: 600;
}

.status-pending {
    color: #e67e22;
    font-weight: 600;
}

/* Иконка-квадрат в последней колонке (как в torg) */
.icon-btn-square {
    width: 34px;
    height: 34px;
    display: flex;
    text-decoration: none;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 17px;
    font-size: 14px;
    cursor: pointer;
}

.icon-btn-delete {
    color: #e74c3c;
}

/* Название строки: стрелки отдельным блоком, текст — своим: перенос
 * длинного названия больше не заезжает под стрелки. */
.explorer-name {
    display: flex;
    align-items: flex-start;
    min-width: 0;
}

.explorer-name .row-sort {
    flex: 0 0 auto;
}

.explorer-name-text {
    flex: 1;
    min-width: 0;
}

/* Стрелки ручной сортировки: уже обычных кнопок. */
.row-sort {
    display: inline-flex;
    gap: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

.row-sort .icon-btn-square {
    width: 22px;
    height: 24px;
    border-radius: 4px;
    font-size: 14px;
}

.icon-btn-arrow {
    color: #7f8c8d;
}

.icon-btn-arrow:hover {
    background: #eaf2f8;
    color: #2980b9;
}

.icon-btn-disabled {
    opacity: .3;
    cursor: default;
}

.icon-btn-disabled:hover {
    background: transparent;
    color: #7f8c8d;
}

.icon-btn-delete:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.icon-btn-delete:active {
    background: #c0392b;
    border-color: #c0392b;
}

/* Форма в 2 колонки (как в torg: контрагенты) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: start;
}

.form-grid .form-group input[type=text],
.form-grid .form-group input[type=password],
.form-grid .form-group select,
.form-grid .form-group input[type=date] {
    width: 100%;
    max-width: none;
    height: 38px;
    box-sizing: border-box;
}

/* Форма «смены»: правая колонка чуть шире левой, чтобы поле даты было крупнее
   соседних полей, но промежуток между колонками оставался обычным (15px) —
   иначе поля слипались. */

.form-grid.form-grid-sw {
    grid-template-columns: 1fr 1.22fr;
}

.form-grid .form-group-full {
    grid-column: 1 / -1;
}

.form-grid .form-group textarea,
.form-group.form-group-full textarea {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.form-actions {
    margin-top: 20px;
}

.form-actions-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-actions-left {
    display: flex;
    gap: 8px;
}

/* Вход */
.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 36px 36px 28px;
    margin: 30px auto;
    text-align: center;
}

.login-title-text {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 16px;
}

.login-hint {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 14px;
}

.login-card .form-group label {
    color: #2c3e50;
    text-align: center;
}

.login-card .form-group input[type=text],
.login-card .form-group input[type=password],
.login-card .form-group input[type=number] {
    max-width: none;
    height: auto;
    padding: 11px 14px;
    font-size: 15px;
}

.login-card p {
    text-align: center;
}

.login-back {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(0,0,0,0.08);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 19px;
    line-height: 1;
    text-decoration: none;
    transition: background .15s;
}

.login-back:hover {
    background: rgba(0,0,0,0.14);
    color: #fff;
    text-decoration: none;
}

.login-btn {
    width: 100%;
    height: 42px;
    line-height: 42px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}

/* Панели и карточки */
.panel,
.plan-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 18px 20px;
    margin-bottom: 16px;
}

/* ---------- Результаты: предмет → тема → кнопки попыток ---------- */
.res-topic {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eef1f4;
}

.res-topic-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.res-topic-meta {
    margin-left: 8px;
    font-size: 12px;
    font-weight: normal;
    color: #95a5a6;
}

.res-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.res-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 76px;
    padding: 6px 10px;
    border: 1px solid #dfe6e9;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: #2c3e50;
}

.res-btn:hover {
    border-color: #3498db;
    background: #f4f8fb;
    text-decoration: none;
}

.res-btn-pct {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.res-btn-date {
    font-size: 11px;
    color: #95a5a6;
    white-space: nowrap;
}

.res-good {
    background: #eaf7ee;
    border-color: #bfe3cb;
}

.res-mid {
    background: #fef8e7;
    border-color: #f2e2b0;
}

.res-low {
    background: #fdecea;
    border-color: #f5c6c0;
}

.res-best {
    box-shadow: inset 0 0 0 2px #3498db;
}

.panel h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.plan-title {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.plan-teacher {
    font-size: 13px;
    color: #95a5a6;
    margin-bottom: 6px;
}

.text-muted {
    color: #95a5a6;
    font-size: 13px;
    font-weight: normal;
}

.text-right {
    text-align: right;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #16a085;
    background: #e8f8f5;
    border-radius: 10px;
    vertical-align: middle;
}

.badge-soft {
    color: #2980b9;
    background: #ebf5fb;
}

/* Сетка карточек групп */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.group-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.group-card-blocked {
    background: #fbfbfb;
    box-shadow: none;
    border: 1px solid #e5e8ea;
}

.group-card-blocked .group-card-title {
    color: #95a5a6;
}

.group-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #ecf0f1;
}

.group-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

.group-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-card-actions .badge {
    margin-left: 0;
}

.group-card-body {
    padding: 14px 16px;
}

.group-card-empty {
    color: #95a5a6;
    font-size: 13px;
    padding: 6px 0;
}

.slot-editor {
    margin-top: 2px;
}

.quota-editor {
    margin-top: 2px;
}

.quota-hint {
    display: block;
    color: #95a5a6;
    font-size: 12px;
    margin-bottom: 8px;
}

.slot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.slot-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.slot-on {
    background: #e8f8ef;
    color: #27ae60;
}

.slot-off {
    background: #fdecea;
    color: #e74c3c;
}

.slot-empty {
    color: #95a5a6;
    font-size: 12px;
    margin-bottom: 8px;
}

.slot-sep {
    color: #95a5a6;
}

/* ---------- Сетка «урок × день недели» ---------- */

.qg {
    display: grid;
    grid-template-columns: 96px repeat(7, minmax(34px, 1fr));
    gap: 4px;
    align-items: center;
    margin-bottom: 10px;
}

.qg-time {
    font-size: 12px;
    color: #2c3e50;
    font-weight: 600;
    white-space: nowrap;
}

.qg-day {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #7f8c8d;
}

.qg-cell {
    position: relative;
    display: block;
    height: 26px;
    cursor: pointer;
}

.qg-cell input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.qg-cell span {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: #eef1f2;
    border: 1px solid #e2e6e8;
    transition: background .12s ease;
}

.qg-cell:hover span {
    background: #dfe6e9;
}

/* значок плановых смен у слота (число записей) — ссылка на раздел «Смены» */
.qg-sw {
    position: absolute;
    right: 2px;
    bottom: 1px;                     /* нижний правый угол: верхний занят галкой */
    z-index: 3;
    font-size: 10px;
    line-height: 1.25;
    padding: 0 3px;
    border-radius: 3px;
    background: rgba(41, 55, 70, .72);
    color: #fff;
    text-decoration: none;
}

.qg-sw:hover {
    background: #2980b9;
}

.qg-cell input:checked + span {
    background: var(--gcolor, #27ae60);
    border-color: rgba(0, 0, 0, .2);
}

.qg-cell input:checked + span::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.qg-cell.qg-free:hover span {
    border-color: var(--gcolor, #27ae60);
    background: color-mix(in srgb, var(--gcolor, #27ae60) 14%, #fff);
}

.qg-taken {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    border-radius: 4px;
    background: var(--gcolor, #8e44ad);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
    opacity: .55;
    cursor: not-allowed;
}

.qg-taken b {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    white-space: nowrap;
}

/* Область админского расписания: увеличенные ячейки и шрифты */
.quota-panel .qg-time {
    font-size: 15px;
}
.quota-panel .qg-day {
    font-size: 13px;
}
.quota-panel .qg-cell {
    height: 39px;
}
.quota-panel .qg-taken {
    height: 39px;
    opacity: 0.35;
}
.quota-panel .qg-taken b {
    font-size: 12px;
}
.quota-panel .qg-cell b {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    white-space: nowrap;
    pointer-events: none;
}
.quota-panel .qg-cell input:checked + span::after {
    content: '';
}

/* Расписание ученика: сетка как у админа, цветом — только своё время с ИИ */
.quota-grid .qg-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    border-radius: 4px;
    cursor: default;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.quota-grid .qg-yours {
    background: var(--gcolor, #27ae60);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}

.quota-grid .qg-busy {
    background: #e8ecee;
    border: 1px solid #dfe4e7;
}

.quota-grid .qg-idle {
    background: #fff;
    border: 1px dashed #dbe1e4;
}

.quota-grid .qg-now {
    box-shadow: inset 0 0 0 2px #2c3e50;
}

.quota-grid .qg-today {
    color: #2c3e50;
    text-decoration: underline;
}

.quota-legend {
    margin-top: 10px;
    gap: 4px 14px;
}

.quota-legend-busy {
    background: #e8ecee;
    border: 1px solid #dfe4e7;
}

.quota-legend-idle {
    background: #fff;
    border: 1px dashed #dbe1e4;
}

.quota-form .form-actions {
    display: flex;
    justify-content: flex-end;
}

.quota-panel {
    margin: 14px 0 4px;
}

.quota-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.quota-pick-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid #e2e6e8;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.quota-pick-item:hover {
    border-color: #bdc3c7;
}

.quota-pick-item.active {
    background: #fff;
    border-color: #2c3e50;
    box-shadow: 0 0 0 1px #2c3e50 inset;
}

.quota-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
}

.quota-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.quota-hints {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #7f8c8d;
}

.quota-hint-mark {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.quota-hint-taken {
    opacity: .55;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}

.group-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #2c3e50;
}

.slot-na {
    background: #eceff1;
    color: #7f8c8d;
}

/* ---------- Пикер времени кнопками ---------- */

.du-timepicker {
    display: block;
    width: 100%;
}

.du-timepicker-pair {
    display: block;
    width: 100%;
}

.du-time-shifts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 6px;
    margin-bottom: 14px;
}

.du-time-shifts-label {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 600;
    color: #7f8c8d;
}

.du-time-shift {
    width: 100%;
    height: 38px;
}

.du-time-len.active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

.du-timep-display {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin: 2px 0 10px;
    font-variant-numeric: tabular-nums;
}

.du-timep-hours,
.du-timep-mins {
    display: grid;
    width: 100%;
    gap: 6px;
    margin-bottom: 10px;
}

.du-timep-hours {
    grid-template-columns: repeat(8, 1fr);
}

.du-timep-mins {
    grid-template-columns: repeat(6, 1fr);
}

.du-timep-btn {
    height: 38px;
    border: 1px solid #e2e6e8;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #2c3e50;
    font-variant-numeric: tabular-nums;
}

.du-timep-btn:hover {
    background: #f0f3f5;
}

.du-timep-mins .du-timep-btn {
    background: #eef4fb;
    border-color: #d3e2f2;
    color: #1f4e79;
}

.du-timep-mins .du-timep-btn:hover {
    background: #dde9f7;
}

.du-timep-btn.active {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

.du-timep-btn-dim {
    color: #b8c2c9;
    background: #fafbfc;
    border-color: #eef1f3;
}

.du-timep-btn-dim:hover {
    color: #95a5a6;
    background: #f2f5f7;
}

.quota-banner {
    display: block;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    margin: 12px 0;
    border: 1px solid;
}

.quota-head {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.quota-status {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.quota-schedule {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quota-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 92px;
    padding: 8px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.quota-block-current {
    border-color: currentColor;
    box-shadow: inset 0 0 0 2px currentColor, 0 1px 3px rgba(0, 0, 0, 0.08);
    background: #fff;
}

.quota-day {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.quota-time {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.quota-banner-on {
    background: #eafaf1;
    border-color: #d5f0e0;
    color: #1e8449;
}

.quota-banner-off {
    background: #fdf2f2;
    border-color: #f5dcdc;
    color: #b03a2e;
}

.quota-banner-on .quota-block {
    border-color: #c3e8d3;
}

.quota-banner-off .quota-block {
    border-color: #efc9c9;
}

.quota-open {
    color: #27ae60;
}

.quota-closed {
    color: #e74c3c;
}

.icon-danger {
    color: #e74c3c !important;
}

/* Чипы выбора учителей */
.group-teachers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 13px;
    border: 1px solid #cfd8dc;
    border-radius: 16px;
    background: #fff;
    color: #5d6d7e;
    cursor: pointer;
    user-select: none;
    transition: all .15s;
}

.chip:hover {
    border-color: #3498db;
}

.chip input {
    accent-color: #3498db;
}

.chip-on {
    background: #ebf5fb;
    border-color: #3498db;
    color: #2980b9;
    font-weight: 600;
}

.chip-blocked {
    background: #fdecea;
    border-color: #f5b7b1;
    color: #c0392b;
}

.chip-blocked:hover {
    border-color: #e74c3c;
}

/* Формы */
input[type=text], input[type=password], input[type=number],
input[type=date], input[type=email], select {
    font-family: inherit;
    font-size: 14px;
    color: #333;
    background: #fff;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input[type=text]:focus, input[type=password]:focus, input[type=number]:focus,
input[type=date]:focus, input[type=email]:focus, select:focus, textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,.16);
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group input[type=text], .form-group input[type=password],
.form-group input[type=number], .form-group select {
    width: 100%;
    max-width: 400px;
    height: 38px;
    padding: 0 12px;
}

/* Поле даты: родной виджет сам по себе мелкий и узкий — догоняем его до остальных,
   а цифры делаем чуть крупнее, чтобы «дд.мм.гггг» читалось без напряжения. */
.form-group input[type=date] {
    width: 100%;
    max-width: 400px;
    min-width: 200px;
    height: 38px;
    padding: 0 12px;
    box-sizing: border-box;
    font-size: 16px;
}

.form-group textarea {
    width: 100%;
    max-width: 400px;
    min-height: 120px;
}

textarea {
    width: 100%;
    max-width: 800px;
    min-height: 140px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    resize: vertical;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    outline: none;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

input[type=checkbox] {
    width: 15px;
    height: 15px;
    accent-color: #3498db;
    cursor: pointer;
    vertical-align: -2px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-inline input[type=text], .form-inline input[type=password],
.form-inline input[type=number], .form-inline select {
    height: 34px;
    padding: 0 12px;
    font-size: 14px;
}

.form-inline input[type=text], .form-inline input[type=password],
.form-inline input[type=number] {
    width: 200px;
}

.form-inline select {
    width: auto;
    min-width: 170px;
}

.form-inline label {
    font-size: 14px;
    color: #555;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

.form-inline label input[type=checkbox] {
    margin-right: 4px;
}

/* Алерты */
.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: left;
}

.alert-error {
    background: #fce4e4;
    color: #c0392b;
    border: 1px solid #e74c3c;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #27ae60;
}

/* Карточки контента экзамена */
.vopros,
.otvet,
.factors,
.uroven {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.vopros {
    border-left: 4px solid #f39c12;
}

.otvet {
    border-left: 4px solid #3498db;
}

/* Нестандартные подходы ученика — разбор находок */
.creative-block {
    border-left: 4px solid #9b59b6;
    background: #faf7fd;
}

.factors,
.uroven {
    border-left: 4px solid #27ae60;
}

/* Факторы */
table.factors-table {
    width: 100%;
    border-collapse: collapse;
}

table.factors-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

table.factors-table td:first-child {
    width: 52%;
    color: #555;
}

td.factors-bar {
    width: 33%;
}

div.factors-fill {
    height: 14px;
    background: #27ae60;
    border-radius: 3px;
    transition: width .6s ease;
}

td.factors-val {
    width: 15%;
    text-align: right;
    font-weight: 700;
    color: #2c3e50;
}

div.factors-avg {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

/* Дерево тем */
.tree {
    margin-top: 6px;
    /* Та же сетка, что у .tree-children: тема слева на всю ширину,
     * «Проверка» справа колонкой 112px — чтобы корневые темы (без разделов)
     * выглядели одинаково с темами внутри раздела. */
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 14px 12px;
    align-items: start;
}

/* Разделы и вложенные списки занимают всю ширину строки грида. */
.tree > .tree-branch,
.tree > .tree-children {
    grid-column: 1 / -1;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.tree-item:hover {
    background: #f8f9fa;
}

.tree-branch {
    font-weight: 600;
    color: #2c3e50;
}

.row-click {
    cursor: pointer;
}

.tree-leaf {
    display: block;
    color: #555;
}

.tree-leaf-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.tree-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tree-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lesson-meta {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    padding-left: 16px;
}

.tree-children {
    border-left: 2px dashed #e0e0e0;
    /* Темы раздела: слева кнопка с названием на всю оставшуюся ширину,
     * справа фиксированная колонка «Проверка». */
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 14px 12px;
    align-items: start;
    padding: 6px 0 8px 6px;
}

/* Разделы и вложенные сетки занимают всю ширину строки грида. */
.tree-children > .tree-branch,
.tree-children > .tree-children {
    grid-column: 1 / -1;
}

.tree-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tree-cell-topic { min-width: 0; }

.tree-topic-btn {
    width: 100%;
    text-align: left;
    /* Длинные названия тем переносим внутрь кнопки, а не за её край. */
    white-space: normal;
    height: auto;
    min-height: 34px;
    line-height: 1.3;
    padding: 6px 16px;
}

/* Не начатая тема — без рамки и фона. */
.tree-topic-btn {
    background: #fff;
    border: 0;
    box-shadow: none;
    color: #2c3e50;
    border-radius: 0;
    transition: background-color 0.3s ease;
}
.tree-topic-btn:hover { background: #f1f3f4; filter: none; }

/* Начатая тема — зелёная линия снизу 2px, без заливки. */
.tree-topic-btn.topic-started {
    background: #fff;
    box-shadow: inset 0 -2px 0 #7fd5a0;
    transition: background-color 0.3s ease;
}
.tree-topic-btn.topic-started:hover { background: #f1f3f4; filter: none; }

/* «Проверка» — светло-серая рамка; при прохождении — зелёная линия снизу. */
.tree-check-btn {
    width: 100%;
    background: #fff;
    border: 1px solid #dfe4e7;
    color: #5a6a74;
    box-shadow: none;
    border-radius: 0;
    transition: background-color 0.3s ease;
}
.tree-check-btn:hover { background: #f1f3f4; filter: none; }
.tree-check-btn.check-passed {
    background: #fff;
    border: 1px solid #dfe4e7;
    box-shadow: inset 0 -2px 0 #7fd5a0;
    color: #2c3e50;
    transition: background-color 0.3s ease;
}

.tree-toggle {
    cursor: pointer;
    user-select: none;
    color: #95a5a6;
    width: 16px;
    display: inline-block;
    margin-left: 6px;
}

.tree-label {
    flex: 1;
    font-size: 21px;
}

/* Счётчики тем перед названием: серые, фиксированной ширины — названия не «пляшут». */
.tree-stats {
    display: inline-block;
    min-width: 78px;
    margin-right: 6px;
    text-align: right;
    color: #95a5a6;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Все темы начаты и проверены — раздел пройден полностью. */
.tree-stats-done {
    color: #27ae60;
}

button.tree-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 24px;
    line-height: 24px;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
}

button.tree-btn:hover { background: #2980b9; }

.tree-add {
    color: #95a5a6;
    font-size: 13px;
}

.hidden { display: none; }

/* Стенограмма */
.qa-item {
    background: #fff;
    border-left: 4px solid #3498db;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 14px 18px;
    margin-bottom: 12px;
}

.qa-q {
    margin-bottom: 8px;
}

.qa-a {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    color: #444;
}

/* Чат обучения */
.learn-nav {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 50;
}

.learn-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.learn-nav-btn:hover,
.learn-nav-btn:hover:link,
.learn-nav-btn:hover:visited {
    background: rgba(52, 152, 219, 0.18);
    color: #2980b9;
    border-color: rgba(52, 152, 219, 0.4);
    text-decoration: none;
}

.learn-nav-label {
    width: auto;
    padding: 0 16px;
    border-radius: 24px;
}

.learn-head {
    max-width: 100%;
    margin: 18px auto;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    text-align: center;
}

.learn-head-title {
    font-size: 20px;
    font-weight: 700;
}

.learn-head-theme {
    font-size: 15px;
    opacity: 0.92;
    margin-top: 4px;
}

.learn-head-meta {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.18);
    padding: 3px 12px;
    border-radius: 20px;
    margin-top: 10px;
}

.learn-head-teacher {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.88;
}

.chat-msg code {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: ui-monospace, Consolas, Menlo, monospace;
}

.learn-pause {
    max-width: 720px;
    margin: 18px auto 0;
    background: #fffbe6;
    border: 1px solid #f0e2a0;
    border-left: 4px solid #f0b429;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.learn-pause-title {
    font-weight: 700;
    font-size: 15px;
    color: #8a6d00;
    margin-bottom: 4px;
}

.learn-pause-text {
    font-size: 14px;
    line-height: 1.5;
    color: #6b5b1a;
}

.learn-warn {
    max-width: 720px;
    margin: 12px auto 0;
    background: #fff3e0;
    border: 1px solid #f5c877;
    border-left: 4px solid #f0a020;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: #7a4e00;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.learn-chat {
    max-width: 720px;
    margin: 18px auto 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    padding: 12px 16px;
    border-radius: 10px;
    max-width: 78%;
    line-height: 1.5;
}

.chat-msg.ai {
    background: #fff;
    border: 1px solid #e3eaf0;
    border-left: 4px solid #3498db;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-msg.user {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: #fff;
    border: none;
    align-self: flex-end;
    box-shadow: 0 1px 3px rgba(22, 160, 133, 0.35);
}

.learn-form {
    max-width: 720px;
    margin: 18px auto 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.learn-form textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
}

.learn-send {
    position: relative;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.learn-send .btn {
    min-width: 200px;
}

.learn-send .loading {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 40px;
    line-height: 40px;
    margin-top: 0;
    text-align: center;
    font-weight: 600;
    color: #888;
}

.learn-actions, .learn-back {
    text-align: center;
}

.learn-actions {
    max-width: 720px;
    margin: 14px auto 0;
}

/* Номер гостя */
.guest-num {
    background: #eaf2f8;
    border: 1px solid #d4e6f1;
    color: #2c3e50;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.guest-num b {
    color: #3498db;
}

/* Главная: блоки ролей */
.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 860px;
    margin: 12px auto 0;
}

a.role-block {
    display: block;
    text-decoration: none;
    color: #333;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 30px 28px;
    border-top: 5px solid #3498db;
    transition: box-shadow .12s, transform .12s;
}

a.role-block:hover {
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

a.role-block:nth-child(1) { border-top-color: #3498db; }
a.role-block:nth-child(2) { border-top-color: #e67e22; }
a.role-block:nth-child(3) { border-top-color: #27ae60; }
a.role-block:nth-child(4) { border-top-color: #8e44ad; }

.role-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.role-title {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.role-desc {
    font-size: 14px;
    line-height: 1.5;
    color: #7f8c8d;
}

/* Загрузка */
.loading {
    margin-top: 14px;
    font-size: 14px;
    color: #95a5a6;
}

/* Адаптивность */
@media (max-width: 700px) {
    .role-grid {
        grid-template-columns: 1fr;
    }
    .header { padding: 0 12px; }
    .header-inner { flex-wrap: wrap; gap: 0; }
    .nav { order: 3; width: 100%; flex-wrap: wrap; }
}
/* ---------- Эксплорер (каталог тем, как товары в torg) ---------- */
.explorer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.explorer-path {
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.explorer-path a {
    color: #3498db;
}

.explorer-sep {
    color: #ddd;
    margin: 0 4px;
}

.explorer-root {
    font-weight: 600;
    color: #2c3e50 !important;
}

.explorer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Фильтр удалённых в эксплорере тем */
.explorer-filter {
    display: flex;
    gap: 4px;
    background: #eef1f4;
    border-radius: 8px;
    padding: 3px;
}

/* Заголовок списка: название таблицы слева, фильтр — справа на том же уровне. */
.explorer-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.explorer-section-head h3 {
    margin-bottom: 0;
}

.explorer-section-head-end {
    justify-content: flex-end;
}

.explorer-filter-link {
    font-size: 13px;
    color: #7f8c8d;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 6px;
}

.explorer-filter-link:hover {
    color: #2c3e50;
}

.explorer-filter-link.active {
    background: #fff;
    color: #2c3e50;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Вкладки режима просмотра проверки: оценка ИИ | диалог */
.result-tabs {
    display: flex;
    gap: 4px;
    background: #eef1f4;
    border-radius: 8px;
    padding: 3px;
    margin: 16px 0 14px;
    width: fit-content;
}

.result-tab {
    font-size: 13.5px;
    color: #7f8c8d;
    text-decoration: none;
    padding: 6px 18px;
    border-radius: 6px;
}

.result-tab:hover {
    color: #2c3e50;
}

.result-tab.active {
    background: #fff;
    color: #2c3e50;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

.explorer-up {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.explorer-up a {
    color: #7f8c8d;
    font-size: 13px;
    text-decoration: none;
}

.explorer-up a:hover {
    color: #3498db;
}

.explorer-section {
    margin-bottom: 20px;
}

.explorer-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.explorer-icon {
    font-size: 16px;
    opacity: 0.6;
}

.empty {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.explorer-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

/* Переключатель гостевого доступа */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.switch input {
    display: none;
}

.switch .track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d5dbe0;
    transition: background 0.15s;
}

.switch .thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s;
}

.switch input:checked + .track {
    background: #16a085;
}

.switch input:checked ~ .thumb {
    transform: translateX(14px);
}

/* Бейджи */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.7;
}

.badge-material {
    background: #e8f8f5;
    color: #16a085;
}

.badge-none {
    background: #f1f3f5;
    color: #95a5a6;
}

.badge-deleted {
    background: #fdecea;
    color: #c0392b;
}

.row-deleted {
    opacity: .55;
}

.icon-btn-restore {
    color: #16a085;
}
.icon-btn-restore:hover {
    background: #e8f8f5;
}

/* Список допматериалов в форме темы */
.material-list {
    margin-bottom: 8px;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    overflow: hidden;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #fafbfc;
    border-bottom: 1px solid #eef0f2;
}

.material-item:last-child {
    border-bottom: none;
}

.material-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.material-item-clickable {
    cursor: pointer;
}

.material-item-clickable:hover {
    background: #f2f6f9;
}

.material-caret {
    color: #95a5a6;
    font-size: 11px;
    transition: transform 0.15s;
}

.material-caret.open {
    transform: rotate(180deg);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 1100px;
    width: 96%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

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

.modal-header b {
    font-size: 15px;
}

#material-modal-content {
    width: 100%;
    max-width: none;
    min-height: 400px;
    height: 60vh;
    flex: 1;
    resize: vertical;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid #d5dbe0;
    border-radius: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px;
}

.material-item .material-item-check {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

.material-actions {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0;
}

.material-limit {
    margin: 8px 0 4px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f2f7fa;
    border: 1px solid #dbe8f0;
    color: #4a6573;
    font-size: 12.5px;
    line-height: 1.5;
}

.material-limit-warn {
    background: #fdf3e3;
    border-color: #f2d9b3;
    color: #7a5a1e;
}

.btn-soft-delete {
    background: #fdf2f2;
    color: #e74c3c;
    border: 1px solid #f2c8c8;
    box-shadow: none;
}

.btn-soft-delete:hover {
    background: #fbeaea;
    filter: none;
}

.material-item .icon-btn-square {
    width: 26px;
    height: 26px;
}

/* Загрузка файлов (как «добавить фото» в товарах) */
.upload-form {
    position: relative;
    margin: 10px 0;
}

.upload-form input[type=file] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
}

.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.upload-form:hover .upload-label {
    border-color: #2563eb;
    color: #2563eb;
    background: #eef2ff;
}

/* ---------- Формулы ---------- */
/* Пока KaTeX не отрисовал формулу (скрипт не загрузился), показываем её
   как математику, а не как текст с долларами. */
.math {
    font-family: "Cambria Math", "Times New Roman", Georgia, serif;
    font-style: italic;
    white-space: nowrap;
}
.math-raw {
    font-style: normal;
    white-space: normal;
    color: #334155;
}
.katex { font-size: 1.02em; }
.chat-msg .katex-display { margin: .3em 0; }

.form-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
}

.form-row label {
    min-width: 170px;
    margin: 0;
    flex-shrink: 0;
}

.form-row select {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 420px;
    height: 38px;
}

.form-row .form-hint {
    color: #7f8c8d;
    margin-left: 4px;
    white-space: nowrap;
}


.icon-btn-square:hover { text-decoration: none; }
