/* ShrederR — стили страниц авторизации */

:root {
    --bg: #0b2839;
    --bg-soft: #10475e;
    --card: #10475e;
    --border: #3d717e;
    --text: #ffffff;
    --muted: #a9c7d1;
    --primary: #3d717e;
    --primary-hover: #4e8b98;
    --error: #ff6b6b;
    --success: #35c07f;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(1000px 600px at 50% -10%, #10475e 0%, var(--bg) 55%);
    color: var(--text);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* Шапка */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: rgba(16, 71, 94, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.topbar-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.whoami {
    color: var(--muted);
    font-size: 14px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* Карточки */
.content {
    margin-top: 26px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.card + .card {
    margin-top: 20px;
}

.subtitle {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
}

h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

h2 {
    margin: 0 0 14px;
    font-size: 19px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.center {
    text-align: center;
}

a {
    color: #9ecbd6;
}

/* Формы */
.form {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.field {
    display: grid;
    gap: 6px;
}

.field > span {
    font-size: 14px;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 113, 126, 0.45);
}

.hint {
    color: var(--muted);
    font-size: 12px;
}

.field-error {
    color: var(--error);
    font-size: 13px;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--primary);
}

.btn-block {
    width: 100%;
}

/* Уведомления */
.alerts {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    font-size: 14px;
}

.alert-error {
    border-color: rgba(255, 107, 107, 0.5);
    color: #ffd0d0;
    background: rgba(255, 107, 107, 0.12);
}

.alert-success {
    border-color: rgba(53, 192, 127, 0.5);
    color: #cdf3e2;
    background: rgba(53, 192, 127, 0.12);
}

.alert-info {
    border-color: rgba(61, 113, 126, 0.6);
    color: #dcecf0;
    background: rgba(61, 113, 126, 0.18);
}

/* Таблица фактов */
.facts {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 8px 16px;
    margin: 20px 0 22px;
    padding: 0;
}

.facts dt {
    color: var(--muted);
    font-size: 14px;
}

.facts dd {
    margin: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* Подвал */
.footer {
    margin-top: 28px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 560px) {
    .facts {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .facts dd {
        margin-bottom: 10px;
    }

    .card {
        padding: 20px;
    }
}

/* ---- Расписание: полноэкранный расклад (без прокрутки) ---- */
/* Прокрутку отключаем только на странице расписания (body.page-schedule),
   иначе кабинет, вход и другие страницы нельзя пролистать. */
body.page-schedule {
    height: 100vh;
    overflow: hidden;
}

.shell-wide {
    width: 100%;
    max-width: none;
    height: 100vh;
    padding: clamp(8px, 1.2vh, 22px) clamp(12px, 1.6vw, 40px);
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1vh, 16px);
    overflow: hidden;
}

/* ---- Расписание: верхняя строка ---- */
.schedule-topbar {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(8px, 1vw, 16px);
    padding: clamp(8px, 1.2vh, 16px) clamp(12px, 1.4vw, 22px);
}

.sched-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 16px);
    justify-self: end;
}

.schedule-title {
    margin: 0;
    justify-self: start;
    font-size: clamp(16px, 2.2vh, 34px);
    white-space: nowrap;
}

.schedule-weekday {
    justify-self: center;
    text-align: center;
    padding: clamp(2px, 0.5vh, 8px) clamp(12px, 1.4vw, 30px);
    color: #fff;
    font-size: clamp(16px, 2.4vh, 36px);
    font-weight: 700;
    white-space: nowrap;
    background: var(--primary);
    border-radius: 999px;
}

.schedule-date {
    color: var(--muted);
    font-size: clamp(12px, 1.8vh, 26px);
    white-space: nowrap;
}

.schedule-auth {
    display: grid;
    place-items: center;
    width: clamp(30px, 4.2vh, 54px);
    height: clamp(30px, 4.2vh, 54px);
    flex: 0 0 auto;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: var(--bg-soft);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.schedule-auth svg {
    width: 60%;
    height: 60%;
}

.schedule-auth:hover {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
}

/* ---- Расписание: таблицы (строки = уроки, столбцы = классы) ---- */
.page-schedule .content {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1vh, 16px);
}

.sched-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.sched-card + .sched-card {
    margin-top: 0;
}

.sched-empty {
    margin: auto;
    color: var(--muted);
}

.sched-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.sched-table {
    width: 100%;
    height: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: clamp(9px, 1.5vh, 20px);
}

.sched-table th,
.sched-table td {
    padding: clamp(2px, 0.5vh, 8px) clamp(3px, 0.5vw, 10px);
    border: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.sched-table thead th {
    background: var(--bg);
    font-weight: 600;
}

.sched-table th.sched-lesson {
    text-align: left;
    white-space: nowrap;
}

.sched-lesson-inner {
    display: inline-block;
    padding-left: 15%;
}

.sched-lesson .th-num {
    font-weight: 700;
}

.sched-lesson .th-time {
    margin-left: 6px;
    color: var(--muted);
    font-size: 0.82em;
    font-weight: 400;
}

.sched-corner,
.sched-class {
    background: var(--card);
}

.sched-table thead .sched-corner,
.sched-table thead .sched-class {
    background: var(--bg);
}

.sched-class {
    color: var(--primary-hover);
    font-size: 1.5em;
    font-weight: 700;
}

.sched-table td.is-empty {
    color: var(--muted);
}

/* Объединённая ячейка «выходной» — на месте уроков, по центру */
.sched-dayoff {
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* Объединённая ячейка «Ошибка загрузки расписания.» — когда БД недоступна */
.sched-db-error {
    color: var(--error);
    text-align: center;
    vertical-align: middle;
}

/* ---- Расписание: навигация по неделям ---- */
.weekbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 1vw, 16px);
    flex-wrap: nowrap;
    margin-top: 0;
    padding: clamp(6px, 1vh, 14px) clamp(10px, 1.2vw, 18px);
    background: rgba(16, 71, 94, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.week-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: clamp(11px, 1.6vh, 22px);
    white-space: nowrap;
}

.week-nav:hover {
    color: #fff;
}

.week-arrow {
    color: var(--primary);
    font-size: 1.2em;
    line-height: 1;
}

.week-nav-text {
    display: inline-block;
    text-align: center;
    line-height: 1.15;
}

.week-days {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: clamp(4px, 0.6vw, 10px);
    flex: 1 1 auto;
    min-width: 0;
}

.week-day {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
    padding: clamp(4px, 0.8vh, 10px) 6px;
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: clamp(11px, 1.6vh, 22px);
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.week-day:hover {
    border-color: var(--primary);
}

.week-day .wd-name {
    color: var(--muted);
    font-weight: 700;
}

.week-day .wd-date {
    font-size: 1.05em;
    font-weight: 700;
    white-space: nowrap;
}

.week-day.is-active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.week-day.is-active .wd-name,
.week-day.is-active .wd-date {
    color: #fff;
}

/* ---- Справочники, журнал и редактор расписания ---- */
select,
textarea,
input[type="date"] {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

select:focus,
textarea:focus,
input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 113, 126, 0.45);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 14px;
}

.form-row .field {
    flex: 1 1 200px;
}

.form-row .field-btn {
    flex: 0 0 auto;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 14px;
}

.btn-danger {
    border-color: rgba(255, 107, 107, 0.6);
    color: #ffd0d0;
}

.btn-danger:hover {
    border-color: var(--error);
    background: rgba(255, 107, 107, 0.12);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.tab {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tab:hover {
    border-color: var(--primary);
    color: var(--text);
}

.tab.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.fieldset {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 0;
}

.fieldset legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 14px;
}

.grade-group {
    margin-top: 10px;
}

.grade-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px 14px;
    margin-top: 8px;
}

.checkbox-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    color: var(--muted);
    font-weight: 600;
    background: var(--bg-soft);
}

.data-table tr.is-changed td {
    background: rgba(61, 113, 126, 0.18);
}

.data-table tr.is-cancelled td {
    background: rgba(255, 107, 107, 0.1);
}

.nowrap {
    white-space: nowrap;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.tag-cancel {
    background: rgba(255, 107, 107, 0.18);
    color: #ffd0d0;
    border: 1px solid rgba(255, 107, 107, 0.45);
}

.editor-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px;
    min-width: 540px;
}

.editor-field {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    min-width: 132px;
}

.editor-field select,
.editor-field input {
    padding: 7px 9px;
    font-size: 14px;
}

.editor-cancel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.editor-actions {
    display: inline-flex;
    gap: 6px;
}

.editor-table td:last-child {
    min-width: 560px;
}

@media (max-width: 720px) {
    .editor-form {
        min-width: 0;
    }

    .editor-table td:last-child {
        min-width: 0;
    }
}

/* ---- Profile head and password modal ---- */
.profile-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.profile-head h1 {
    margin: 0;
}

/* Кнопки под данными профиля: «На главную» и «Править неделя» рядом */
.profile-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 16, 24, 0.72);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.modal-head h2 {
    margin: 0;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

body.modal-open {
    overflow: hidden;
}

/* ---- Редактор расписания ---- */
.page-schedule-edit .shell-wide {
    height: auto;
    min-height: 100vh;
    overflow: hidden;
}

.page-schedule-edit .content {
    display: block;
    margin-top: 12px;
}

.page-schedule-edit .sched-card {
    flex: 0 0 auto;
    min-height: 0;
}

/* прокрутка карточек таблиц настраивается в конце файла */

.sched-left {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start;
    min-width: 0;
}

.schedule-edit-link {
    padding: 6px 12px;
    font-size: clamp(11px, 1.6vh, 18px);
    white-space: nowrap;
}

.date-form {
    margin: 0;
}

.date-form input[type="date"] {
    width: auto;
    padding: 4px 8px;
    font-size: clamp(11px, 1.6vh, 18px);
}

.sched-class-name {
    display: inline-block;
}

.class-edit {
    margin-left: 6px;
    padding: 0;
    width: 1.1em;
    height: 1.1em;
    border: none;
    background: transparent;
    color: var(--primary-hover);
    cursor: pointer;
    vertical-align: middle;
}

.class-edit svg {
    width: 100%;
    height: 100%;
}

.class-edit:hover {
    color: #fff;
}

.sched-table-edit td.cell {
    padding: 3px;
}

.cell-select {
    width: 100%;
    padding: 2px 4px;
    font-size: 0.85em;
    border-radius: 6px;
}

.cell-rooms {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 3px;
}

.room-input {
    width: 3.4em;
    padding: 2px 4px;
    font-size: 0.85em;
    text-align: center;
    border-radius: 6px;
}

.room-input.is-hidden {
    display: none;
}

.room-plus {
    width: 1.5em;
    height: 1.5em;
    padding: 0;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.room-plus:hover {
    border-color: var(--primary);
}
/* ---- редактор расписания: ячейки в один ряд ---- */
.page-schedule-edit .sched-table-edit {
    table-layout: auto;
}

.page-schedule-edit .sched-table-edit td.cell {
    white-space: nowrap;
}

.page-schedule-edit .sched-table-edit .cell-select {
    display: inline-block;
    width: 8.5em;
    vertical-align: middle;
    padding: 2px 4px;
    font-size: 0.8em;
}

.page-schedule-edit .sched-table-edit .cell-rooms {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 0;
    vertical-align: middle;
}

.page-schedule-edit .sched-table-edit .room-plus {
    width: 1.5em;
    height: 1.5em;
    font-size: 0.8em;
}

/* ---- редактор расписания: крупнее шрифт предметов ---- */
.page-schedule-edit .sched-table-edit .cell-select {
    font-size: 1.15em;
}

/* ---- редактор расписания: прокрутка задаётся ниже, одним правилом ---- */

/* ---- редактор расписания: ячейки в один ряд, таблицы по содержимому ---- */
/*.page-schedule-edit .sched-table-edit {
    table-layout: auto;
    width: 100%;
    height: auto;
}

.page-schedule-edit .sched-table-edit td.cell,
.page-schedule-edit .sched-table-edit th {
    overflow: visible;
    white-space: nowrap;
}

.page-schedule-edit .sched-table-edit td.cell {
    text-align: left;
    padding: 3px 4px;
}
*/

/* ---- редактор расписания: таблица фиксированной ширины ---- */
.page-schedule-edit .sched-table-edit {
    /* Заставляем таблицу растягиваться по содержимому, но с фиксированной раскладкой */
    width: max-content; 
    min-width: 100%;
    max-width: none;
    table-layout: fixed; /* Главное изменение: все столбцы будут одинаковыми */
}

/* Задаем жесткую ширину первому столбцу (с временем) */
.page-schedule-edit .sched-table-edit th.sched-corner,
.page-schedule-edit .sched-table-edit th.sched-lesson {
    width: 7em;      /* Ширина первого столбца */
    min-width: 7em;
    max-width: 7em;
    white-space: nowrap;
}

/* Задаем жесткую ширину всем остальным столбцам (классам) */
.page-schedule-edit .sched-table-edit th.sched-class,
.page-schedule-edit .sched-table-edit td.cell {
    width: 15em;     /* Ширина столбца класса (подберите под ваш интерфейс) */
    min-width: 13em;
    max-width: 17em;
}
/*-конец втавки--*/
.page-schedule-edit .cell-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-schedule-edit .sched-table-edit .cell-select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    text-align: left;
    font-size: 1.15em;
    padding: 2px 4px;
}

.page-schedule-edit .sched-table-edit .cell-rooms {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 0;
    flex: 0 0 auto;
}

.page-schedule-edit .sched-table-edit .room-plus {
    flex: 0 0 auto;
}

/* ---- редактор расписания: просторнее ---- */
.page-schedule-edit .shell-wide {
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.page-schedule-edit .sched-table-edit th,
.page-schedule-edit .sched-table-edit td.cell {
    padding: 7px 6px;
}

/* ---- редактор расписания: размеры поля кабинета задаются ниже, одним правилом ---- */

.page-schedule-edit .sched-table-edit .room-plus {
    width: 1.6em;
    height: 1.6em;
    font-size: 1em;
}

.page-schedule-edit .sched-table-edit .cell-select {
    font-size: 1.15em;
    min-width: 6em;
}

/* ---- редактор расписания: прокрутка — у каждой карточки с таблицей (см. ниже) ---- */
.page-schedule-edit .sched-card {
    overflow: hidden; /* Возвращаем обрезку для скругления углов */
    border-radius: var(--radius); 
}

.page-schedule-edit .sched-card {
    min-width: 0;
    flex: 0 0 auto;
}

/* ---- редактор расписания: шапка и панель недель — по ширине экрана и неподвижны ---- */
.page-schedule-edit .schedule-topbar,
.page-schedule-edit .weekbar {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    position: sticky;
    left: 0;
}

/* ---- редактор расписания: общий горизонтальный скролл на все 3 таблицы ---- */
.page-schedule-edit .sched-form {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
}

.page-schedule-edit .sched-card-edit .sched-scroll {
    overflow: visible;
    max-width: 100%;
}

/* ---- редактор расписания: липкая полоса прокрутки внизу экрана ---- */
.sched-hscroll {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    height: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(11, 40, 57, 0.94);
    border-top: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-hover) rgba(11, 40, 57, 0.9);
}

.sched-hscroll-track {
    height: 1px;
}

.sched-hscroll::-webkit-scrollbar {
    height: 12px;
    -webkit-appearance: none;
}

.sched-hscroll::-webkit-scrollbar-track {
    background: rgba(11, 40, 57, 0.9);
}

.sched-hscroll::-webkit-scrollbar-thumb {
    background: var(--primary-hover);
    border-radius: 6px;
}

.sched-hscroll::-webkit-scrollbar-thumb:hover {
    background: #6fb3c2;
}

/* чтобы полоса не накрывала содержимое внизу страницы */
body.page-schedule-edit {
    padding-bottom: 20px;
}

.page-schedule-edit .sched-card,
.page-schedule-edit .sched-card-edit {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: 0 0 auto;
    min-height: 0;
}

body.page-schedule-edit {
    overflow-x: hidden;
}

/* ---- редактор расписания: отдельная подложка у каждой из 3 таблиц ---- */
.page-schedule-edit .sched-card + .sched-card {
    margin-top: clamp(8px, 1.2vh, 16px);
}

/* ---- редактор расписания: поле кабинета шириной 5em (влезает любой номер) ---- */
.page-schedule-edit .sched-table-edit .cell-rooms .room-input,
.page-schedule-edit .sched-table-edit .cell-rooms .room-input.room-input-2 {
    width: 4em;
    min-width: 4em;
    max-width: 4em;
    flex: 0 0 4em;
    padding: 2px 3px;
    font-size: 1em;
    text-align: center;
}

/* ---- редактор расписания: первый столбец одной ширины во всех 3 таблицах ---- */
.page-schedule-edit .sched-table-edit th.sched-corner,
.page-schedule-edit .sched-table-edit th.sched-lesson {
    width: 7em;
    min-width: 7em;
    white-space: nowrap;
}

.page-schedule-edit .sched-table-edit .sched-lesson-inner {
    padding-left: 0;
}

/* ---- редактор расписания: фикс подложки и прокрутки ---- */

/* 1. Запрещаем странице скроллиться по горизонтали (убираем нижнюю системную полосу) */
body.page-schedule-edit {
    overflow-x: hidden;
    overflow-y: auto; /* Вертикальная прокрутка остается */
}

.page-schedule-edit .shell-wide,
.page-schedule-edit .content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden; /* Скрываем всё, что вылезает за экран */
}

/* 2. Форма становится жестким контейнером, внутри которого скроллятся таблицы */
.page-schedule-edit .sched-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    overflow-x: auto; /* Скролл включается здесь */
    overflow-y: hidden;
    /* Скрываем системный скроллбар у формы, так как у нас есть свой красивый (.sched-hscroll) */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.page-schedule-edit .sched-form::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* 3. Карточка (подложка) тянется по ширине таблицы */
.page-schedule-edit .sched-card {
    display: inline-block; /* Тянется за содержимым */
    vertical-align: top;
    width: auto;
    min-width: 100%;       /* Если таблица узкая — карточка на весь экран */
    max-width: none;
    overflow: hidden;      /* Обрезаем углы */
    border-radius: var(--radius); 
    margin-bottom: 0;
}

.page-schedule-edit .sched-card + .sched-card {
    margin-top: clamp(8px, 1.2vh, 16px);
}

/* 4. Внутренний контейнер таблицы */
.page-schedule-edit .sched-card-edit .sched-scroll {
    width: 100%;
    min-width: max-content; /* Тянется по содержимому таблицы */
    overflow: visible;      /* Скролл уже на форме, здесь не нужен */
}

.page-schedule-edit .sched-table-edit {
    width: max-content;
    min-width: 100%;
    max-width: none;
    table-layout: auto;
}

/* 5. Фиксируем липкую полосу прокрутки внизу */
.sched-hscroll {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    height: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(11, 40, 57, 0.94);
    border-top: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-hover) rgba(11, 40, 57, 0.9);
}

.sched-hscroll-track {
    height: 1px;
}

.sched-hscroll::-webkit-scrollbar {
    height: 12px;
    -webkit-appearance: none;
}

.sched-hscroll::-webkit-scrollbar-track {
    background: rgba(11, 40, 57, 0.9);
}

.sched-hscroll::-webkit-scrollbar-thumb {
    background: var(--primary-hover);
    border-radius: 6px;
}

.sched-hscroll::-webkit-scrollbar-thumb:hover {
    background: #6fb3c2;
}

.page-schedule-edit .weekbar {
    margin-top: clamp(8px, 1.2vh, 16px);
}
/* ---- редактор расписания: настройка ячеек с классами ---- */

/* Уменьшаем отступы внутри ячеек (только для ячеек с селектами) */
.page-schedule-edit .sched-table-edit td.cell {
    padding: 4px 3px; /* Было 7px 6px, делаем более компактно */
}

/* Увеличиваем шрифт в селектах предметов */
.page-schedule-edit .sched-table-edit .cell-select {
    font-size: 1.3em; /* Увеличиваем размер шрифта (подберите нужный, например 16px) */
    padding: 4px 6px; /* Чуть увеличиваем внутренний отступ самого селекта для красоты */
}

/* Увеличиваем шрифт в инпутах кабинетов */
.page-schedule-edit .sched-table-edit .cell-rooms .room-input {
    font-size: 1.1em; /* Чуть крупнее для читаемости */
    height: 2em;      /* Выравниваем высоту по селекту */
}

/* Увеличиваем шрифт в заголовках столбцов (названия классов) */
.page-schedule-edit .sched-table-edit th.sched-class {
    font-size: 1.5em; /* Было 1.5em, можно сделать еще крупнее, если нужно */
    padding: 6px 4px;
}
/* ---- Главная страница расписания: первый столбец в одну линию ---- */

/* 1. Фиксируем ширину столбца (возможно, придется немного увеличить, чтобы все влезло в строку) */
.page-schedule .sched-table th.sched-corner,
.page-schedule .sched-table th.sched-lesson {
    width: 8em;       /* Увеличили с 8em, чтобы номер и время точно поместились в одну строку */
    min-width: 8em;
    max-width: 8em;
}

/* 2. Делаем контейнер строчным, чтобы элементы шли друг за другом */
.page-schedule .sched-table .sched-lesson-inner {
    display: inline-block;
    padding-left: 5px;   /* Убираем левый отступ, чтобы текст не смещался */
    white-space: nowrap; /* Запрещаем перенос строк */
}

/* 3. Выравниваем номер и время по базовой линии и задаем отступ между ними */
.page-schedule .sched-table .sched-lesson .th-num {
    margin-right: 0;
}

.page-schedule .sched-table .sched-lesson .th-time {
    margin-left: 5px;    /* Убираем margin-left, если он мешает */

/* ---- Недельный редактор расписания (ShedEdit_week.php) ---- */

/* Форма — единый горизонтальный скроллер для всех шести таблиц.
   Нативный скроллбар скрыт: снизу страницы есть своя полоса (.sched-hscroll). */
.page-schedule-week .sched-form-week {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
}

.page-schedule-week .sched-form-week::-webkit-scrollbar {
    display: none;              /* Chrome/Safari */
}

/* Вертикальный поток: шесть карточек-дней одна под другой.
   Ширина по содержимому — чтобы прокручивалась самая широкая таблица. */
.page-schedule-week .sched-week {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.4vh, 20px);
    width: max-content;
    min-width: 100%;
    max-width: none;
}

/* Карточка дня: заголовок + таблица */
.page-schedule-week .sched-week-day {
    display: block;
    width: max-content;
    min-width: 100%;
    padding: 0;
    overflow: hidden;
}

.page-schedule-week .sched-week-day-title {
    margin: 0;
    padding: 8px 14px;
    font-size: clamp(14px, 1.9vh, 22px);
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Внутренний контейнер таблицы: скролл уже на форме, здесь не нужен */
.page-schedule-week .sched-week-day .sched-scroll {
    width: auto;
    min-width: max-content;
    max-width: none;
    overflow: visible;
}

/* Таблица дня растягивается по содержимому */
.page-schedule-week .sched-week-day .sched-table-edit {
    width: max-content;
    min-width: 100%;
    max-width: none;
}

/* Первый столбец дня: номер урока и время в один ряд */
.page-schedule-week .sched-week-day .sched-lesson-inner {
    padding-left: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

/* Дропдаун выбора недели в шапке */
.week-select-form {
    margin: 0;
}

.week-select {
    max-width: min(70vw, 460px);
    padding: clamp(4px, 0.6vh, 10px) clamp(8px, 1vw, 16px);
    color: #fff;
    font-size: clamp(12px, 1.7vh, 20px);
    font-weight: 600;
    background: var(--primary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

/* Внутри «пилюли» дропдаун прозрачный — фон даёт сама пилюля */
.week-select-pill .week-select {
    background: transparent;
    border-radius: 0;
}

.week-select option {
    color: var(--text);
    background: var(--card);
    font-weight: 400;
}

/* Стрелки переключения недель вокруг дропдауна (стрелки — вне «пилюли») */
.week-switch {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 0.8vw, 14px);
    justify-self: center;
}

/* В недельном режиме у центральной ячейки шапки нет «пилюли» —
   фон переносится на внутренний блок с дропдауном (.week-select-pill). */
.page-schedule-week .schedule-weekday {
    background: transparent;
    padding: 0;
}

/* «Пилюля» с фоном — только вокруг дропдауна, без стрелок */
.week-select-pill {
    display: inline-flex;
    align-items: center;
    padding: clamp(2px, 0.5vh, 8px) clamp(12px, 1.4vw, 30px);
    background: var(--primary);
    border-radius: 999px;
}

.week-switch-btn {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: clamp(30px, 4.2vh, 46px);
    height: clamp(30px, 4.2vh, 46px);
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.week-switch-btn svg {
    width: 55%;
    height: 55%;
}

.week-switch-btn:hover {
    background: var(--primary-hover);
}

.week-switch-btn.is-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* Модалка копирования */
.copy-modal-info {
    margin: 0 0 12px;
    font-size: clamp(13px, 1.7vh, 18px);
}

.copy-range {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.copy-range .field {
    flex: 1 1 180px;
}

.copy-note {
    margin: 10px 0 0;
    font-size: 0.92em;
}

}