:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #16181d;
  --ink-2: #4a4f59;
  --muted: #7b808a;
  --line: #e4e6eb;
  --line-2: #eef0f3;
  --primary: #2a78d6;
  --primary-ink: #1c5cab;
  --primary-soft: #e8f1fc;
  --trial: #7a5af0;
  --trial-soft: #f1edfe;
  --good: #0a8a0a;
  --good-soft: #e7f6e7;
  --warning: #b77700;
  --warning-soft: #fff4d9;
  --critical: #c93434;
  --critical-soft: #fdeaea;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.18);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 12px; }
.pad-h { padding: 16px 18px 8px; }
.text-critical { color: var(--critical); }
.greeting { color: var(--ink-2); margin-bottom: 16px; font-size: 15px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #d3d6dc; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); }
.btn-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-danger:hover { background: #a82828; border-color: #a82828; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger-text { color: var(--critical); margin-right: auto; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; height: 42px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent;
  cursor: pointer; display: inline-grid; place-items: center; color: var(--ink-2); font-size: 16px; flex: none;
}
.icon-btn:hover { background: var(--line-2); }

/* ---------- формы ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }
.row > .grow { flex: 2 1 200px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--primary); margin: 0; flex: none; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.fieldset legend { font-weight: 650; padding: 0 6px; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 7px; font-weight: 550; color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

.chips-select { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.chip-check input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--primary); }

#lesson-form[data-type="group"] [data-show="trial"],
#lesson-form[data-type="trial"] [data-show="group"] { display: none; }
#student-form:not([data-parent-mode="existing"]) [data-pm="existing"],
#student-form:not([data-parent-mode="new"]) [data-pm="new"] { display: none; }

.picker { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.picker .picker-search { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.picker .picker-search:focus { box-shadow: none; }
.picker-list { max-height: 240px; overflow: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--surface-2); }
.picker-item small { margin-left: 2px; }
.picker-status { margin-left: auto; }

.new-kids { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.new-kids:empty { display: none; }
.new-kid { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; }
.weekday-grid { display: flex; flex-direction: column; gap: 6px; }
.weekday-row { display: grid; grid-template-columns: auto 1fr 130px; gap: 10px; align-items: center; cursor: pointer; }

/* ---------- бейджи и алерты ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.badge-good { background: var(--good-soft); color: #075f07; }
.badge-warning { background: var(--warning-soft); color: #8a5a00; }
.badge-critical { background: var(--critical-soft); color: #a32424; }
.badge-muted { background: var(--line-2); color: var(--ink-2); }
.badge-info { background: var(--primary-soft); color: var(--primary-ink); }
.badge-trial { background: var(--trial-soft); color: #5a3cc9; }

.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid; margin-bottom: 16px; }
.alert-critical { background: var(--critical-soft); border-color: #f3c3c3; color: #7d1d1d; }
.alert-warning { background: var(--warning-soft); border-color: #f5dc9c; color: #6b4600; }
.alert-info { background: var(--primary-soft); border-color: #c4dbf6; color: #174a8a; }
.form .alert { margin: 0; }

/* ---------- раскладка ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: #14213d; color: #dfe5f0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 4px 8px 18px; color: #fff; }
.brand-logo { font-size: 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c5cedd; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.me { display: flex; flex-direction: column; flex: 1; min-width: 0; padding-left: 8px; }
.me b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: #93a0b6; }
.sidebar-foot .btn-ghost { color: #c5cedd; }
.sidebar-foot .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.sidebar-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; min-height: 64px;
}
.topbar h1 { font-size: 20px; font-weight: 700; flex: 1; min-width: 0; }
.menu-btn { display: none; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page { padding: 24px 28px 48px; max-width: 1320px; width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; }
.card-alert { border-color: #f3c3c3; background: #fffafa; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 12px; }
.narrow { max-width: 620px; }
.card.form h2 { margin-top: 6px; }
.count { background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin: 16px 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin: 18px 0 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty-icon { font-size: 28px; margin-bottom: 6px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis-in { margin-bottom: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpis-in .kpi { box-shadow: none; background: var(--surface-2); }
.kpi small { color: var(--ink-2); font-size: 12.5px; }
.kpi b { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.kpi .muted { font-size: 12px; }
.kpi-hero { grid-column: span 2; background: linear-gradient(135deg, #eef5fe, #fff); border-color: #cfe0f6; }
.kpis-in .kpi-hero { background: linear-gradient(135deg, #eef5fe, #f8fbff); }
.kpi-hero b { font-size: 30px; color: var(--primary-ink); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); white-space: nowrap; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; }
.table-hover tbody tr { cursor: pointer; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.row-muted td { color: var(--muted); }
.modal .table th, .modal .table td { padding: 8px 10px; }

/* ---------- панель инструментов ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar-title { font-size: 15px; }
.filters { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.filters select { width: auto; min-width: 180px; }
.search { max-width: 320px; margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 550; }
.chip small { color: var(--muted); margin-left: 2px; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active small { color: #c9ccd3; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--primary); }

/* ---------- занятия (списки) ---------- */
.lesson-list { display: flex; flex-direction: column; gap: 6px; }
.lesson-row {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center; text-align: left;
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 10px; background: var(--surface); cursor: pointer;
}
.lesson-row:hover { background: var(--surface-2); }
.lesson-row.is-trial { border-left-color: var(--trial); }
.lesson-row.status-done { border-left-color: var(--good); }
.lesson-row.status-cancelled { opacity: .6; }
.lesson-time { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.lesson-time small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.lesson-main { display: flex; flex-direction: column; min-width: 0; }
.lesson-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); border-left: 4px solid var(--muted); }
.alert-item.level-week { border-left-color: #e8a300; }
.alert-item.level-day, .alert-item.level-expired { border-left-color: var(--critical); }
.alert-item-main { display: flex; flex-direction: column; min-width: 0; }
.alert-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* ---------- расписание (неделя) ---------- */
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-group::before { background: var(--primary); }
.lg-trial::before { background: var(--trial); }
.lg-done::before { background: var(--good); }
.lg-overdue::before { background: var(--critical); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; overflow: hidden; }
.day.is-past { background: #fbfbfc; }
.day.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.day-name { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.day-num { font-size: 18px; font-weight: 700; }
.is-today .day-num { color: var(--primary); }
.day-body { padding: 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.day-empty { color: #c3c6cc; text-align: center; padding: 10px 0; }
.day-add { margin-top: auto; border: 1px dashed var(--line); background: none; border-radius: 8px; color: var(--muted); cursor: pointer; padding: 4px; opacity: 0; transition: opacity .12s; }
.day:hover .day-add, .day-add:focus { opacity: 1; }
.lcard {
  display: flex; flex-direction: column; gap: 1px; text-align: left; width: 100%; cursor: pointer;
  border: 0; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 8px; padding: 7px 8px;
}
.lcard:hover { filter: brightness(.97); }
.lcard.is-trial { border-left-color: var(--trial); background: var(--trial-soft); }
.lcard.status-done { border-left-color: var(--good); background: var(--good-soft); }
.lcard.status-cancelled { background: var(--line-2); border-left-color: #b8bcc4; opacity: .7; }
.lcard.status-cancelled .lcard-title { text-decoration: line-through; }
.lcard.is-overdue { border-left-color: var(--critical); background: var(--critical-soft); }
.lcard-time { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lcard-title { font-weight: 600; font-size: 13px; line-height: 1.25; }
.lcard-sub { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- модалка занятия ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.lesson-head { display: flex; gap: 6px; margin-bottom: 12px; }
.roster-head { display: flex; justify-content: space-between; align-items: center; }
.roster { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.roster-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
label.roster-item { cursor: pointer; }
label.roster-item:hover { background: var(--surface-2); }
label.roster-item:has(input:checked) { background: #f1f9f1; }
.roster-item:last-child { border-bottom: 0; }
.roster-name { font-weight: 600; flex: 1; min-width: 120px; }
.roster-warn { width: 100%; padding-left: 27px; color: var(--critical); }
.earning-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

/* ---------- модальные окна ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-wide { width: min(800px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.toast-root, #toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1d2230; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; transition: opacity .4s, transform .4s; }
.toast-error { background: #a82828; }
.toast-warning { background: #8a5a00; }
.toast.hide { opacity: 0; transform: translateY(8px); }

/* ---------- кабинет родителя ---------- */
.kid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.kid-card { display: flex; flex-direction: column; margin: 0; }
.kid-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.kid-head h2 { font-size: 18px; margin: 0; }
.kid-avatar { width: 46px; height: 46px; border-radius: 50%; background: #ffd23f; color: #5b4300; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
.kid-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.kid-meta div { background: var(--surface-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.kid-meta b { font-size: 17px; }
.kid-card > .btn { align-self: flex-start; margin-top: 14px; }
.visits { display: flex; flex-wrap: wrap; gap: 6px; }
.visit { display: flex; flex-direction: column; align-items: center; width: 50px; padding: 5px 0; border-radius: 8px; font-weight: 700; }
.visit small { font-weight: 500; font-size: 10.5px; color: var(--ink-2); }
.visit.yes { background: var(--good-soft); color: var(--good); }
.visit.no { background: var(--line-2); color: var(--muted); }

.sub-banner { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid; }
.sub-banner-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sub-good { background: var(--good-soft); border-color: #bfe3bf; color: #0c4f0c; }
.sub-warning { background: var(--warning-soft); border-color: #f5dc9c; color: #6b4600; }
.sub-critical { background: var(--critical-soft); border-color: #f3c3c3; color: #7d1d1d; }
.sub-muted { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.sub-dots { display: flex; gap: 5px; flex: none; }
.sub-dots span { width: 14px; height: 14px; border-radius: 50%; background: currentColor; opacity: .85; }
.sub-dots span.used { opacity: .18; }

/* ---------- группы ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.group-card { display: flex; flex-direction: column; margin: 0; }
.group-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.group-sched { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.group-students { list-style: none; margin: 0; padding: 0; }
.group-students li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.group-students li:last-child { border-bottom: 0; }

/* ---------- графики ---------- */
.chart { margin: 0; }
.chart-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 30px; }
.chart-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.chart-top .btn { margin-left: auto; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.s1, .bar.s1 { background: var(--series-1); fill: var(--series-1); }
.sw.s2, .bar.s2 { background: var(--series-2); fill: var(--series-2); }
.chart-plot { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: #eceef1; stroke-width: 1; }
.chart .axis { stroke: #c3c6cc; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: rgba(22, 24, 29, .04); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; white-space: nowrap; color: var(--ink); }
.chart-tip div { color: var(--ink-2); }
.chart-table { margin-top: 10px; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #14213d 0%, #1f3a6e 55%, #2a78d6 100%); }
.login-card { background: var(--surface); padding: 32px 28px; border-radius: 16px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 22px; }
.login-card p { margin: -8px 0 4px; }
.login-card .alert { margin: 0; }
.login-logo { font-size: 38px; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; }
  .nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .page { padding: 16px 14px 40px; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day-add { opacity: 1; }
  .two-col { grid-template-columns: 1fr; }
  .kpi-hero { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi-hero { grid-column: 1 / -1; }
  .filters, .search { margin-left: 0; width: 100%; max-width: none; }
  .filters select { flex: 1; min-width: 0; }
  .kid-cards, .group-grid { grid-template-columns: 1fr; }
  .new-kid { grid-template-columns: 1fr 1fr; }
  .new-kid input:first-child { grid-column: 1 / -1; }
  .lesson-row { grid-template-columns: 60px 1fr; }
  .lesson-status { grid-column: 2; }
}

/* ---------- расписание: месяц ---------- */
.btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.active:hover { background: #000; border-color: #000; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-head { font-size: 12px; color: var(--muted); text-align: center; text-transform: capitalize; padding-bottom: 2px; }
.mcell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.mcell.is-other { background: #fafafb; }
.mcell.is-other .mcell-day { color: #b9bcc3; }
.mcell.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.mcell-day { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mcell.is-today .mcell-day { color: var(--primary); }
.mlesson {
  display: flex; flex-direction: column; text-align: left; width: 100%; cursor: pointer;
  border: 0; border-left: 3px solid var(--primary); background: var(--primary-soft);
  border-radius: 6px; padding: 3px 5px; font-size: 11.5px; line-height: 1.25;
}
.mlesson:hover { filter: brightness(.96); }
.mlesson span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlesson.is-trial { border-left-color: var(--trial); background: var(--trial-soft); }
.mlesson.status-done { border-left-color: var(--good); background: var(--good-soft); }
.mlesson.status-cancelled { border-left-color: #b8bcc4; background: var(--line-2); }
.mlesson.status-cancelled span { text-decoration: line-through; }
.mlesson.is-overdue { border-left-color: var(--critical); background: var(--critical-soft); }
.mcell .day-add { margin-top: auto; padding: 2px; }

@media (max-width: 860px) {
  .month { gap: 3px; }
  .month-head { font-size: 10px; }
  .mcell { min-height: 62px; padding: 3px; border-radius: 8px; gap: 2px; }
  .mcell-day { font-size: 11px; }
  .mlesson { font-size: 9.5px; padding: 2px 3px; border-left-width: 2px; }
  .mcell .day-add { display: none; }
}
.month-head .wd-short { display: none; }
@media (max-width: 860px) {
  .month-head .wd-full { display: none; }
  .month-head .wd-short { display: inline; }
}
