/* Страница «Расписание»: общие стили для всех тем и макетов */
.sch-wrap {
    --sch-line: rgba(var(--cms-primary-rgb, 20, 60, 120), .14);
    --sch-soft: var(--light-bg-color, #f4f6fa);
    --sch-text: var(--text-color, #4b5563);
    --sch-title: var(--title-color, #1f2937);
    --sch-brand: var(--primary-color, #1f4e8c);
    --sch-replace: #b45309;
    --sch-replace-bg: #fff4e0;
    --sch-cancel: #b91c1c;
    --sch-cancel-bg: #fdecec;
    --sch-today-bg: rgba(var(--cms-primary-rgb, 20, 60, 120), .06);
    --sch-radius: var(--cms-radius, 8px);
    color: var(--sch-text);
    font-family: var(--cms-body-font, inherit);
}

.sch-wrap .container { max-width: 1320px; }

.sch-note {
    margin: 0 0 24px;
    padding: 14px 18px;
    border-left: 4px solid var(--sch-brand);
    background: var(--sch-soft);
    border-radius: var(--sch-radius);
    font-size: 15px;
    line-height: 1.6;
}

/* ---- Вкладки ---- */
.sch-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 22px;
    border-bottom: 1px solid var(--sch-line);
}

.sch-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--sch-text);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: color .2s, border-color .2s;
}

.sch-tab:hover { color: var(--sch-brand); }
.sch-tab.is-active { color: var(--sch-brand); border-bottom-color: var(--sch-brand); }
.sch-tab i { font-size: 14px; opacity: .8; }

/* ---- Панель выбора ---- */
.sch-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 28px;
    margin: 0 0 28px;
    padding: 18px 20px;
    background: var(--sch-soft);
    border-radius: var(--sch-radius);
}

.sch-field { display: flex; flex-direction: column; gap: 6px; min-width: 260px; flex: 1 1 260px; max-width: 420px; margin: 0; }
.sch-field-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sch-text); opacity: .75; }

.sch-select {
    width: 100%;
    height: 46px;
    padding: 0 40px 0 14px;
    border: 1px solid var(--sch-line);
    border-radius: calc(var(--sch-radius) * .75);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: var(--sch-title);
    font: inherit;
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.sch-select:focus { outline: none; border-color: var(--sch-brand); box-shadow: 0 0 0 3px rgba(var(--cms-primary-rgb, 20, 60, 120), .15); }
.sch-select:disabled { opacity: .6; cursor: default; }

.sch-btn {
    height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: calc(var(--sch-radius) * .75);
    background: var(--sch-brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.sch-week { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.sch-week-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--sch-line);
    border-radius: calc(var(--sch-radius) * .75);
    background: #fff;
    color: var(--sch-title);
    font-size: 22px;
    text-decoration: none;
    transition: background .2s, color .2s, border-color .2s;
}

.sch-week-btn:hover { background: var(--sch-brand); border-color: var(--sch-brand); color: #fff; }

.sch-week-label {
    min-width: 190px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--sch-title);
    font-family: var(--cms-heading-font, inherit);
}

.sch-week-today {
    margin-left: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--sch-line);
    color: var(--sch-brand);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.sch-week-today:hover { border-color: var(--sch-brand); }

/* ---- Сообщения ---- */
.sch-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0 0 24px;
    padding: 14px 18px;
    border-radius: var(--sch-radius);
    background: var(--sch-soft);
    font-size: 15px;
}

.sch-message i { margin-top: 3px; }
.sch-message.is-error { background: var(--sch-cancel-bg); color: var(--sch-cancel); }

.sch-empty {
    padding: 56px 20px;
    text-align: center;
    border: 1px dashed var(--sch-line);
    border-radius: var(--sch-radius);
}

.sch-empty i { font-size: 40px; color: var(--sch-brand); opacity: .55; display: block; margin-bottom: 14px; }
.sch-empty p { margin: 0 auto; max-width: 520px; font-size: 16px; line-height: 1.6; }

/* ---- Заголовок группы ---- */
.sch-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 22px; margin: 0 0 18px; }

.sch-group-name {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--sch-title);
    font-family: var(--cms-heading-font, inherit);
}

.sch-head-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.sch-head-meta i { margin-right: 6px; opacity: .7; }
.sch-head-replaces { color: var(--sch-replace); font-weight: 600; }

/* ---- Таблица ---- */
.sch-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sch-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--sch-line);
    border-radius: var(--sch-radius);
    overflow: hidden;
    background: #fff;
    font-size: 14px;
}

.sch-table th,
.sch-table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--sch-line);
    border-right: 1px solid var(--sch-line);
    vertical-align: top;
    text-align: left;
}

.sch-table th:last-child,
.sch-table td:last-child { border-right: 0; }
.sch-table tbody tr:last-child td,
.sch-table tbody tr:last-child th { border-bottom: 0; }

.sch-table thead th {
    background: var(--sch-soft);
    color: var(--sch-title);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sch-table thead th .sch-day-date { display: block; margin-top: 2px; font-weight: 500; font-size: 12px; text-transform: none; letter-spacing: 0; opacity: .7; }

.sch-table .is-today { background: var(--sch-today-bg); }
.sch-table thead th.is-today { color: var(--sch-brand); box-shadow: inset 0 -3px 0 var(--sch-brand); }
.sch-table td.is-free { background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(0, 0, 0, .025) 10px 11px); }

.sch-col-lesson { width: 84px; min-width: 84px; text-align: center !important; }
.sch-table tbody th.sch-col-lesson { background: var(--sch-soft); font-weight: 600; }

.sch-lesson-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sch-brand);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.sch-lesson-time { display: block; margin-top: 6px; font-size: 12px; line-height: 1.35; color: var(--sch-text); opacity: .85; }

.sch-lesson { padding: 2px 0; }
.sch-lesson + .sch-lesson { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--sch-line); }

.sch-dis { font-weight: 600; color: var(--sch-title); line-height: 1.4; }
.sch-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 13px; color: var(--sch-text); }
.sch-cab { white-space: nowrap; padding: 0 7px; border-radius: 4px; background: rgba(0, 0, 0, .05); font-size: 12.5px; }
.sch-lesson.is-replaced .sch-cab, .sch-lesson.is-cancelled .sch-cab, .sch-day-item.is-replaced .sch-cab, .sch-day-item.is-cancelled .sch-cab, .sch-repl-table .sch-cab { background: rgba(0, 0, 0, .06); }

.sch-dis-old,
.sch-meta-old { text-decoration: line-through; opacity: .55; font-weight: 500; }
.sch-dis-old { margin-top: 6px; font-size: 13px; }

.sch-lesson-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }

.sch-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--sch-soft);
    border: 1px solid var(--sch-line);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--sch-text);
    white-space: nowrap;
}

.sch-tag-week { background: #fff; }
.sch-tag-time { background: #fff; }

.sch-badge {
    display: inline-block;
    margin-bottom: 5px;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.sch-badge-replace { background: var(--sch-replace); color: #fff; }
.sch-badge-cancel { background: var(--sch-cancel); color: #fff; }

.sch-lesson.is-replaced,
.sch-day-item.is-replaced,
.sch-repl-table tr.is-replaced td { background: var(--sch-replace-bg); }

.sch-lesson.is-cancelled,
.sch-day-item.is-cancelled,
.sch-repl-table tr.is-cancelled td { background: var(--sch-cancel-bg); }

.sch-lesson.is-replaced,
.sch-lesson.is-cancelled { margin: -6px -6px; padding: 8px 8px; border-radius: 6px; }
.sch-lesson.is-replaced + .sch-lesson,
.sch-lesson.is-cancelled + .sch-lesson { margin-top: 14px; }

.sch-descr { margin-top: 6px; font-size: 12.5px; font-style: italic; color: var(--sch-text); }
.sch-descr-label { font-style: normal; font-weight: 600; }

/* ---- Легенда ---- */
.sch-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; font-size: 13px; }
.sch-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.sch-legend-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--sch-line); }
.sch-legend-swatch.is-replaced { background: var(--sch-replace-bg); border-color: var(--sch-replace); }
.sch-legend-swatch.is-cancelled { background: var(--sch-cancel-bg); border-color: var(--sch-cancel); }
.sch-legend-swatch.is-today { background: var(--sch-today-bg); border-color: var(--sch-brand); }

/* ---- Мобильный список по дням ---- */
.sch-days { display: none; }

.sch-day-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--sch-line);
    font-size: 18px;
    font-weight: 700;
    color: var(--sch-title);
    font-family: var(--cms-heading-font, inherit);
}

.sch-day-title .sch-day-date { font-size: 14px; font-weight: 500; opacity: .7; }
.sch-day.is-today .sch-day-title { border-bottom-color: var(--sch-brand); color: var(--sch-brand); }
.sch-day + .sch-day { margin-top: 26px; }
.sch-day-free { margin: 0; padding: 14px; text-align: center; font-size: 14px; opacity: .7; border: 1px dashed var(--sch-line); border-radius: var(--sch-radius); }

.sch-day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.sch-day-item {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--sch-line);
    border-radius: var(--sch-radius);
    background: #fff;
}

.sch-day-num { text-align: center; }

/* ---- Замены ---- */
.sch-repl-day + .sch-repl-day { margin-top: 32px; }
.sch-repl-day.is-today .sch-day-title { border-bottom-color: var(--sch-brand); color: var(--sch-brand); }
.sch-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--sch-soft); font-size: 13px; font-weight: 700; }
.sch-repl-table th:nth-child(1) { width: 18%; }
.sch-repl-table th:nth-child(2) { width: 14%; }
.sch-repl-time { display: inline-block; margin-left: 8px; font-size: 13px; white-space: nowrap; }
.sch-group-link { font-weight: 700; color: var(--sch-title); text-decoration: none; }
.sch-group-link:hover { color: var(--sch-brand); text-decoration: underline; }
.sch-repl-table .sch-tag { margin-left: 6px; }

/* ---- Звонки ---- */
.sch-bells { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; }
.sch-bells-table td { font-size: 16px; font-weight: 600; color: var(--sch-title); }
.sch-bells-table th, .sch-bells-table td { text-align: center; }

/* ---- Адаптивность ---- */
@media (max-width: 991px) {
    .sch-desktop { display: none; }
    .sch-days { display: block; }
    .sch-legend { margin-top: 24px; }
    .sch-group-name { font-size: 24px; }
    .sch-toolbar { padding: 14px; gap: 12px 20px; }
    .sch-week-label { min-width: 0; flex: 1; }
}

@media (max-width: 767px) {
    .sch-field { max-width: none; }
    .sch-week { width: 100%; }
    .sch-week-today { margin-left: auto; }
    .sch-tab { padding: 10px 12px; font-size: 14px; }

    .sch-repl-table thead { display: none; }
    .sch-repl-table, .sch-repl-table tbody, .sch-repl-table tr, .sch-repl-table td { display: block; width: 100%; }
    .sch-repl-table tr { border-bottom: 6px solid var(--sch-soft); }
    .sch-repl-table tr:last-child { border-bottom: 0; }
    .sch-repl-table td { border-right: 0; padding: 8px 12px; }
    .sch-repl-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .6; }
    .sch-repl-table td:first-child { padding-top: 12px; }
    .sch-repl-table td:last-child { padding-bottom: 12px; }
}

/* Печать: только таблица */
@media print {
    .sch-toolbar, .sch-tabs, .sch-days, .sch-legend { display: none !important; }
    .sch-table-scroll { display: block !important; }
    .sch-table { font-size: 11px; }
}
