﻿/* =====================================================================
   WSCrm — новый слой интерфейса. Подключается ПОСЛЕ style.css.
   Разделы:
     1. База и типографика      6. Таблицы
     2. Шапка и меню            7. Бейджи, плашки, подсказки
     3. Заголовки, крошки       8. Уведомления (toast)
     4. Формы и кнопки          9. Дашборд
     5. Карточки               10. Страница входа, подвал, мобильная версия
   Общие правила для старых страниц обёрнуты в :where() — у них нулевая
   специфичность, поэтому точечные стили конкретных страниц их перекрывают.
   ===================================================================== */

/* ---------- 1. База ---------- */
html { background: var(--bg); }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
* { font-family: inherit; }
:where(b, strong) { font-weight: 600; }
:where(a) { color: var(--primary); transition: color .15s; }
:where(a:hover) { color: var(--primary-hover); }
.muted { color: var(--text-faint); }
:where(.content) :where(h2, h3) { color: var(--text); font-weight: 600; }
:where(.content) h3 { font-size: 16px; margin: 0 0 12px; }
::selection { background: rgba(29, 159, 98, .22); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- 2. Шапка и меню ---------- */
header {
    background: var(--header-bg);
    padding: 14px 0 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
header .logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--header-text);
    min-height: 32px; /* место под кнопку темы — она появляется после загрузки скрипта */
}
header .menu {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px 4px;
    padding: 10px 20px 0;
}
header .menu a {
    float: none;
    margin: 0;
    padding: 8px 12px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--header-muted);
    border-bottom: 3px solid transparent;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    transition: color .15s, background .15s, border-color .15s;
}
header .menu a:hover {
    color: var(--header-text);
    background: rgba(255, 255, 255, .06);
    border-bottom: 3px solid rgba(255, 255, 255, .25); /* та же толщина, что без наведения — шапка не прыгает */
}
header .menu a.is-active,
header .menu a.is-active:hover {
    color: #fff;
    border-bottom: 3px solid var(--primary-light);
}
header .menu a:last-child { margin: 0 0 0 auto; float: none; }
.lk-menu-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* Переключатель темы */
.theme-toggle {
    margin: 0;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .06);
    color: var(--header-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .14); }


/* Подменю раздела (menu2) */
.menu2 > div { padding: 4px 20px 6px; gap: 6px; }
.menu2 a {
    margin: 0;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all .15s;
}
.menu2 a:hover {
    color: var(--primary);
    border: 1px solid var(--primary);
    background: var(--primary-soft);
}
.menu2 a.is-active {
    color: var(--on-primary);
    background: var(--primary);
    border-color: var(--primary);
}

/* ---------- 3. Заголовки, хлебные крошки ---------- */
.header-name { padding: 22px 0 10px; }
h1 {
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -.01em;
    line-height: 1.25;
}
h1 span, h1 .h1-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-faint);
    margin-left: 8px;
}
.breadcrumbs {
    max-width: var(--content-size);
    margin: 0 auto 6px;
    padding: 0 20px;
    font-size: 13px;
}
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; color: var(--text-faint); }
.breadcrumbs li + li::before { content: "›"; margin: 0 8px; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs [aria-current] { color: var(--text); font-weight: 500; }

/* ---------- 4. Формы и кнопки ---------- */
:where(input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=reset]):not([type=file]):not([type=color]):not([type=range]), select, textarea) {
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    text-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
form input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=file]),
select, textarea {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border-strong);
    text-shadow: none;
}
input:active, input:focus { background-color: var(--surface); }
:where(input, select, textarea):focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: var(--focus-ring);
}
::placeholder { color: var(--text-faint); font-size: 13px; opacity: 1; }
:where(label) { color: var(--text-muted); font-weight: 500; }
:where(input:disabled, select:disabled, textarea:disabled, input[readonly]) { background: var(--surface-2); color: var(--text-muted); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px var(--surface) inset !important;
    box-shadow: 0 0 0 30px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

/* Кнопки */
form input[type="submit"], button {
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    transition: background .15s, box-shadow .15s, transform .05s;
}
:where(form input[type="submit"], button):hover { background: var(--primary-hover); }
:where(form input[type="submit"], button):active { transform: translateY(1px); }
:where(form input[type="submit"], button):disabled { opacity: .55; cursor: not-allowed; }
:where(.btn) { border-radius: var(--radius-sm); font-weight: 600; }
:where(.btn-delete, .btn-danger, button.danger, .delete-btn) { background: var(--danger); color: #fff; }
:where(.btn-delete, .btn-danger, button.danger, .delete-btn):hover { background: var(--danger-hover); color: #fff; }

/* Ошибки проверки полей */
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.field-error {
    display: block;
    width: 100%;
    margin: 4px 0 6px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
}

/* ---------- 5. Карточки ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    margin: 0 0 18px;
    min-width: 0;
}
.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    margin: 0 0 12px;
}
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.card-hint { color: var(--text-faint); font-size: 12px; }
.card-link { margin-left: auto; font-size: 13px; font-weight: 600; }
.card-attention { border-top: 3px solid var(--danger); }
.empty-state {
    padding: 22px 16px;
    text-align: center;
    color: var(--text-faint);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* ---------- 6. Таблицы ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}
.table-wrap.is-tall { max-height: 72vh; overflow-y: auto; border: 1px solid var(--border); }

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table .num, .data-table th.num { text-align: right; white-space: nowrap; }
.data-table a { color: var(--text); font-weight: 500; }
.data-table a:hover { color: var(--primary); }

/* Общие таблицы старых страниц (низкая специфичность) */
:where(.content) :where(table) { border-collapse: collapse; }
:where(.content) :where(table) :where(th) { color: var(--text-muted); }
:where(.content) :where(table:not(.users-filter)) :where(tbody tr:hover > td) { background: var(--surface-2); }

/* Закреплённая шапка у длинных таблиц старых страниц */
table.enh-sticky th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
td.empty-state { border-radius: 0; }

/* Сортировка по клику */
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 22px !important; }
th.sortable:hover { color: var(--text); }
th.sortable::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    border: 4px solid transparent;
    border-top-color: var(--text-faint);
    margin-top: -1px;
    opacity: .5;
}
th.sortable.sort-asc::after { border-top-color: transparent; border-bottom-color: var(--primary); margin-top: -6px; opacity: 1; }
th.sortable.sort-desc::after { border-top-color: var(--primary); opacity: 1; }

/* Постраничный вывод */
.table-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 2px 4px;
    font-size: 13px;
    color: var(--text-muted);
}
.table-pager .pager-pages { display: flex; flex-wrap: wrap; gap: 4px; }
.table-pager button {
    margin: 0;
    min-width: 34px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.table-pager button:hover { background: var(--surface-2); border-color: var(--primary); }
.table-pager button.is-current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.table-pager button.pager-all { color: var(--primary); }
.table-pager .pager-gap { padding: 6px 2px; color: var(--text-faint); }

/* Список студентов: вместо «карточек-строк» — таблица с заголовками */
.students-table .student-name-link { color: var(--text); font-weight: 500; position: relative; }
.students-table .student-name-link:hover { color: var(--primary); }

/* Журнал успеваемости: общий .summary-row { display:flex } (страница ЗП) ломал таблицу —
   строка «Среднее по группе» выпадала из таблицы, а колонка ФИО растягивалась на пол-экрана */
.journal-report tr.summary-row { display: table-row; padding: 0; border: 0; }
.journal-report td.summary-row, .journal-report tr.summary-row > td { display: table-cell; padding: 8px; }
.journal-report table { width: auto; min-width: 100%; }
.journal-report .student-name { min-width: 180px; white-space: nowrap; box-shadow: 1px 0 0 var(--border); }
.journal-report th.student-name { z-index: 11; }
.journal-report tr.summary-row > td { background: var(--surface-2); }
.journal-report tr.summary-row > td.student-name { background: var(--surface-2); }

.journal-report td.student-name, .journal-report th.student-name { text-align: left; }

/* Заголовок внутри .content (ЛК и др.) — без лишнего отступа, в линию с текстом */
.content .header-name h1, .content > h1 { padding-left: 0; padding-right: 0; }
.content .header-name { padding-top: 22px; }

/* Личный кабинет: выбор ребёнка — под заголовком страницы */
.lk-child-switcher {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    margin: 4px 0 18px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}
.lk-child-switcher-label { color: var(--text-muted); font-size: 13px; font-weight: 600; margin: 0 6px 0 10px; }
.lk-child-active, .lk-child-link {
    margin: 0;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.lk-child-active { background: var(--primary); color: var(--on-primary); }
.lk-child-link { color: var(--text-muted); }
.lk-child-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.lk-welcome { font-size: 15px; margin: 0 0 18px; }

/* Подсказка на странице входа */
body.login-page .login-form p.login-hint { margin: 16px 0 0; font-size: 12px; color: var(--text-faint); text-align: center; }

/* Точечные исправления контраста */
.delete-btn:disabled { color: var(--on-primary); opacity: .6; }
.key-pri { color: #1e293b; }

/* Имя педагога в карточке студента (общий .teacher-name рассчитан на страницу педагога) */
.student-card .info-row .value .teacher-name { font-size: inherit; font-weight: 500; }

/* ---------- 7. Бейджи, плашки, подсказки ---------- */
.status-badge {
    min-width: 0;
    margin: 0;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-shadow: none;
    line-height: 1.4;
    white-space: nowrap;
}
.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-success { background: var(--success-soft); color: var(--success); }
.money-negative { color: var(--danger); font-weight: 700; }
.phone-link { white-space: nowrap; color: var(--text-muted) !important; font-weight: 500; }
.phone-link:hover { color: var(--primary) !important; }
.dogovor-number { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Подсказка с контактами при наведении на ФИО */
.student-link, .students-table .student-name-link { position: relative; display: inline-block; }
.student-link .tooltip-text, .students-table .student-name-link .tooltip-text { display: none; }
.students-table .tooltip-title { font-weight: 600; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.students-table .tooltip-row { display: flex; justify-content: space-between; gap: 12px; }
.students-table .tooltip-row .label, .students-table .parent-phone { color: var(--text-muted); }
.students-table .tooltip-divider { border-top: 1px solid var(--border); margin: 6px 0; }
.list-count { color: var(--text-faint); font-size: 13px; margin: 4px 0 8px; }
.students-table .student-name-link:hover .tooltip-text,
.students-table .student-name-link:focus-visible .tooltip-text,
.student-link:hover .tooltip-text,
.student-link:focus-visible .tooltip-text {
    display: block;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 240px;
    padding: 12px 14px;
    background: var(--surface) !important;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    white-space: nowrap;
}
.students-table .student-name-link:hover .tooltip-text,
.student-link:hover .tooltip-text {
    width: max-content !important;
    min-width: 260px;
    max-width: 380px;
    white-space: normal;
    right: auto !important;
}
.students-table .tooltip-parent { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 3px 0; }
.tooltip-text .tip-label { display: block; color: var(--text-faint); font-size: 11px; line-height: 1.3; margin-top: 4px; }

/* Сообщения на страницах */
:where(.alert) { border-radius: var(--radius); }
:where(.alert-success, .success-message) { background: var(--success-soft); color: var(--success-text); border-color: var(--success); }
:where(.alert-error) { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger); }
:where(.alert-warning) { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning); }
.error { text-shadow: none; }

/* ---------- 8. Уведомления (toast) ---------- */
.toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    animation: toast-in .2s ease-out;
}
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast-icon { flex: none; font-weight: 700; color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-text { flex: 1; }
.toast-close {
    margin: -4px -6px 0 0;
    padding: 2px 6px;
    background: transparent;
    color: var(--text-faint);
    font-size: 18px;
    line-height: 1;
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 9. Дашборд ---------- */
.dash { padding-top: 6px; padding-bottom: 30px; }
.dash-mini { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.dash-mini a {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 13px;
}
.dash-mini a b { color: var(--text); font-size: 15px; }
.dash-mini a:hover { border-color: var(--primary); color: var(--primary); }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 18px;
}
.kpi-card {
    display: block;
    position: relative;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    overflow: hidden;
}
.kpi-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--kpi-color, var(--primary));
}
a.kpi-card:hover { color: var(--text); border-color: var(--kpi-color); box-shadow: var(--shadow-md); }
.kpi-danger { --kpi-color: var(--danger); }
.kpi-warning { --kpi-color: var(--warning); }
.kpi-info { --kpi-color: var(--info); }
.kpi-success { --kpi-color: var(--success); }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.kpi-value { margin: 6px 0 4px; font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--kpi-color); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-faint); }
.kpi-delta { font-weight: 700; margin-left: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 18px;
    align-items: start;
}
@media (min-width: 1800px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.dash .data-table td, .dash .data-table th { padding-left: 10px; padding-right: 10px; }

.bday-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.bday-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.bday-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); color: var(--text); }
.bday-card.is-today { background: var(--warning-soft); border-color: var(--warning); }
.bday-when { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; }
.bday-card.is-today .bday-when { color: var(--warning-text); }

.bday-name { font-weight: 600; font-size: 14px; }
.bday-meta, .bday-sub { font-size: 12px; color: var(--text-muted); }

.dash-search form { display: flex; gap: 10px; max-width: none; flex-wrap: nowrap; }
.dash-search input { flex: 1; min-width: 0; }
.dash-search button { margin: 0; }

/* ---------- 10. Страница входа ---------- */
body.login-page {
    background: radial-gradient(1200px 600px at 20% -10%, rgba(46, 217, 154, .18), transparent 60%), var(--header-bg);
    min-height: 100vh;
    padding: 16px;
}
body.login-page .login-form {
    background: var(--surface);
    color: var(--text);
    max-width: 380px;
    padding: 32px 32px 26px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.login-logo { font-size: 22px; font-weight: 800; letter-spacing: .04em; color: var(--text); margin: 0 0 18px; }
.login-logo span { color: var(--primary); }
body.login-page .login-form h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 4px; text-shadow: none; }
body.login-page .login-form p { font-size: 14px; color: var(--text-muted); text-shadow: none; margin: 0 0 18px; }
body.login-page .login-form label { padding: 0 0 6px; font-size: 13px; }
body.login-page .login-form input {
    font-size: 15px;
    margin: 0 0 14px;
    padding: 11px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
}
body.login-page .login-form button { margin: 6px 0 0; padding: 12px 0; font-size: 15px; border-radius: var(--radius-sm); }
body.login-page .login-form button:hover { background: var(--primary-hover); }
body.login-page .error {
    margin: 0 0 14px;
    padding: 10px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger-text);
}
.login-links { margin-top: 18px; text-align: center; }
.login-links .link, .link { color: var(--text-muted); text-shadow: none; font-size: 13px; }
.login-links .link:hover { color: var(--primary); }

/* ---------- Подвал ---------- */
footer { background: transparent; border-top: 1px solid var(--border); color: var(--text-faint); }
footer .f-top, footer .f-top p { color: var(--text-faint); font-size: 12px; }

/* ---------- Список преподавателей ---------- */
.teacher-list { display: flex; flex-direction: column; gap: 10px; }
.teacher-card {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.teacher-card.is-blocked { opacity: .75; }
.teacher-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 24px;
    padding: 14px 18px;
    color: var(--text);
}
.teacher-card-main:hover { background: var(--surface-2); color: var(--text); }
.teacher-card-name { font-weight: 600; font-size: 15px; min-width: 220px; }
.teacher-card-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--text-muted); font-size: 13px; }
.teacher-access {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border-left: 1px solid var(--border);
}
.teacher-access.is-on { background: var(--success-soft); color: var(--success); }
.teacher-access.is-off { background: var(--danger-soft); color: var(--danger); }
.teacher-access:hover { filter: brightness(.96); }

/* Статусы занятий в списке */
.lesson-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-muted); }
.lesson-status-2 { background: var(--success-soft); color: var(--success); }
.lesson-status-3 { background: var(--danger-soft); color: var(--danger); }
.lessons-table td:first-child a { color: var(--primary); font-weight: 600; }

/* Кнопки фильтров в журналах не вылезают за край */
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-actions > * { margin: 0 !important; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .content, .header-block, .breadcrumbs { padding-left: 16px; padding-right: 16px; }
    h1 { font-size: 20px; padding: 0 16px; }
    h1 .h1-sub { display: block; margin: 2px 0 0; }
    header .menu { padding: 6px 12px 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    header .menu::-webkit-scrollbar { display: none; }
    header .menu a { padding: 8px 10px 10px; font-size: 13px; }
    header .menu a:last-child { margin-left: 0; }
    header .logo { padding: 0 16px; }
    .menu2 > div { padding: 4px 16px 6px; overflow-x: auto; flex-wrap: nowrap; }
    .menu2 a { white-space: nowrap; }
    .card { padding: 14px; border-radius: var(--radius); }
    .kpi-value { font-size: 22px; }
    .dash-search form { flex-wrap: wrap; }
    .dash-search button { width: 100%; }

    .toast-stack { left: 16px; right: 16px; max-width: none; }
}
@media (max-width: 480px) {
    .kpi-grid { gap: 10px; }
    .kpi-card { padding: 12px 12px 12px 14px; border-radius: var(--radius); }
    .kpi-label { font-size: 11px; }
    .kpi-value { font-size: 20px; }
    .kpi-sub { font-size: 11px; }
    body.login-page .login-form { padding: 24px 20px; }
}

/* ---------- Телефон: без горизонтальной прокрутки, таблицы — карточками ---------- */
@media (max-width: 760px) {
    html, body { overflow-x: hidden; }
    .content, .container, .content form { max-width: 100%; }
    .content input:not([type=checkbox]):not([type=radio]), .content select, .content textarea,
    .container input:not([type=checkbox]):not([type=radio]), .container select, .container textarea {
        max-width: 100% !important;
    }
    .content img, .container img { max-width: 100%; height: auto; }
    .content label, .content small, .content .data-type, .container label {
        max-width: 100%;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .content label { width: auto !important; }
    .table-wrap, .table-responsive, .lk-table-wrap { overflow-x: visible !important; }
    .table-wrap.is-tall { max-height: none; overflow: visible; border: 0; }

    table.stack-mobile,
    table.stack-mobile > tbody,
    table.stack-mobile > tbody > tr,
    table.stack-mobile > tbody > tr > td {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        float: none !important;
    }
    table.stack-mobile { border: 0 !important; background: transparent !important; }
    table.stack-mobile > thead,
    table.stack-mobile tr.stack-head { display: none !important; }
    table.stack-mobile > tbody > tr {
        position: relative;
        margin: 0 0 10px !important;
        padding: 8px 14px !important;
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius) !important;
        box-shadow: var(--shadow-sm);
        overflow: visible !important;
    }
    table.stack-mobile > tbody > tr:hover > td { background: transparent !important; }
    table.stack-mobile > tbody > tr > td {
        display: flex !important;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 0 !important;
        border: 0 !important;
        border-bottom: 1px dashed var(--border) !important;
        text-align: right !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        overflow: visible !important;
        background: transparent !important;
    }
    table.stack-mobile > tbody > tr > td:last-child { border-bottom: 0 !important; }
    table.stack-mobile > tbody > tr > td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 38%;
        text-align: left;
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 600;
        text-transform: none;
    }
    /* Первая ячейка — заголовок карточки (обычно ФИО или дата) */
    table.stack-mobile > tbody > tr > td:first-child {
        justify-content: flex-start;
        text-align: left !important;
        font-size: 15px;
        font-weight: 600;
    }
    table.stack-mobile > tbody > tr > td:first-child::before { display: none; }
    table.stack-mobile > tbody > tr > td > p { margin: 0; }
    table.stack-mobile > tbody > tr > td > * { min-width: 0; max-width: 100%; white-space: normal !important; overflow-wrap: anywhere; }
    table.stack-mobile > tbody > tr > td.stack-empty { display: none !important; }
    table.stack-mobile td.empty-state { display: block !important; text-align: center !important; }

    /* Отметки на занятии (ФИО + оценки + посещение): своя раскладка — ФИО сверху, поля под ним */
    .block_form { float: none !important; margin-right: 0 !important; }
    table, .table-wrap { clear: both; }
    table.jurnal, table.jurnal > tbody { display: block !important; width: 100% !important; }
    table.jurnal > tbody > tr {
        display: grid !important;
        grid-template-columns: 28px repeat(3, minmax(0, 1fr));
        gap: 6px 8px;
        align-items: center;
        margin: 0 0 8px;
        padding: 10px 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        width: auto !important;
    }
    table.jurnal > tbody > tr > td {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        writing-mode: horizontal-tb !important;
        white-space: normal !important;
        text-align: left !important;
    }
    table.jurnal > tbody > tr > td:nth-child(2) { grid-column: 2 / -1; font-weight: 600; }
    table.jurnal > tbody > tr > td:nth-child(3) { grid-column: 2; }
    table.jurnal input, table.jurnal select { width: 100% !important; min-width: 0 !important; margin: 0 !important; }

    /* Подсказка с контактами на телефоне — под строкой, на всю ширину карточки */
    .student-link:hover .tooltip-text, .students-table .student-name-link:hover .tooltip-text { left: 0; right: auto; max-width: calc(100vw - 64px); }

    /* Платежи: сводка в 2 колонки, кнопки во всю ширину */
    .teacher-card { flex-direction: column; }
    .teacher-access { border-left: 0; border-top: 1px solid var(--border); min-width: 0; }
    .teacher-card-name { min-width: 0; width: 100%; }
    .filter-actions > * { flex: 1 1 140px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
@media print {
    header, footer, .breadcrumbs, .theme-toggle, .toast-stack, .table-pager, .menu2 { display: none !important; }
    body, html { background: #fff; }
}

/* =====================================================================
   Шапка: кнопки справа, мобильное меню (экран уже 1000px)
   ===================================================================== */
.header-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-toggle {
    display: none;
    margin: 0;
    height: 30px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .1);
    color: var(--header-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.menu-toggle:hover { background: rgba(255, 255, 255, .18); }

@media (max-width: 999px) {
    header { padding-bottom: 12px; }
    header .logo { padding: 0 16px; }
    .menu-toggle { display: inline-flex; align-items: center; }
    header .menu { display: none !important; }
    header.menu-open .menu {
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 2px;
        margin-top: 10px;
        padding: 6px 12px 0;
        overflow: visible;
        border-top: 1px solid rgba(255, 255, 255, .1);
    }
    header.menu-open .menu a,
    header.menu-open .menu a:last-child {
        margin: 0;
        padding: 11px 12px;
        font-size: 15px;
        border-radius: var(--radius-sm);
        border-bottom: 0 !important;
        border-left: 3px solid transparent;
        white-space: normal;
    }
    header.menu-open .menu a:hover { border-bottom: 0; border-left-color: rgba(255, 255, 255, .25); }
    header.menu-open .menu a.is-active { border-left-color: var(--primary-light); background: rgba(255, 255, 255, .06); }
}

/* =====================================================================
   Список групп
   ===================================================================== */
.group-list { display: flex; flex-direction: column; gap: 10px; }
.group-list > .group-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title counts" "meta counts";
    gap: 4px 16px;
    align-items: center;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.group-list > .group-card:hover { border-color: var(--primary); color: var(--text); }
.group-card-title { grid-area: title; font-size: 15px; font-weight: 600; }
.group-card-time { color: var(--text-muted); font-weight: 400; font-size: 14px; margin-left: 4px; }
.group-card-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 20px; color: var(--text-muted); font-size: 13px; }
.group-card-counts { grid-area: counts; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) {
    .group-list > .group-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "meta" "counts"; }
    .group-card-counts { justify-content: flex-start; margin-top: 6px; }
    .group-card-meta { flex-direction: column; }
}

/* Таблицы без внутренней прокрутки: если таблица помещается по ширине,
   обёртка не обрезает её, и заголовок закрепляется при прокрутке страницы */
.table-wrap.fits { overflow: visible; }

.group-list, .teacher-list { margin-top: 16px; }


/* Личный кабинет: карточка баланса без «пятна» в светлой теме */
.lk-balance-card { background: var(--lk-balance-bg); color: var(--lk-balance-text); border: 1px solid var(--border); border-radius: var(--radius); }
.lk-balance-label, .lk-balance-sub { opacity: 1; color: var(--lk-balance-text); }
.lk-balance-amount { color: var(--lk-balance-text); }
.lk-balance-card.lk-balance-positive .lk-balance-amount { color: var(--lk-balance-pos); }
.lk-balance-card.lk-balance-negative .lk-balance-amount { color: var(--lk-balance-neg); }

/* Переключатель студента: меньше скругление */
.lk-child-switcher { border-radius: 10px; }
.lk-child-active, .lk-child-link { border-radius: 8px; }

/* Dashboard: таблицы в карточках не вылезают и не «слипаются» с соседней карточкой */
.card .table-wrap, .card .table-wrap.fits { overflow-x: auto; }
.dash .data-table th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.dash .data-table th.sortable { padding-right: 20px !important; }
.dash .phone-link { white-space: nowrap; }

.zp-note { color: var(--warning-text); font-size: 12px; }
.zp-lessons { margin-top: 8px; }


/* Подсказка с контактами — плавает поверх страницы (координаты задаёт app.js) */
.student-link:hover .tooltip-text.is-floating,
.student-link:focus-visible .tooltip-text.is-floating,
.students-table .student-name-link:hover .tooltip-text.is-floating,
.students-table .student-name-link:focus-visible .tooltip-text.is-floating {
    position: fixed !important;
    right: auto !important;
    z-index: 1000;
}

/* Подвал: статистика за неделю */
footer { padding: 18px 0 22px; margin-top: 30px; }
.footer-stats { max-width: var(--content-size); margin: 0 auto; padding: 0 20px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 22px; }
.footer-stats-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.footer-stats-title span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-faint); margin-left: 4px; }
.footer-stats ul { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; margin: 0; padding: 0; }
.footer-stats li { font-size: 13px; color: var(--text-muted); }
.footer-stats li b { color: var(--text); font-size: 15px; margin-right: 2px; }
@media (max-width: 760px) { .footer-stats { padding: 0 16px; } }

/* =====================================================================
   Страница «Заработанные средства» (teacher/teacher_zp.php)
   ===================================================================== */
.page-zp .content > .container { padding: 0; max-width: none; }
.page-zp .earnings-header {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    margin: 6px 0 18px;
}
.page-zp .teacher-info { align-items: center; gap: 16px 24px; }
.page-zp .teacher-name { font-size: 22px; font-weight: 700; color: var(--text); }
.page-zp .teacher-stavka { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-zp .total-earnings {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius);
    padding: 12px 22px;
    font-size: 30px;
    line-height: 1.15;
    text-align: right;
}
.page-zp .total-earnings small { color: var(--text-muted); font-size: 13px; font-weight: 500; margin-top: 4px; }

.page-zp .filter-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin: 0 0 18px;
}
.page-zp .filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    gap: 12px 16px;
    align-items: end;
    max-width: none;
    margin: 0;
}
.page-zp .filter-group { min-width: 0; flex: none; }
.page-zp .filter-group label { display: block; padding: 0; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.page-zp .filter-group input,
.page-zp .filter-group select { width: 100%; max-width: none; min-width: 0; height: 40px; padding: 0 12px; margin: 0; }
.page-zp .filter-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.page-zp .filter-actions .btn,
.page-zp .empty-state .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
    text-decoration: none;
}
.page-zp .btn-primary { background: var(--primary); }
.page-zp .btn-primary:hover { background: var(--primary-hover); color: #fff; }
.page-zp .btn-secondary { background: var(--neutral); }
.page-zp .btn-secondary:hover { background: var(--neutral-hover); color: #fff; }
.page-zp .btn-info { background: var(--surface-3); color: var(--text); }
.page-zp .btn-info:hover { background: var(--border); color: var(--text); }

.page-zp .stats-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 18px; }
.page-zp .stat-card { text-align: left; padding: 16px 18px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.page-zp .stat-card h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; margin: 0 0 6px; }
.page-zp .stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; }
.page-zp .stat-card .stat-label { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.page-zp .empty-state { padding: 28px 20px; border-radius: var(--radius-lg); color: var(--text-muted); }
.page-zp .empty-state h3 { text-transform: none; letter-spacing: 0; font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.page-zp .empty-state p { margin: 6px 0; }
.page-zp .empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px !important; }

@media (max-width: 1000px) {
    .page-zp .filter-form { grid-template-columns: 1fr 1fr; }
    .page-zp .filter-group:first-child, .page-zp .filter-actions { grid-column: 1 / -1; }
    .page-zp .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .page-zp .filter-form { grid-template-columns: 1fr; }
    .page-zp .filter-actions { flex-wrap: wrap; }
    .page-zp .filter-actions .btn { flex: 1 1 100px; }
    .page-zp .total-earnings { text-align: left; width: 100%; }
}

/* Зарплата: карточки групп без тёмных «пятен» */
.page-zp .groups-grid { gap: 14px; margin-bottom: 18px; }
.page-zp .group-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.page-zp .group-header { background: var(--surface-2); color: var(--text); padding: 16px 20px; border-bottom: 1px solid var(--border); }
.page-zp .group-header h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; }
.page-zp .group-header .group-info { color: var(--text-muted); opacity: 1; font-size: 13px; }
.page-zp .group-body { padding: 16px 20px; }
.page-zp .group-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.page-zp .group-earnings { background: var(--primary-soft); color: var(--primary); border-radius: var(--radius); padding: 14px 16px; font-size: 24px; }
.page-zp .group-earnings small { color: var(--text-muted); font-size: 13px; }
.page-zp .group-footer { background: var(--surface-2); padding: 12px 20px; }
.page-zp .details-link { color: var(--primary); font-weight: 600; }
.page-zp .badge { text-transform: none; letter-spacing: 0; font-weight: 600; }
.page-zp .summary-section { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px 24px; }
.page-zp .summary-section h3 { text-transform: none; letter-spacing: 0; font-size: 17px; font-weight: 700; }
.page-zp .summary-total { color: var(--primary); border-top-color: var(--primary); }
.page-zp .no-stavka-warning { background: var(--warning-soft); color: var(--warning-text); border: 1px solid var(--warning); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; }
.page-zp .btn-info { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong) !important; }
.page-zp .btn-info:hover { background: var(--surface-2); color: var(--text); }

/* «Информация о расчёте» — раскрывается по нажатию */
.zp-info { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.zp-info > summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.zp-info > summary::-webkit-details-marker { display: none; }
.zp-info > summary::after { content: "Показать"; font-size: 13px; font-weight: 600; color: var(--primary); }
.zp-info[open] > summary::after { content: "Скрыть"; }
.zp-info[open] > summary { border-bottom: 1px solid var(--border); }
.zp-info-body { padding: 12px 16px 14px; color: var(--text-muted); font-size: 14px; }
.zp-info-body p { margin: 0 0 8px; }
.zp-info-grid { color: var(--text); }
.zp-info-rates { margin: 0 0 10px; padding: 0; list-style: none; columns: 2 260px; column-gap: 24px; font-size: 13px; }
.zp-info-rates li { padding: 2px 0; break-inside: avoid; }
.page-zp .filter-actions .btn.btn-info { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong) !important; }
.page-zp .filter-actions .btn.btn-info:hover { background: var(--surface-2); color: var(--text); }
.zp-info > summary { background: transparent; border-radius: var(--radius); }
.zp-info > summary:hover { background: var(--surface-3); }

/* =====================================================================
   Зарплаты педагогов (php/salary_report.php)
   ===================================================================== */
.sr-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; max-width: none; }
.sr-periods { display: flex; gap: 8px; flex-wrap: wrap; }
.sr-chip {
    display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text); background: var(--surface); font-weight: 600; font-size: 14px;
}
.sr-chip:hover { border-color: var(--primary); color: var(--primary); }
.sr-chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.sr-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sr-custom label { display: inline-flex; align-items: center; gap: 8px; padding: 0; margin: 0; font-size: 14px; color: var(--text-muted); }
.sr-custom input[type=date] { height: 38px; padding: 0 10px; margin: 0; }
.sr-custom button { height: 38px; margin: 0; padding: 0 18px; }

.sr-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin: 0 0 16px; padding: 0 0 0; border-bottom: 1px solid var(--border);
}
.sr-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 14px; margin-bottom: -1px;
    border: 1px solid transparent; border-bottom: 0;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-muted); font-weight: 600; font-size: 14px;
}
.sr-tab:hover { color: var(--text); background: var(--surface-2); }
.sr-tab.is-active { color: var(--text); background: var(--surface); border-color: var(--border); }
.sr-tab-warn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--warning); color: #fff; font-size: 12px; font-weight: 700;
}
.sr-kpi { margin-bottom: 18px; }
.sr-total td { font-weight: 700; border-top: 2px solid var(--border-strong); background: var(--surface-2); }
.sr-teacher-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.sr-teacher-head h3 { margin: 0 0 4px; font-size: 20px; }
.sr-teacher-head p { margin: 0; }
.sr-teacher-total {
    background: var(--primary-soft); color: var(--primary); border-radius: var(--radius);
    padding: 10px 20px; font-size: 26px; font-weight: 700; text-align: right; line-height: 1.15;
}
.sr-teacher-total small { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.sr-warning { background: var(--warning-soft); color: var(--warning-text); border: 1px solid var(--warning); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; }
.sr-actions { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 0; }
.sr-print { margin: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.sr-print:hover { background: var(--surface-2); }
@media (max-width: 760px) {
    .sr-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    .sr-tab { white-space: nowrap; }
    .sr-teacher-total { width: 100%; text-align: left; }
}
@media print {
    .sr-filter, .sr-tabs, .sr-actions { display: none !important; }
}

/* Журнал (php/audit_log.php) */
.al-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; max-width: none; }
.al-filter label { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.al-filter input, .al-filter select { height: 38px; padding: 0 10px; margin: 0; min-width: 160px; }
.al-filter button { height: 38px; margin: 0; padding: 0 18px; }
.al-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); font-size: 12px; text-align: center; }
.sr-tab.is-active .al-count { background: var(--primary-soft); color: var(--primary); }
.al-note { display: block; margin-top: 10px; }

/* Отметки посещения: Н — пропуск, О — отработано в другой группе */
select.status-toggle[data-mark="Н"] { background: var(--danger-soft) !important; color: var(--danger) !important; font-weight: 700; }
select.status-toggle[data-mark="О"] { background: var(--info-soft) !important; color: var(--info) !important; font-weight: 700; }
.mark-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 12px; font-size: 13px; color: var(--text-muted); }
.mark-legend b { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center; margin-right: 4px; }
.mark-legend .m-n { background: var(--danger-soft); color: var(--danger); }
.mark-legend .m-o { background: var(--info-soft); color: var(--info); }
.lesson-type-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--purple-soft); color: var(--text); }

.excused-cell { background-color: var(--info-soft) !important; color: var(--info); font-weight: 700; }


.lk-badge-excused { background: var(--info-soft); color: var(--info); }


/* Гости из других групп на занятии */
.guest-row td { background: var(--info-soft); }
.guest-note { display: block; font-size: 12px; color: var(--text-muted); }
.guest-remove { margin: 4px 0 0; padding: 2px 10px; font-size: 12px; background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
.guest-remove:hover { background: var(--danger-soft); color: var(--danger); }
.guest-card { margin-top: 18px; }
.guest-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; max-width: none; margin: 0 0 12px; }
.guest-search label { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.guest-search input { height: 38px; margin: 0; min-width: 200px; }
.guest-search button { height: 38px; margin: 0; }
.guest-hidden-form { display: none; }

/* Индивидуальное занятие (php/lesson_individual.php) */
.ind-form { max-width: none; display: block; }
.ind-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ind-type { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; margin: 0; }
.ind-type:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.ind-type span { display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.ind-type small { color: var(--text-muted); font-weight: 400; }
.ind-type input { margin-top: 3px; }
.ind-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.ind-grid > label { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ind-grid input, .ind-grid select, .ind-grid textarea { width: 100%; margin: 0; }
.ind-grid .ind-wide { grid-column: 1 / -1; }
.ind-grid .ind-check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; color: var(--text); }
.ind-grid .ind-check input { width: auto; flex: 0 0 auto; }
.ind-grid .ind-check { white-space: nowrap; }

/* Поиск студента с подсказками (js/app.js → initStudentPickers) */
.student-picker { position: relative; }
.student-picker-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.12)); }
.student-picker-option { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.student-picker-option:last-child { border-bottom: 0; }
.student-picker-option b { font-weight: 600; color: var(--text); }
.student-picker-option small { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.student-picker-option.is-active { background: var(--primary-soft); }
.student-picker-empty { padding: 10px 12px; color: var(--text-muted); font-weight: 400; }
.student-picker-info { display: block; margin-top: 4px; font-weight: 400; font-size: 12px; color: var(--text-muted); }
.ind-grid > .ind-field { display: flex; flex-direction: column; gap: 6px; }
.ind-grid > .ind-field > label { padding: 0; margin: 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ind-grid .student-picker input { width: 100%; margin: 0; }
.student-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }

/* Вкладки форматов на странице «Группы» */
.format-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.format-tabs a { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 500; background: var(--surface); }
.format-tabs a span { color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.format-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.format-tabs a.active span { color: rgba(255,255,255,.8); }
.student-actions .ind-action { display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; }
.student-actions .ind-action:hover { border-color: var(--primary); color: var(--primary); }
.student-actions .ind-action-main { flex-basis: 100%; justify-content: center; background: var(--primary-soft); border-color: transparent; }

/* Обновление системы (php/system_update.php) */
.update-card { margin-bottom: 16px; }
.update-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.update-head p { margin: 4px 0 0; max-width: 640px; }
.update-table form { margin: 0; }
.update-sql { white-space: pre-wrap; font-size: 12px; margin: 8px 0; padding: 8px; background: var(--surface-2); border-radius: var(--radius-sm); }
.update-checks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.update-checks li { padding-left: 10px; border-left: 3px solid var(--success); }
.update-checks li.is-missing { border-left-color: var(--danger); font-weight: 600; }

/* ===== Единая кнопка «← Назад» (все разделы) ===== */
a.back-link, .back-top a.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 8px 0 16px; padding: 8px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font-size: 14px; font-weight: 500; line-height: 1.3; text-decoration: none;
    transition: border-color .15s, color .15s;
}
a.back-link:hover, .back-top a.back-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; background: var(--surface); }
p > a.back-link { margin: 0; }
.back-top { margin-bottom: 12px; }

/* =====================================================================
   Визуальная полировка (2026-10): единые заголовки, подписи, кнопки, отступы
   ===================================================================== */

/* --- Заголовки разделов: без КАПСА, умеренный размер --- */
.content h2, .content h3, .content summary, .settings-section-title, .teacher h2, .jurnal-page h2 {
    text-transform: none !important;
    letter-spacing: normal !important;
}
.content h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
.content h3, .content summary h3 { font-size: 17px; font-weight: 600; line-height: 1.35; }
.settings-section-title { font-size: 18px; font-weight: 600; }

/* --- Подменю раздела: одинаковые отступы, где бы оно ни стояло --- */
.header-name h1 { margin-bottom: 0; }
.menu2 > div { padding-top: 12px; padding-bottom: 14px; }

/* --- Подписи полей форм: один размер везде --- */
.block_form > label, .block_form > p, .block_cat > label, .new-student label, .form-group > label,
.filters .block_form label, .filter_form p {
    font-size: 13px !important;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 0 6px;
    margin: 0;
}
.block_cat > p { font-size: 14px; }

/* --- Кнопки: единая высота, скругление, шрифт --- */
.content .button, .content input[type=submit], .content button[type=submit], .content .btn,
.content .btn-secondary, .content .btn-cancel, .content .btn-save, .content .btn-pay, .content .btn-writeoff,
.content .btn-delete-confirm, .content .search-btn, .content .btn-add, .content .btn-primary,
.content .quick-pay-btn, .content .quick-writeoff-btn, .content .btn-print, .content .filter-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 0 18px !important;
    border-radius: 8px !important;
    font-size: 14px !important; font-weight: 500 !important; line-height: 1.2;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    box-sizing: border-box;
}
/* второстепенные: «Отмена», «Сбросить» и т.п. */
.content .btn-secondary, .content .btn-cancel, .content .clear-btn, .content .btn-teacher, .content .btn-outline,
.content a.btn-edit.btn-stavka {
    background: var(--surface-2) !important; color: var(--text) !important;
    border: 1px solid var(--border) !important;
}
.content .btn-secondary:hover, .content .btn-cancel:hover, .content .clear-btn:hover, .content .btn-teacher:hover {
    border-color: var(--primary) !important; color: var(--primary) !important;
}

/* --- Единая кнопка «Назад» (перебивает зелёный цвет ссылок в .content) --- */
a.back-link.back-link, .content a.back-link.back-link {
    color: var(--text); background: var(--surface); border: 1px solid var(--border);
}
a.back-link.back-link:hover { color: var(--primary); border-color: var(--primary); }

/* --- Старые формы (.new-student / .block_cat / .block_form): ровная сетка полей --- */
.new-student .block_cat { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 0 0 18px; float: none; }
.new-student .block_cat > p { flex-basis: 100%; margin: 0 0 -4px; font-size: 14px; font-weight: 600; color: var(--text); }
.new-student .block_form { display: flex; flex-direction: column; margin: 0 !important; float: none !important; }
.new-student .block_form > br { display: none; }
.new-student .block_form input:not([type=checkbox]):not([type=radio]), .new-student .block_form select { width: 220px; max-width: 100%; margin: 0; }
.new-student .block_textarea { flex-basis: 100%; display: flex; flex-direction: column; }
.new-student .block_textarea textarea { width: 100%; }
@media (max-width: 600px) { .new-student .block_form, .new-student .block_form input, .new-student .block_form select { width: 100% !important; } }

/* --- Зарплатные сетки: список и редактирование --- */
.teachers-list .teacher-name { font-size: 15px !important; font-weight: 600 !important; }
.teachers-list .teacher-item { padding: 10px 14px !important; }
.teachers-list .teacher-item .btn, .teachers-list .btn-teacher { min-height: 32px !important; padding: 0 12px !important; font-size: 13px !important; }
.stavka-actions .btn { min-height: 36px; }
.content .stavka-actions .btn-edit { background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
.content .stavka-actions .btn-edit:hover { border-color: var(--primary) !important; color: var(--primary) !important; }
.setka-form form { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(180px, 1fr)); gap: 12px 16px; align-items: start; }
.setka-form .form-row, .setka-form .form-row-inline > div { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.setka-form .form-row-inline { display: contents; }
.setka-form form > div:last-child { grid-column: 1 / -1; }
.setka-form label { padding: 0 !important; font-size: 13px; color: var(--text-muted); }
.setka-form input { width: 100%; margin: 0; }
@media (max-width: 700px) { .setka-form form { grid-template-columns: 1fr; } }
.usluga-table td.usluga-price { font-weight: 600; color: var(--success); white-space: nowrap; }
.usluga-table td.usluga-actions { position: static !important; display: flex; gap: 14px; justify-content: flex-end; white-space: nowrap; }
.usluga-table td.usluga-actions form { margin: 0; display: inline; }
.content .link-btn, .content button.link-btn[type=submit] {
    background: none !important; border: 0 !important; padding: 0 !important; min-height: 0;
    color: var(--primary) !important; font-size: 13px !important; font-weight: 500 !important; cursor: pointer;
}
.content .link-btn:hover { text-decoration: underline; }
.content .link-btn-danger, .content button.link-btn-danger[type=submit] { color: var(--danger) !important; }

/* --- Администраторы: роль маленькой меткой --- */
.teacher-card-name .admin-role-badge { display: inline-block; margin-left: 8px; padding: 2px 8px !important; border-radius: 999px; font-size: 11px !important; font-weight: 600; vertical-align: middle; min-height: 0; border: 0; }
span.teacher-access { cursor: default; }

/* --- Журнал занятия: шапка колонок, ФИО по центру строки --- */
.jurnal tbody tr { align-items: center; }
.jurnal td:nth-child(1), .jurnal td:nth-child(2) { padding-top: 10px !important; padding-bottom: 10px !important; justify-content: center; }
.jurnal thead.jurnal-head tr { display: flex; width: 100%; background: none; }
.jurnal thead.jurnal-head th { padding: 0 0 2px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; background: none; border: 0; }
.jurnal thead.jurnal-head th:nth-child(1) { width: 15px; flex: none; }
.jurnal thead.jurnal-head th:nth-child(2) { flex: 1; text-align: left; }
.jurnal thead.jurnal-head th:nth-child(n+3) { width: 40px; margin-right: 10px; flex: none; text-align: center; white-space: nowrap; }
@media (max-width: 760px) { .jurnal thead.jurnal-head { display: none; } }

/* --- Заголовок страницы с подзаголовком (например, «Занятие 28.09.2026 · группа») --- */
h1 .h1-sub { display: block; margin-top: 4px; font-size: 15px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }

/* --- Кнопки без «лишнего» отступа слева, ровный промежуток между соседними --- */
.content .button, .content input[type=submit], .content button[type=submit], .content .btn,
.content .btn-secondary, .content .btn-cancel, .content .btn-add { margin: 0 8px 0 0; }
.new-student .block_form input[type=submit] { width: auto !important; }

/* --- Карточка группы: компактная шапка и строки студентов --- */
.header-block { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.header-block h2 { flex-basis: 100%; margin: 0 0 6px; padding-bottom: 10px; font-size: 22px !important; font-weight: 600 !important; }
.header-block h2 span { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 6px; }
.header-block > p { margin: 0; font-size: 14px; color: var(--text-muted); }
table.group_edit tr.student-row { align-items: center; }
table.group_edit tr.student-row > td { vertical-align: middle; }
table.group_edit tr.student-row > td:nth-child(2), table.group_edit tr.student-row > td:nth-child(3) { white-space: nowrap; }
h1 span.h1-sub { margin-left: 0; padding: 0; }

/* --- Журнал успеваемости группы: фильтр и панель действий --- */
.filter-form form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.filter-form .filter-row { display: flex; gap: 12px 16px; margin: 0; flex-wrap: wrap; }
.filter-form .filter-group { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.filter-form .filter-group label { padding: 0; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.filter-form .filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.filter-form .filter-actions > * { margin: 0 !important; }
.controls.no-print { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.controls.no-print > * { margin: 0 !important; }
.controls.no-print > div:last-child { margin-left: auto !important; color: var(--text-muted); }

/* --- Перевод студента: ровная сетка полей, форма по ширине страницы --- */
.transfer-container { max-width: none !important; margin: 0 !important; }
.transfer-container .form-row { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; margin: 0 0 14px; }
.transfer-container .form-group { display: flex !important; flex-direction: column; gap: 6px; margin: 0 0 14px; float: none !important; width: auto !important; }
.transfer-container .form-row .form-group { margin: 0; }
.transfer-container .form-group label { padding: 0; font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.transfer-container .form-group input, .transfer-container .form-group select, .transfer-container .form-group textarea { width: 100% !important; margin: 0; box-sizing: border-box; }
.transfer-container .form-actions { display: flex; gap: 8px; justify-content: flex-start !important; }
.status-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; border: 1px solid var(--border); }

/* --- Формы в карточках настроек — по левому краю, как остальные формы --- */
.content .settings-card form, .lk-access-form { margin-left: 0 !important; margin-right: 0 !important; max-width: 460px; }
.lk-access-form label { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px; font-size: 13px; color: var(--text-muted); }
.content .settings-card h3 { margin: 0 0 12px; padding-bottom: 10px; }

/* --- Фильтры обращений — такими же «таблетками», как подменю --- */
.lk-ticket-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.lk-ticket-filters a { border-radius: 999px !important; padding: 6px 12px !important; font-size: 13px !important; font-weight: 500; margin: 0 !important; }
.transfer-container form { display: block !important; }
.transfer-container .balance-info { max-width: none; }
.new-status .block_form input[type=color] { width: 48px !important; height: 40px; padding: 4px; }
.new-status .block_form small { margin-top: 4px; }
.new-status .block_cat { align-items: flex-start; }
.new-status .block_form:last-child { align-self: flex-end; margin-bottom: 22px !important; }
.content .form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start !important; align-items: center; }
.content .form-actions > * { margin: 0 !important; }

/* --- Кабинет педагога --- */
.content.teacher select[name=ls_status] { min-width: 170px; }
.content.teacher .info-block p, .content.teacher .group-info p { font-size: 14px; }
@media (max-width: 600px) {
    .usluga-table th, .usluga-table td { padding: 8px 6px !important; font-size: 13px; }
    .usluga-table th { font-size: 10px; }
    .usluga-table td.usluga-actions { flex-direction: column; gap: 6px; align-items: flex-end; }
}
@media (max-width: 760px) {
    table.jurnal > tbody > tr > td:nth-child(3)::before { content: 'Школа'; }
    table.jurnal > tbody > tr > td:nth-child(4)::before { content: 'ДЗ'; }
    table.jurnal > tbody > tr > td:nth-child(5)::before { content: 'Посещ.'; }
    table.jurnal > tbody > tr > td:nth-child(n+3)::before { display: block; font-size: 10px; text-transform: uppercase; color: var(--text-muted); text-align: center; margin-bottom: 2px; }
}

/* =====================================================================
   Выравнивание (2026-10-03): содержимое страниц по левому краю заголовка,
   кнопки на одной линии с полями, подменю на телефоне переносится
   ===================================================================== */
.content > .container { padding-left: 0 !important; padding-right: 0 !important; max-width: none; }

/* Поля «старых» форм (block_cat / block_form) на всех страницах — одной сеткой */
.content form .block_cat { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 0 0 14px; float: none; }
.content form .block_form { display: flex; flex-direction: column; margin: 0 !important; float: none !important; }
.content form .block_form > label { padding: 0 0 6px !important; }
.content form .block_form > br { display: none; }
.content form .block_cat > .button, .content form .block_cat > input[type=submit],
.content form .block_cat > button, .content form .block_cat > a.btn-secondary,
.content form .block_form > .button, .content form .block_form > button { align-self: flex-end; }
.content form .block_textarea { flex-basis: 100%; display: flex; flex-direction: column; width: 100%; }
.content form .block_textarea textarea { width: 100%; }
.content form > .button, .content form > input[type=submit], .content form > button[type=submit] { margin-top: 4px; }

/* Подменю: на телефоне — перенос строк вместо горизонтальной прокрутки */
@media (max-width: 760px) {
    .menu2 > div { flex-wrap: wrap !important; overflow-x: visible !important; }
}

/* --- Карточка преподавателя: статистика, группы, история ставок --- */
.content form .block_form-wide select, .content form .block_form-wide input { width: 456px !important; max-width: 100%; }
.section-title { margin: 28px 0 12px; font-size: 18px !important; font-weight: 600 !important; }
.teacher-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.teacher-stats .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.teacher-stats .kpi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.teacher-stats .kpi-value { margin: 6px 0 2px; font-size: 24px; font-weight: 600; color: var(--text); }
.teacher-stats .kpi-sub { font-size: 12px; color: var(--text-muted); }
.teacher-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; font-size: 14px; color: var(--text-muted); align-items: center; }
.teacher-facts b { color: var(--text); font-weight: 600; }
.teacher-facts a { margin-left: auto; }
.teacher-groups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.teacher-group-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); font-size: 13px; text-decoration: none; }
.teacher-group-chip:hover { border-color: var(--primary); color: var(--primary); }
.teacher-group-chip em { font-style: normal; font-size: 11px; color: var(--primary); }
.teacher-group-chip small { color: var(--text-muted); }
@media (max-width: 600px) { .teacher-facts a { margin-left: 0; } }
.content form .block_form input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]),
.content form .block_form select { height: 42px; box-sizing: border-box; margin: 0; }
.content form .block_textarea > label, .content form .block_cat > label { padding: 0 0 6px !important; }
a.back-link.back-link { min-height: 38px; box-sizing: border-box; }
@media (max-width: 600px) { .teacher-stats { grid-template-columns: 1fr 1fr; gap: 8px; } .teacher-stats .kpi { padding: 10px 12px; } .teacher-stats .kpi-value { font-size: 20px; } .teacher-stats .kpi-label { font-size: 10px; } }
@media (max-width: 600px) {
    .content form .block_cat > .block_form { width: 100%; }
    .content form .block_cat > .block_form input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]),
    .content form .block_cat > .block_form select { width: 100% !important; }
    .content form .block_cat > .block_form .button, .content form .block_cat > .block_form button { width: 100%; margin: 0 !important; }
}

/* --- Кнопки той же высоты, что и поля (42px), и на одной линии с ними --- */
.content .button, .content input[type=submit], .content button[type=submit], .content .btn,
.content .btn-secondary, .content .btn-cancel, .content .btn-add, .content .search-btn { min-height: 42px; }
a.back-link.back-link { min-height: 42px; margin: 0; }
.content form .block_cat > br { display: none; }
.content form .block_cat > p { margin: 0; }
.content form .block_cat > .back-link, .content form .block_cat > p > .back-link { align-self: flex-end; }
.content .status-info { margin-bottom: 12px; }

/* --- Панели фильтров (Занятия и др.): промежутки между полями, кнопка на линии полей --- */
.filters form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.filters form > .block_form { margin: 0 !important; }
.filters form > .block_form > label { padding: 0 0 6px !important; display: block; }
.filters form > .block_form:last-child { flex-direction: row; align-items: center; gap: 14px; }
.filters form > .block_form:last-child > label { padding: 0 !important; order: 2; }
.filters form > .block_form:last-child > br { display: none; }
.filters form input, .filters form select { height: 42px; box-sizing: border-box; margin: 0; }

/* --- Фильтры «Платежей» и «Групп» --- */
.actions-header { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.actions-header .filters { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 0; }
.actions-header .filter-group { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.actions-header .filter-group label { padding: 0; font-size: 13px !important; font-weight: 500 !important; color: var(--text-muted); }
.actions-header .filter-group input { height: 42px; box-sizing: border-box; margin: 0; }
.actions-header .filters > .btn { margin: 0 !important; }
.actions-header > a.btn, .actions-header > .btn { margin: 0 0 18px !important; }
form.filter { width: 100%; max-width: none; }
.filter .filter_form { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.filter .filter_form > div { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; }
.filter .filter_form > div > p { margin: 0; padding: 0; }
.filter .filter_form select { width: 100%; height: 42px; margin: 0; }
.filter > .block_cat { display: block !important; width: 100% !important; box-sizing: border-box; }
@media (max-width: 600px) {
    .filters form > .block_form, .actions-header .filter-group { width: 100%; }
    .filters form > .block_form input, .filters form > .block_form select, .actions-header .filter-group input { width: 100% !important; }
}

/* --- Кнопка «Удалить занятие»: опасное действие, но не основное --- */
.content .btn-danger-outline, .content button.btn-danger-outline[type=submit] {
    background: transparent !important; color: var(--danger) !important; border: 1px solid var(--danger) !important;
    margin-left: auto !important;
}
.content .btn-danger-outline:hover { background: var(--danger) !important; color: #fff !important; }

/* --- Настройки CRM --- */
.crm-settings-card { margin-bottom: 16px; max-width: 760px; }
.crm-settings-card h3 { margin: 0 0 12px; }
.crm-field { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px !important; font-size: 13px; font-weight: 500; color: var(--text-muted); max-width: 420px; }
.crm-field input, .crm-field select { height: 42px; margin: 0; width: 100%; box-sizing: border-box; }
.crm-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px !important; margin: 0 0 8px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; max-width: 560px; }
.crm-radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.crm-radio span { display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.crm-radio small { color: var(--text-muted); }
.crm-check { display: flex; gap: 8px; align-items: flex-start; padding: 0 0 10px !important; font-size: 13px; color: var(--text); max-width: 620px; }
.crm-sms { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

/* --- Расписание педагога --- */
.sched-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.sched-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.sched-day.is-today { border-color: var(--primary); }
.sched-day-name { font-weight: 600; font-size: 14px; }
.sched-day-name small { color: var(--primary); font-weight: 500; margin-left: 4px; }
.sched-free { color: var(--text-muted); font-size: 13px; }
.sched-slot { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--primary); text-decoration: none; color: var(--text); }
.sched-slot:hover { background: var(--primary-soft); }
.sched-time { font-weight: 600; font-size: 14px; }
.sched-group { font-size: 13px; }
.sched-group em { font-style: normal; font-size: 11px; color: var(--primary); margin-left: 4px; }
.sched-meta { font-size: 12px; color: var(--text-muted); }
.sched-meta b { color: var(--text); }
.sched-cabs td, .sched-cabs th { vertical-align: top; min-width: 90px; }
.sched-cabs .is-today { background: var(--primary-soft); }
.sched-cell { font-size: 13px; padding: 2px 0; }
form.crm-settings { display: block !important; max-width: none; margin: 0 !important; }
form.crm-settings > button[type=submit] { margin-top: 4px; }
.refund-form .button, .refund-form button[type=submit] { width: auto !important; align-self: flex-start; }

/* --- Логотип: как на странице входа (WS + Crm акцентом), ссылка на главную --- */
header .logo .logo-link { color: var(--header-text); text-decoration: none; text-transform: none; letter-spacing: .04em; font-weight: 800; }
header .logo .logo-link span { color: var(--primary); }
header .logo .logo-link:hover { opacity: .85; }

/* --- Заголовок страницы в .header-actions (карточка группы) — по сетке, а не у левого края экрана --- */
.header-name > .header-actions { display: block; max-width: 1300px; margin: 0 auto; }
.crm-check-strong { padding: 10px 12px !important; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }

/* --- Карточка преподавателя: статистика отдельным блоком под формой --- */
.teacher-stats-section { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--border); }
.teacher-stats-section > .section-title:first-child { margin-top: 16px; }
.group-list > .group-card .group-card-time { font: inherit !important; color: inherit !important; margin-left: 6px; }

/* --- Новый студент: все разделы по одной сетке из 5 столбцов --- */
.student-form .block_cat { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 16px; align-items: end; margin: 0 0 22px; }
.student-form .block_cat > p { grid-column: 1 / -1; margin: 0; font-size: 15px; font-weight: 600; color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.student-form .block_form { width: auto; min-width: 0; }
.student-form .block_form input, .student-form .block_form select { width: 100% !important; }
.student-form .block_form-full { grid-column: 1 / -1; }
.student-form .block_form-full textarea { width: 100%; min-height: 80px; box-sizing: border-box; }
@media (max-width: 900px) { .student-form .block_cat { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .student-form .block_cat { grid-template-columns: 1fr; } }

/* --- Архив групп --- */
.group-archive-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: flex-end; max-width: 1300px; margin: 0 auto 10px; }
.group-archive-bar.is-archived { justify-content: space-between; padding: 10px 14px; border: 1px solid var(--warning); border-radius: var(--radius); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.group-archive-bar form { margin: 0 !important; }
.format-tabs .format-tab-archive { margin-left: auto; }
.former-title { margin-top: 24px !important; }
.group-archive-bar { box-sizing: border-box; width: calc(100% - 40px); max-width: 1260px; }
@media (max-width: 760px) { .group-archive-bar { width: calc(100% - 32px); } }
.crm-update { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--border); max-width: none; }
.delete-hint { margin-left: auto; font-size: 13px; align-self: center; }

/* --- Расписание в личном кабинете: на телефоне дни без занятий не показываем --- */
.lk-schedule .sched-week { margin-top: 4px; }
@media (max-width: 600px) { .sched-day.is-empty { display: none; } }
.content select[name=ls_status] { min-width: 170px; }
.content select[name=ls_status] { min-width: 200px !important; }
.content.teacher select#ls_status, .teacher select#ls_status { min-width: 190px !important; max-width: none !important; }
@media (max-width: 650px) { .content.teacher select#ls_status, .teacher select#ls_status { min-width: 100% !important; } }
.content.teacher form .block_cat > .block_form:nth-child(4) { width: auto !important; flex: 1 1 240px; }
.phone-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 12px; font-size: 14px; color: var(--text-muted); }
.phone-stats b { color: var(--text); }
.phone-stats b.text-danger { color: var(--danger); }

/* --- Зарплатные сетки: ровные кнопки и поля --- */
.usluga-table td.usluga-actions { display: table-cell !important; text-align: right; }
.usluga-btns { display: inline-flex; gap: 16px; align-items: center; justify-content: flex-end; }
.usluga-btns form { margin: 0; display: inline-flex; }
.usluga-btns .link-btn { line-height: 1.4; vertical-align: middle; }
.setka-form input { height: 42px; box-sizing: border-box; }
.stavka-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stavka-actions .btn, .stavka-actions form { margin: 0 !important; }
.inline-form { display: inline-flex; margin: 0; }

/* --- Счётчики студентов в группе: одинаковые ровные плашки --- */
.kol-badges { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; }
.kol_stud, .kol_not_stud { float: none !important; margin: 0 !important; padding: 0 !important;
  display: inline-flex !important; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; width: auto !important; box-sizing: border-box; padding: 0 6px !important;
  font-weight: 600; font-size: 14px; line-height: 1; border-radius: 8px; }

/* Шапка сетки: название и даты одной строкой, одинаковой высоты */
.setka-form form { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px 16px; align-items: start; }
.setka-form .form-row, .setka-form .form-row-inline, .setka-form .form-row-inline > div { margin: 0 !important; padding: 0 !important; }
.setka-form .form-row-inline { display: contents !important; }
.setka-form form > div:last-child { grid-column: 1 / -1; }
.setka-form label { display: block; margin: 0 0 6px !important; }
.setka-form input[type=text], .setka-form input[type=date] { width: 100% !important; max-width: none !important; height: 42px !important; margin: 0 !important; box-sizing: border-box; }
.setka-form .info-text { margin-top: 6px; }
@media (max-width: 760px) { .setka-form form { grid-template-columns: 1fr; } }
.usluga-btns .link-btn { padding: 0 !important; margin: 0 !important; height: auto !important; line-height: 20px !important; font-size: 14px !important; border: 0 !important; }
.kol-badges { display: flex !important; margin: 0; }
.usluga-btns .link-btn, .content .usluga-btns button.link-btn[type=submit] { font: inherit !important; font-size: 14px !important; line-height: 20px !important; letter-spacing: normal !important; text-transform: none !important; padding: 0 !important; margin: 0 !important; min-height: 0 !important; height: 20px !important; display: inline-flex !important; align-items: center; background: none !important; box-shadow: none !important; }
