/* ============================================================
   Новый дизайн: верхнее меню-«пилюли», доска дел, уровни сегментами,
   синий + жёлтый, шрифт Onest. Подключается ПОВЕРХ style.css и только у тех,
   кто на него перешёл (см. includes/design.php и includes/header.php).
   Ссылки, формы и логика те же, поэтому старый дизайн возвращается одной
   кнопкой. Тёмной темы здесь нет.
   ============================================================ */
:root {
    --bg: #f4f7fd;
    --surface: #ffffff;
    --surface-2: #eef2fb;
    --border: #e4eaf6;
    --text: #15213b;
    --muted: #5a6680;
    --accent: #3457d5;
    --accent-dark: #2643b0;
    --accent-bg: #e6ecfd;

    /* Жёлтый — только «сейчас / сегодня / прогресс». Текст на нём всегда тёмный */
    --yellow: #ffc93c;
    --yellow-dark: #e0a800;
    --yellow-bg: #fff4d1;
    --yellow-text: #6e4d00;

    --radius-xs: 12px;
    --radius-sm: 16px;
    --radius: 22px;
    --radius-lg: 26px;

    --shadow: 0 1px 2px rgba(21, 33, 59, .04), 0 10px 26px rgba(21, 33, 59, .06);
    --shadow-lift: 0 16px 36px rgba(21, 33, 59, .13);
}

/* Один шрифт везде, включая кнопки и поля: сами они его от body не наследуют */
body, button, input, select, textarea, optgroup {
    font-family: "Onest", "Segoe UI", Roboto, Arial, sans-serif;
}
body { font-weight: 500; font-size: 15px; font-feature-settings: normal; }
h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; }
b, strong { font-weight: 700; }

/* Тёмной темы нет */
.theme-toggle, .theme-toggle-trigger { display: none !important; }

/* ===== Верхнее меню ===== */
.site-header { border-bottom: 0; box-shadow: 0 1px 0 var(--border); }
.header-inner { max-width: 1180px; padding: 12px 24px; flex-wrap: nowrap; justify-content: flex-start; gap: 20px; }
.site-main { max-width: 1180px; padding: 26px 24px 60px; }
.header-right { flex: 1; min-width: 0; gap: 10px; }
.brand-new {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    white-space: nowrap;
}
.brand-new span { background: var(--yellow); border-radius: 9px; padding: 0 7px; }
.main-nav { flex: 1; min-width: 0; flex-wrap: nowrap; gap: 2px; }
.nav-user { display: none; }
.main-nav > .nav-link > .nav-icon,
.main-nav > .nav-dropdown > summary.nav-link > .nav-icon { display: none; }
.nav-link { font-weight: 600; padding: 9px 15px; border-radius: 999px; color: #46536e; }
.nav-link:hover, .main-nav a:hover { background: var(--accent-bg); color: var(--accent-dark); }
.nav-link[aria-current="page"], .nav-link.is-active { background: var(--accent); color: #ffffff; font-weight: 700; }
.nav-link[aria-current="page"]:hover, .nav-link.is-active:hover { background: var(--accent-dark); color: #ffffff; }

/* Кнопка «Добавить» */
.nav-plus { order: 10; margin-left: auto; }
.nav-plus > summary.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--text);
    color: #ffffff;
    font-weight: 700;
}
.nav-plus > summary.nav-link:hover { background: #26365c; color: #ffffff; }
.nav-plus-icon { font-size: 18px; line-height: 1; font-weight: 700; }
.nav-plus-menu { min-width: 300px; }
.nav-plus-select {
    margin: 2px 0 6px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    width: 100%;
}

/* Лист «Ещё» */
.nav-dropdown-menu { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lift); padding: 8px; }
.nav-dropdown-menu a, .nav-dropdown-theme { border-radius: 12px; font-weight: 600; }
.nav-dropdown-menu a.is-active { background: var(--accent-bg); color: var(--accent-dark); }
.nav-dropdown-group { font-weight: 700; }

/* ===== Заголовки ===== */
.page-head { align-items: center; margin-bottom: 18px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.section-title { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-transform: none; color: var(--text); }
.back-link { font-weight: 700; color: var(--accent-dark); }
.back-link:hover { color: var(--accent); }

/* ===== Кнопки ===== */
.btn { border: 0; border-radius: 999px; font-weight: 700; padding: 11px 18px; }
.btn-primary { background: var(--accent); box-shadow: 0 8px 18px rgba(52, 87, 213, .22); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--accent-bg); color: var(--accent-dark); }
.btn-ghost:hover { background: #d8e1fb; border-color: transparent; color: var(--accent-dark); }
.btn-danger { background: #fdeaea; color: #b91c1c; }
.btn-danger:hover { background: #fbdcdc; color: #b91c1c; }
.btn-sm { border-radius: 999px; padding: 7px 13px; font-size: 13px; }

/* ===== Поля ===== */
form input[type=text],
form input[type=password],
form input[type=date],
form input[type=time],
form input[type=number],
form input[type=url],
form input[type=file],
form select,
form textarea {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    font-weight: 500;
}
form label { font-weight: 700; color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ===== Плашки ===== */
.form-card, .auth-box, .today-block, .student-card, .track-card, .moodle-block, .empty-block, .chart-card, .dlc {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: #ffffff;
}
.form-card { max-width: 680px; padding: 24px; }
.stat-chip { border: 0; box-shadow: var(--shadow); font-weight: 500; }
.stat-chip b { font-weight: 800; }
a.stat-chip:hover { box-shadow: var(--shadow-lift); }
.badge { border-radius: 999px; font-weight: 700; }
.notes-box { border: 0; border-radius: 18px; background: var(--accent-bg); }
.alert { border-radius: 18px; font-weight: 500; }
.alert-warning { background: var(--yellow-bg); color: var(--yellow-text); }
.insight-card { border: 0; border-radius: 18px; box-shadow: var(--shadow); background: #ffffff; }
.progress-bar-fill { background: var(--accent); }
.quick-chip { border-radius: 999px; font-weight: 600; }
.chart-title { font-weight: 800; }

/* Вкладки — тёмная активная пилюля */
.view-tabs { background: #ffffff; border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.view-tabs a, .view-tabs .tab-active { font-weight: 600; border-radius: 999px; }
.view-tabs .tab-active { background: var(--text); color: #ffffff; font-weight: 700; }

/* Поиск и фильтры — одной строкой, без подложки */
.toolbar { background: none; box-shadow: none; border: 0; padding: 0; }
.toolbar input[type=text], .toolbar select { border-radius: 999px; }

/* Ученики — карточки в две колонки */
.student-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.student-card { margin: 0; padding: 18px; }
.student-card:hover { box-shadow: var(--shadow-lift); }
.student-name a { font-weight: 800; font-size: 16px; color: var(--text); }
.avatar, .avatar-sm { background: var(--accent-bg); color: var(--accent-dark); font-weight: 800; }
.student-actions { border-top: 1px solid var(--surface-2); padding-top: 10px; }
.student-actions a { font-weight: 600; }

/* Плашки профиля */
.info-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: stretch; }
.info-pill {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    border: 0;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
}
.info-pill .pill-label { font-size: 12.5px; font-weight: 600; }
.info-pill .pill-value { font-size: 21px; font-weight: 800; }
.info-pill.pill-warn { background: var(--yellow-bg); }
.info-pill.pill-warn .pill-label, .info-pill.pill-warn .pill-value { color: var(--yellow-text); }
.info-pill.pill-today { background: var(--accent); }
.info-pill.pill-today .pill-label { color: #dce5ff; }
.info-pill.pill-today .pill-value { color: #ffffff; }
.donut-wrap { background: #ffffff; border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow); }

/* Трек на странице ученика у преподавателя */
.track-card { background: var(--yellow-bg); }
.track-card-kicker, .track-card-points, .track-card-points .muted, .track-card-pct { color: var(--yellow-text); }
.track-card .track-bar { background: #ffffff; }
.track-card .track-bar-fill { background: var(--yellow-dark); }
.track-card-name { font-weight: 800; }
.track-head { background: var(--accent); }

.impersonate-bar { background: var(--yellow); color: var(--text); font-weight: 600; }
.impersonate-exit { color: var(--accent-dark) !important; }

/* ===== Таблицы: единая белая карточка ===== */
.simple-table, .data-table { border: 0; border-radius: 20px; box-shadow: var(--shadow); background: #ffffff; }
.simple-table th, .data-table th { background: none; font-weight: 700; }
.lessons-table { border-spacing: 0; background: #ffffff; border-radius: 20px; box-shadow: var(--shadow); }
.lessons-table thead th { background: none; font-weight: 700; }
.lessons-table tbody tr { box-shadow: none; background: none; }
.lessons-table tbody td { border-top: 1px solid var(--surface-2); background: none; }
.lessons-table tbody td:first-child, .lessons-table tbody td:last-child { border-radius: 0; }
.topic-line { font-weight: 700; }

/* ===== Расписание ===== */
.cal-day { border: 0; border-radius: 14px; box-shadow: 0 1px 2px rgba(21, 33, 59, .05); }
.cal-past { background: #f8fafe; }
.cal-today { background: var(--yellow-bg); box-shadow: inset 0 0 0 2px var(--yellow); }
.cal-today .cal-date { color: var(--text); font-weight: 800; }
.cal-slot { border-radius: 9px; font-weight: 600; }
.cal-pop { border-radius: var(--radius); }

/* ===== «Сегодня»: приветствие, следующее занятие, неделя ===== */
.dn-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; margin-bottom: 14px; }
.dn-day {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
}
.dn-ring { flex: none; width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dn-ring > span {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: #ffffff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.15;
}
.dn-ring b { font-size: 22px; font-weight: 800; color: var(--text); }
.dn-day-date { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.dn-day h1 { margin: 2px 0 10px; font-size: 26px; line-height: 1.15; }
.dn-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dn-chip { font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 4px 11px; background: var(--surface-2); color: var(--text); }
.dn-chip:hover { text-decoration: none; }
.dn-chip.is-ok { background: #e1f6e7; color: #14612f; }
.dn-chip.is-warn { background: var(--yellow-bg); color: var(--yellow-text); }

.dn-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 22px 26px;
    border-radius: var(--radius);
    background: var(--accent);
    box-shadow: 0 14px 30px rgba(52, 87, 213, .24);
    color: #ffffff;
    min-width: 0;
}
.dn-hero-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #dce5ff; }
.dn-hero-tag { background: var(--yellow); color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 700; }
.dn-hero-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.dn-hero-time { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.dn-hero-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.dn-hero-sub { font-size: 14px; color: #dce5ff; }
.dn-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dn-hero .btn-primary { background: #ffffff; color: var(--accent-dark); box-shadow: none; }
.dn-hero .btn-primary:hover { background: var(--yellow); color: var(--text); }
.dn-hero .btn-ghost { background: rgba(255, 255, 255, .17); color: #ffffff; }
.dn-hero .btn-ghost:hover { background: rgba(255, 255, 255, .27); color: #ffffff; }
.dn-hero-bar { max-width: 380px; height: 7px; margin-top: 8px; border-radius: 6px; background: rgba(255, 255, 255, .25); }
.dn-hero-bar > span { display: block; height: 100%; border-radius: 6px; background: var(--yellow); }

.dn-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.dn-week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 10px 4px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(21, 33, 59, .05);
    color: var(--text);
}
.dn-week-day:hover { text-decoration: none; background: var(--accent-bg); color: var(--text); }
.dn-week-day small { font-size: 12px; font-weight: 600; color: var(--muted); }
.dn-week-day b { font-size: 20px; font-weight: 800; line-height: 1.15; }
.dn-week-day i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.dn-week-day.is-today, .dn-week-day.is-today:hover { background: var(--accent); color: #ffffff; box-shadow: 0 10px 22px rgba(52, 87, 213, .28); }
.dn-week-day.is-today small, .dn-week-day.is-today i { color: #dce5ff; }

/* ===== Доска дел: колонки вместо блоков ===== */
.dn-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; margin-bottom: 16px; }
.dn-board .today-grid { display: contents; }
.dn-board .today-grid:first-child { display: flex; flex-direction: column; gap: 12px; margin: 0; min-width: 0; }
.dn-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dn-board .today-block { margin: 0; padding: 12px; min-width: 0; border-radius: 20px; background: #e9eefa; box-shadow: none; }
.dn-board .today-block-title { margin: 2px 4px 10px; font-size: 15px; font-weight: 800; }
.dn-board .today-list { gap: 8px; }
.dn-board .today-row {
    flex-wrap: wrap;
    padding: 11px 12px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(21, 33, 59, .05);
}
.dn-board .today-row-done { background: #f1faf3; }
.dn-board .today-row-off, .dn-board .today-row-no_show { background: #fff5f5; }
.dn-board .today-row-moved { background: #fff9ec; }
.dn-board .today-row-main { flex: 1 1 100%; min-width: 0; }
.dn-board .today-row-main-line { flex-wrap: wrap; gap: 2px 8px; }
.dn-board .today-time { font-size: 13px; font-weight: 700; color: var(--accent-dark); }
.dn-board .today-name { font-weight: 700; }
.dn-board .today-row > .today-sub { white-space: normal; text-align: left; }
.dn-board .empty-state { margin: 4px; padding: 14px 10px; background: rgba(255, 255, 255, .7); border-radius: 14px; text-align: center; font-size: 13.5px; }
.today-block-title { font-weight: 800; text-transform: none; letter-spacing: -0.01em; font-size: 17px; color: var(--text); }

/* ===== Главная ученика ===== */
.dn-level-chip { display: inline-block; vertical-align: middle; font-size: 13px; font-weight: 700; background: var(--yellow); border-radius: 999px; padding: 3px 11px; letter-spacing: 0; }
.dn-rows { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; margin-bottom: 14px; }
.dn-card { padding: 20px; background: #ffffff; border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.dn-card h2 { margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.dn-rows .dn-hero-time { font-size: 40px; }
.dn-empty { font-size: 14px; color: var(--muted); }
.dn-task { display: flex; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 14px; font-size: 14px; color: var(--text); }
.dn-task::before { content: ""; flex: none; width: 6px; border-radius: 4px; background: #9aa3b5; }
.dn-task b { display: block; font-weight: 700; }
.dn-task small { font-size: 12.5px; font-weight: 600; }
.dn-task-redo { background: #efe9fd; } .dn-task-redo::before { background: #8b5cf6; } .dn-task-redo small { color: #6d28d9; }
.dn-task-not_done { background: var(--yellow-bg); } .dn-task-not_done::before { background: var(--yellow); } .dn-task-not_done small { color: var(--yellow-text); }
.dn-task-pending { background: var(--surface-2); } .dn-task-pending small { color: var(--muted); }
.dn-more { font-size: 13.5px; font-weight: 700; color: var(--accent-dark); }

.dn-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.dn-tile { padding: 14px 18px; border-radius: 18px; background: #ffffff; box-shadow: var(--shadow); min-width: 0; }
.dn-tile small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dn-tile b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.dn-tile b span { font-size: 15px; font-weight: 600; color: var(--muted); }
.dn-tile.is-ok { background: #e1f6e7; } .dn-tile.is-ok small, .dn-tile.is-ok b { color: #14612f; }
.dn-tile.is-warn { background: var(--yellow-bg); } .dn-tile.is-warn small, .dn-tile.is-warn b { color: var(--yellow-text); }
.dn-tile-ring { display: flex; align-items: center; gap: 12px; }
.dn-tile-ring > i { flex: none; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; }
.dn-tile-ring > i > span { width: 38px; height: 38px; border-radius: 50%; background: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--text); }

/* Уровни сегментами */
.dn-track { display: block; width: 100%; margin: 0 0 14px; padding: 18px 20px; border: 0; border-radius: var(--radius); background: #ffffff; box-shadow: var(--shadow); color: var(--text); text-align: left; cursor: pointer; }
.dn-track:hover { box-shadow: var(--shadow-lift); }
.dn-track-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
.dn-track-points { font-size: 14px; font-weight: 500; color: var(--muted); }
.dn-track-link { margin-left: auto; font-size: 13.5px; font-weight: 700; color: var(--accent-dark); }
.dn-track-line { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.dn-seg-bar { display: block; height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.dn-seg-bar > span { display: block; height: 100%; }
.dn-seg-done .dn-seg-bar > span { width: 100%; background: var(--accent); }
.dn-seg-now .dn-seg-bar > span { background: var(--yellow); }
.dn-seg-name { display: block; margin-top: 6px; font-size: 13px; font-weight: 700; line-height: 1.2; }
.dn-seg-need { display: block; font-size: 12px; color: var(--muted); }
.dn-seg-next .dn-seg-name, .dn-seg-locked .dn-seg-name { color: var(--muted); font-weight: 600; }

/* ===== Пробники и дедлайны: плашки сверху ===== */
.dn-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.dn-kpi { padding: 16px 20px; border-radius: var(--radius); background: #ffffff; box-shadow: var(--shadow); min-width: 0; }
.dn-kpi small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.dn-kpi b { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.dn-kpi b span { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.dn-kpi em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.dn-kpi.is-main { background: var(--accent); color: #ffffff; }
.dn-kpi.is-main small, .dn-kpi.is-main b span { color: #dce5ff; }
.dn-kpi em.dn-kpi-tag { display: inline-block; background: var(--yellow); color: var(--text); border-radius: 999px; padding: 1px 9px; font-weight: 700; }
.dn-kpi .is-up { color: #15803d; }
.dn-sum { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--radius); background: #ffffff; box-shadow: var(--shadow); }
.dn-sum > i { flex: none; width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; }
.dn-sum > i > span { width: 44px; height: 44px; border-radius: 50%; background: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 800; }
.dn-sum b { display: block; font-size: 17px; font-weight: 800; }
.dn-sum small { font-size: 13px; color: var(--muted); }
.dlc { margin-bottom: 12px; }
.dlc-name { font-weight: 800; }
.dl-course { font-weight: 700; }

/* Фото профиля: значок камеры показывает, что можно сменить */
.avatar-edit::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-sizing: border-box;
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l2-3h6l2 3h3v11H4z'/%3E%3Ccircle cx='12' cy='13' r='3.5'/%3E%3C/svg%3E") center / 12px no-repeat;
    pointer-events: none;
}
.avatar-edit-overlay { font-size: 10px; }
.dn-level-chip { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.dn-level-chip svg { width: 22px; height: 22px; flex: none; }

/* Посещаемость: подпись помещается рядом с кольцом */
.info-bar { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.donut-wrap { gap: 10px; min-width: 0; padding: 10px 12px; }
.donut { width: 54px; height: 54px; }
.donut-hole { width: 42px; height: 42px; }
.donut-hole span { font-size: 12.5px; }
.donut-caption { font-size: 12.5px; min-width: 0; }

/* Сдать до занятия: длинный текст переносится, нажатие ведёт к уроку */
a.dn-task { align-items: stretch; }
a.dn-task:hover { text-decoration: none; filter: brightness(.97); color: var(--text); }
.dn-task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dn-task-text b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; line-height: 1.3; }
.dn-task-go { flex: none; align-self: center; font-weight: 800; color: var(--muted); }
/* Урок, к которому перешли из «Сдать до занятия»: мягкая жёлтая заливка всей строки, без рамок */
@keyframes dn-flash { 0%, 50% { background-color: var(--yellow-bg); } 100% { background-color: transparent; } }
.dn-flash > td, tr.dn-flash { animation: dn-flash 2.6s ease-out; }
.dn-flash > td { border-color: transparent; }

/* Трек: значки уровней над сегментами */
.dn-seg-icon { display: flex; height: 34px; margin-bottom: 6px; }
.dn-seg-icon svg { width: 34px; height: 34px; }
.dn-seg-locked .dn-seg-icon { opacity: .35; filter: grayscale(1); }
.dn-seg-now .dn-seg-name { font-weight: 800; }
.dn-seg-locked .dn-seg-name { color: var(--muted); font-weight: 600; }
.dn-track-foot { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--surface-2); font-size: 13.5px; color: var(--muted); }
.dn-track-foot b { color: var(--text); }

/* Уровни в карточке ученика */
.dn-lvl { display: inline-block; vertical-align: middle; border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; }
.dn-lvl-0 { background: #eef1f6; color: #4a5568; }
.dn-lvl-1 { background: #f6e3d3; color: #7a3e12; }
.dn-lvl-2 { background: #e5e9f0; color: #374151; }
.dn-lvl-3 { background: var(--yellow); color: var(--text); }
.dn-lvl-4 { background: #dbeafe; color: #1e3a8a; }

/* Рост к предыдущему пробнику */
.dn-diff { display: inline-block; margin-left: 4px; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.dn-diff.is-up { background: #e1f6e7; color: #14612f; }
.dn-diff.is-down { background: #fdeaea; color: #b91c1c; }

/* ===== Платежи и пропуски ===== */
.dn-pay { padding: 20px 24px; margin-bottom: 12px; border-radius: var(--radius); }
.dn-pay small { display: block; font-size: 13.5px; font-weight: 700; }
.dn-pay b { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.dn-pay.is-debt { background: var(--yellow-bg); color: var(--yellow-text); }
.dn-pay.is-ok { background: #e1f6e7; color: #14612f; }
.dn-tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dn-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dn-list { padding: 4px 18px; border-radius: var(--radius); background: #ffffff; box-shadow: var(--shadow); }
.dn-list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--surface-2); }
.dn-list-row:first-child { border-top: 0; }
.dn-list-check { flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: #e1f6e7; color: #14612f; font-weight: 800; }
.dn-list-main { min-width: 0; overflow-wrap: anywhere; }
.dn-list-main b { display: block; font-weight: 800; }
.dn-list-main small { font-size: 13px; color: var(--muted); }
.dn-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.dn-event { padding: 14px 16px; border-radius: 20px; background: #ffffff; box-shadow: var(--shadow); min-width: 0; }
.dn-event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dn-event-who { font-size: 12.5px; color: var(--muted); }
.dn-event-date { margin-left: auto; font-size: 13px; font-weight: 700; }
.dn-event-body { margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; }
.dn-event-body:empty { display: none; }
.dn-event-action { margin: 12px 0 0; }
.dn-event-action .btn { width: 100%; }

/* ===== Форма занятия: две колонки, статусы кнопками ===== */
.dn-form {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 16px;
    align-items: start;
    max-width: none;
    padding: 0;
    background: none;
    box-shadow: none;
}
.dn-form-main, .dn-form-side { padding: 22px; border-radius: var(--radius); background: #ffffff; box-shadow: var(--shadow); min-width: 0; }
.dn-form-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.dn-form-main > * { grid-column: 1 / -1; }
.dn-form-main > label:nth-of-type(-n+2) { grid-column: auto; }
.dn-form-side { position: sticky; top: 76px; }
.dn-form .field-hint { display: block; margin-top: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.dn-form-side > .btn-primary { width: 100%; padding: 14px; font-size: 16px; }
.plan-picker-box { border: 0; border-radius: 16px; background: var(--accent-bg); }
.dn-select-hidden { display: none !important; }
.dn-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dn-opt {
    padding: 8px 13px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.dn-opt:hover { background: var(--accent-bg); }
.dn-opt.is-on { background: var(--accent); color: #ffffff; font-weight: 700; }
.dn-opts-grade .dn-opt { flex: 1; min-width: 44px; padding: 10px 0; text-align: center; border-radius: 12px; }
.dn-opts-payment_status .dn-opt { flex: 1; text-align: center; }
.dn-opts-homework_done .dn-opt[data-value="done"].is-on, .dn-opts-payment_status .dn-opt[data-value="paid"].is-on { background: #e1f6e7; border-color: #16a34a; color: #14612f; }
.dn-opts-homework_done .dn-opt[data-value="late"].is-on { background: #fbf0dc; border-color: #e0993c; color: #7c4a03; }
.dn-opts-homework_done .dn-opt[data-value="not_done"].is-on, .dn-opts-payment_status .dn-opt[data-value="unpaid"].is-on { background: #fdeaea; border-color: #dc2626; color: #991b1b; }
.dn-opts-homework_done .dn-opt[data-value="redo"].is-on { background: #efe9fd; border-color: #8b5cf6; color: #6d28d9; }
.hw-level-opt span { border-radius: 999px; }

/* ===== Платежи и отмены у преподавателя: форма слева, история справа ===== */
.dn-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.dn-split-main { min-width: 0; }
.dn-form-card { max-width: none; margin: 0; position: sticky; top: 76px; }
.dn-form-card h2 { margin: 0 0 14px; }
.dn-wide { width: 100%; padding: 13px; }
.dn-fill { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.dn-list-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.dn-list-actions form { margin: 0; }
.dn-list-row { flex-wrap: nowrap; }
.dn-icon-btn { width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: pointer; }
.dn-icon-btn:hover { background: #fdeaea; color: #b91c1c; }
.dn-events-1 { grid-template-columns: minmax(0, 1fr); }
.dn-event-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.dn-event-foot form { margin: 0; }
.dn-event-foot:empty { display: none; }
.dn-event-spacer { flex: 1; }
.dn-event-foot .danger-link { font-size: 13px; font-weight: 600; }
.dn-form.dn-form-card { display: block; padding: 22px; background: #ffffff; box-shadow: var(--shadow); }
.dn-opts-type .dn-opt { flex: 1; text-align: center; }
.dn-opts-initiated_by .dn-opt { flex: 1 1 100%; text-align: left; border-radius: 14px; }
.dn-opts-type .dn-opt[data-value="cancelled"].is-on { background: #fdeaea; border-color: #dc2626; color: #991b1b; }
.dn-opts-type .dn-opt[data-value="rescheduled"].is-on { background: #fbf0dc; border-color: #e0993c; color: #7c4a03; }
.dn-member { gap: 10px; flex-wrap: wrap; }
.dn-member .dn-opts { margin-top: 0; flex: none; }
.dn-opts-member_status .dn-opt[data-value="attended"].is-on { background: #e1f6e7; border-color: #16a34a; color: #14612f; }
.dn-opts-member_status .dn-opt[data-value="no_show"].is-on { background: #fdeaea; border-color: #dc2626; color: #991b1b; }

/* ===== Вход как в проекте: слева синяя панель, справа форма ===== */
.dn-login {
    display: flex; flex-wrap: wrap;
    max-width: 960px; margin: 6vh auto 30px;
    border-radius: 30px; overflow: hidden;
    background: #ffffff; box-shadow: 0 20px 48px rgba(21, 33, 59, .14);
}
.dn-login-hero {
    position: relative; overflow: hidden;
    flex: 1 1 380px; display: flex; flex-direction: column; gap: 14px;
    padding: 40px; background: var(--accent); color: #ffffff;
}
.dn-login-hero::after {
    content: ""; position: absolute; right: -70px; bottom: -70px;
    width: 220px; height: 220px; border-radius: 50%;
    border: 36px solid rgba(255, 201, 60, .35);
}
.dn-login-hero > * { position: relative; z-index: 1; }
.dn-login-logo { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.dn-login-logo span { background: var(--yellow); color: var(--text); border-radius: 9px; padding: 0 7px; }
.dn-login-hero h2 { margin: 26px 0 0; font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; color: #ffffff; }
.dn-login-hero p { margin: 0; color: #dce5ff; font-size: 15.5px; max-width: 340px; }
.dn-login-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 20px; position: relative; z-index: 1; }
.dn-login-chips span { background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.dn-login-chips span.is-yellow { background: var(--yellow); color: var(--text); }
.dn-login .auth-box { flex: 1 1 360px; margin: 0; max-width: none; padding: 44px 40px; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
body:has(.dn-login) .site-header { display: none; }

/* ===== Вход и восстановление пароля ===== */
body:not([class*="role-"]) .auth-box { border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); padding: 28px; }
body:not([class*="role-"]) .auth-box h1 { font-size: 26px; }

.dn-board .today-row-actions { flex: 1 1 100%; flex-wrap: wrap; }
@media (max-width: 1100px) {
    .dn-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}



/* ===== Телефон: нижняя панель с жёлтым плюсом ===== */
@media (max-width: 760px), ((max-height: 480px) and (hover: none) and (pointer: coarse)) {
    .site-main { padding: 18px 14px 26px; }
    .header-inner { justify-content: space-between; padding: 10px 14px; }
    .header-right { flex: 0 1 auto; }
    .brand-new { font-size: 20px; }

    .main-nav { flex: none; padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 22px rgba(21, 33, 59, .08); }
    .main-nav > .nav-link > .nav-icon,
    .main-nav > .nav-dropdown > summary.nav-link > .nav-icon { display: block; }
    .main-nav .nav-link { background: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 6px 2px; }
    .main-nav .nav-link .nav-icon { padding: 2px 0; background: none; }
    .main-nav .nav-link:hover { background: none; color: var(--muted); }
    .main-nav .nav-link[aria-current="page"], .main-nav .nav-link.is-active,
    .main-nav .nav-link[aria-current="page"]:hover, .main-nav .nav-link.is-active:hover { background: var(--accent-bg); color: var(--accent-dark); border-radius: 14px; }
    .main-nav .nav-link.is-active .nav-icon { background: none; color: var(--accent-dark); }
    .main-nav .nav-link.is-active span { font-weight: 800; }
    .main-nav .nav-link.is-pressed .nav-icon { background: none; }
    .nav-dropdown[open] > summary { background: none; }
    .nav-dropdown[open] > summary .nav-icon { background: none; }

    .main-nav .nav-plus { order: 0; margin: 0; flex: 0 0 66px; }
    .main-nav .nav-plus > summary.nav-link,
    .main-nav .nav-plus > summary.nav-link:hover { background: none; padding: 0; overflow: visible; }
    .main-nav .nav-plus .nav-plus-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 54px;
        height: 54px;
        margin-top: -14px;
        max-width: none;
        overflow: visible;
        border-radius: 18px;
        background: var(--yellow);
        color: var(--text);
        font-size: 30px;
        box-shadow: 0 8px 18px rgba(224, 168, 0, .38);
    }
    .main-nav .nav-plus-label { display: none; }
    .main-nav .nav-plus-select { font-size: 16px; }

    .page-head h1 { font-size: 25px; }
    .student-list { grid-template-columns: minmax(0, 1fr); }
    .info-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }


    .dn-top { grid-template-columns: minmax(0, 1fr); }
    .dn-top .dn-hero { order: -1; }
    .dn-hero { padding: 18px; }
    .dn-hero-time, .dn-rows .dn-hero-time { font-size: 32px; }
    .dn-hero-actions .btn { flex: 1 1 auto; text-align: center; }
    .dn-day { padding: 14px 16px; gap: 14px; }
    .dn-ring { width: 72px; height: 72px; }
    .dn-ring > span { width: 56px; height: 56px; font-size: 0; }
    .dn-ring b { font-size: 18px; }
    .dn-day h1 { font-size: 21px; }
    .dn-week { gap: 4px; }
    .dn-week-day { padding: 8px 0; border-radius: 13px; }
    .dn-week-day b { font-size: 16px; }
    .dn-week-day i { font-size: 10.5px; }
    .dn-board { grid-template-columns: minmax(0, 1fr); }

    .dn-rows { grid-template-columns: minmax(0, 1fr); }
    .dn-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .dn-tile { padding: 12px 14px; }
    .dn-tile b { font-size: 20px; }
    .dn-track-line { gap: 3px; }
    .dn-seg-name { font-size: 10.5px; }
    .dn-seg-need { font-size: 10.5px; }
    .dn-kpis { grid-template-columns: minmax(0, 1fr); }
    .info-bar .donut-wrap { grid-column: 1 / -1; }
    .dn-tile-ring { grid-column: 1 / -1; }
    .dn-tiles:has(.dn-tile-ring) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dn-tiles:has(.dn-tile-ring) .dn-tile:not(.dn-tile-ring) { padding: 10px 12px; }
    .dn-tiles:has(.dn-tile-ring) .dn-tile b { font-size: 17px; }
    .dn-track-foot { font-size: 12.5px; }
    .dn-seg-icon, .dn-seg-icon svg { height: 26px; width: 26px; }
    .dn-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dn-pay b { font-size: 32px; }
    .dn-events { grid-template-columns: minmax(0, 1fr); }
    .dn-form { grid-template-columns: minmax(0, 1fr); }
    .dn-split { grid-template-columns: minmax(0, 1fr); }
    .dn-login { margin: -18px -14px 0; border-radius: 0; box-shadow: none; background: none; }
    .dn-login-hero { flex-basis: 100%; padding: 36px 22px 26px; }
    .dn-login-hero h2 { font-size: 28px; margin-top: 18px; }
    .dn-login-chips { display: none; }
    .dn-login-hero::after { display: none; }
    .dn-login .auth-box { flex-basis: 100%; padding: 28px 22px; border-radius: 28px 28px 0 0; margin-top: -18px; position: relative; z-index: 1; }
    .dn-form-card { position: static; }
    .dn-list-actions .btn { padding: 6px 10px; }
    .dn-form-main, .dn-form-side { padding: 16px; }
    .dn-form-side { position: static; }
    .dn-form-side > .btn-primary { position: sticky; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 5; box-shadow: 0 10px 24px rgba(52, 87, 213, .35); }
}
