:root {
  /* Бренд EngClass: тёмно-синий + золото (по логотипу). Смена бренда = правка этих токенов. */
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #1e2a3c;
  --text-muted: #64717f;
  --accent: #22436b;        /* тёмно-синий — кнопки, ссылки, активная навигация */
  --accent-ink: #16304f;    /* темнее — hover/pressed */
  --accent-light: #e9edf5;  /* светлый синий фон активных состояний */
  --gold: #c69a3c;          /* золото — акценты, бейджи */
  --gold-ink: #7c5e1e;      /* золотой текст на светлом (доступный) */
  --gold-bright: #e2b656;   /* золото на тёмном (значок логотипа) */
  --green-ink: #1e7a4c;
  --amber-ink: #8a5800;
  --red-ink: #b02e2e;
  --border: #e2e7f0;
  --green: #3cb374;
  --amber: #f0a534;
  --red: #e05252;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent-ink); text-decoration: none; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 62%; height: 62%; }
.logo-word b { color: var(--text); font-weight: 800; }
.logo-word .gold { color: #b0862a; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.notif-wrap { position: relative; }
.bell {
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  padding: 4px; display: flex; align-items: center; position: relative;
}
.bell:hover { color: var(--text); }
.notif-badge {
  position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: #e05a5a; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-dropdown {
  display: none; position: absolute; top: 40px; right: 0; width: 320px;
  max-height: 420px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(24,60,90,.16); z-index: 50;
}
.notif-dropdown.open { display: block; }
.notif-head {
  padding: 14px 16px 10px; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.notif-item {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #eef6fc; }
.notif-item.unread .notif-text::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle;
}
.notif-text { font-size: 14px; line-height: 1.4; }
.notif-time { font-size: 12px; color: var(--text-muted); }
.notif-empty { padding: 22px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #f6b26b; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; cursor: pointer;
}
.avatar-menu { position: relative; }
.avatar-dropdown {
  position: absolute; right: 0; top: 48px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); min-width: 200px; padding: 8px; display: none;
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown .ad-name {
  font-size: 14px; font-weight: 600; padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.avatar-dropdown .ad-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; cursor: pointer; border-radius: 8px;
  padding: 9px 10px; font-size: 14px; color: var(--text); font-family: inherit;
}
.avatar-dropdown .ad-item:hover { background: var(--bg); color: var(--red-ink); }
.avatar-dropdown .ad-item svg { width: 18px; height: 18px; }

/* ---------- Боковое меню ---------- */
.sidebar {
  position: fixed; top: 60px; left: 0; bottom: 0; width: 64px;
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 12px; gap: 4px;
  border-right: 1px solid var(--border);
  z-index: 10;
}
.side-item {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.side-item:hover { background: var(--bg); }
.side-item.active { background: var(--accent-light); color: var(--accent); }
.side-item svg { width: 22px; height: 22px; }

/* ---------- Контент ---------- */
.layout { padding: 84px 24px 24px 88px; }
.container {
  max-width: 1020px; margin: 0 auto;
  background: var(--surface);
  border-radius: 24px;
  padding: 32px;
  min-height: 70vh;
}
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

/* ---------- Поиск и фильтры ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 10px; padding: 0 14px;
}
.search input {
  flex: 1; border: 0; background: transparent; height: 44px;
  font-size: 15px; color: var(--text); outline: none;
}
.search svg { color: var(--text-muted); width: 18px; height: 18px; }

.chips { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  border: 0; cursor: pointer;
  background: var(--bg); color: var(--text-muted);
  border-radius: 999px; padding: 8px 16px; font-size: 14px;
}
.chip.active { background: #5b5548; color: #fff; }

.count-line {
  color: var(--text-muted); font-size: 14px; margin-bottom: 18px;
  border-bottom: 1px dashed var(--border); padding-bottom: 10px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 10px;
  padding: 11px 20px; font-size: 15px; font-weight: 600;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: var(--bg); color: var(--text); }
.btn-danger { background: #8e1520; color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Карточки материалов ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 24px;
}
.card { cursor: pointer; position: relative; }
.card-cover {
  aspect-ratio: 1 / 1; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 700; color: rgba(43,54,72,.35);
  position: relative;
}
.cover-emoji { font-size: 68px; line-height: 1; filter: saturate(1.05); }
.cover-portrait .cover-emoji { font-size: 72px; }
.card-title { font-size: 16px; font-weight: 600; margin: 12px 0 4px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 8px; line-height: 1.4; }
.card-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); color: var(--text-muted);
  border-radius: 999px; padding: 4px 10px; font-size: 12px;
}
.card-meta { display: flex; gap: 10px; margin-top: 8px; font-size: 13px; }
.meta-pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.meta-pill.green { color: var(--green); }
.meta-pill.amber { color: var(--amber); }
.meta-pill.muted { color: var(--text-muted); }
.card-menu-btn {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 8px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.85); color: var(--text-muted); font-size: 18px; line-height: 1;
}
.card-menu-btn:hover { color: var(--red); }

/* ---------- Скелетон загрузки ---------- */
.skeleton .sk-cover, .skeleton .sk-line {
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius);
}
.skeleton .sk-cover { aspect-ratio: 1 / 1; }
.skeleton .sk-line { height: 14px; margin-top: 12px; border-radius: 6px; }
.skeleton .sk-line.short { width: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Пустое состояние ---------- */
.empty {
  text-align: center; padding: 70px 20px; color: var(--text-muted);
}
.empty-icon {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 20px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 34px; height: 34px; }
.empty h3 { color: var(--text); font-size: 19px; margin-bottom: 8px; }
.empty p { margin-bottom: 22px; }

/* ---------- Ошибка ---------- */
.error-box {
  background: #fdecec; border: 1px solid #f5c6c6; border-radius: var(--radius);
  padding: 22px; display: flex; align-items: center; gap: 14px; color: #a33;
}
.error-box .btn { margin-left: auto; }

/* ---------- Формы ---------- */
.form { max-width: 640px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field input[type="text"], .field textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; font-family: inherit; color: var(--text);
  outline: none; background: var(--surface);
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 200px; resize: vertical; }
.field.invalid input, .field.invalid textarea { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13px; margin-top: 6px; display: none; }
.field.invalid .field-error { display: block; }
.hint { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; }

/* ---------- Таблица (журнал) ---------- */
.table-wrap { overflow-x: auto; }
table.journal { border-collapse: collapse; width: 100%; font-size: 14px; }
.journal th, .journal td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.journal th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.journal tr:hover td { background: #f7f9fc; }
.score {
  display: inline-block; min-width: 34px; text-align: center;
  border-radius: 8px; padding: 4px 8px; font-weight: 700; font-size: 13px;
}
.score.good { background: #e3f6ec; color: var(--green-ink); }
.score.mid { background: #fdf3e0; color: var(--amber-ink); }
.score.none { background: var(--bg); color: var(--text-muted); font-weight: 400; }
.score.wait { background: var(--accent-light); color: var(--accent-ink); }

/* ---------- Модальное окно ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(23, 28, 38, .5);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px; padding: 28px;
  width: 400px; max-width: calc(100vw - 40px);
}
.modal h3 { font-size: 18px; margin-bottom: 10px; }
.modal p { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Вход ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--surface); border-radius: 24px; padding: 44px;
  width: 420px; max-width: calc(100vw - 40px); text-align: center;
}
.login-card .logo { justify-content: center; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); margin: 6px 0 28px; }
.login-card .btn { width: 100%; margin-bottom: 12px; }

/* ---------- Красивые поля входа/регистрации ---------- */
.auth-field { text-align: left; margin-bottom: 18px; }
.auth-field label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text);
}
.auth-field label svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.auth-input-wrap { position: relative; }
.auth-input {
  width: 100%; box-sizing: border-box;
  background: var(--accent-light);
  border: 1.5px solid transparent; border-radius: 14px;
  padding: 15px 16px; font-size: 16px; color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  outline: none; background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 67, 107, .12);
}
.auth-input-wrap .auth-input { padding-right: 48px; }
.eye-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 8px; display: flex; border-radius: 8px;
}
.eye-toggle:hover { color: var(--accent); }
.auth-field.invalid .auth-input { border-color: var(--red); background: #fdf4f4; }

/* ---------- Демо-панель ---------- */
.demo-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(23,28,38,.08);
  font-size: 12px; color: var(--text-muted);
}
.demo-panel b { display: block; margin-bottom: 8px; color: var(--text); font-size: 12px; }
.demo-panel .row { display: flex; gap: 6px; flex-wrap: wrap; }
.demo-panel button {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer;
}
.demo-panel button:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Кнопка-фильтр и переключатели вида ---------- */
.filter-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg); color: var(--text); border: 0; cursor: pointer;
  border-radius: 10px; padding: 0 18px; height: 44px; font-size: 15px; font-weight: 600;
}
.filter-btn:hover { color: var(--accent-ink); }
.filter-btn svg { width: 17px; height: 17px; }

.view-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.icon-group {
  display: flex; gap: 2px; background: var(--bg); border-radius: 10px; padding: 3px;
}
.icon-btn {
  width: 32px; height: 30px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn.active { background: var(--surface); color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }
.sort-label { color: var(--text-muted); font-size: 14px; cursor: pointer; }

/* ---------- Вкладки (страница материалов) ---------- */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  border: 0; background: none; cursor: pointer;
  padding: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Список учеников (строки, как в Edvibe) ---------- */
.student-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.avatar-lg {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: rgba(43,54,72,.45);
}
.student-info { flex: 1; min-width: 0; }
.student-name { font-weight: 600; font-size: 15px; }
.id-badge {
  display: inline-block; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 5px; font-size: 10px; font-weight: 700; padding: 1px 5px; margin-top: 4px;
}
.row-actions { display: flex; gap: 8px; align-items: center; }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.square-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.square-btn svg { width: 18px; height: 18px; }

/* ---------- Обложки материалов (портретные, как в Edvibe) ---------- */
.cover-portrait { aspect-ratio: 3 / 4 !important; align-items: flex-start !important; padding: 18px; font-size: 26px !important; }
.status-pill {
  display: inline-block; background: var(--bg); color: var(--text-muted);
  border-radius: 6px; padding: 3px 8px; font-size: 12px; margin-top: 8px;
}

/* ---------- Календарь расписания ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.week-nav { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.week-nav button {
  border: 0; background: none; cursor: pointer; color: var(--text-muted);
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
}
.week-nav button:hover { color: var(--accent-ink); }
.week-nav span { padding: 0 18px; font-weight: 600; font-size: 14px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 42px; display: flex; align-items: center; }
.tz-select {
  display: flex; align-items: center; gap: 10px;
}
.tz-select select {
  border: 1px solid var(--border); border-radius: 10px; height: 42px; padding: 0 12px;
  color: var(--text-muted); font-size: 14px; background: var(--surface);
}

.cal-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); font-size: 13px; }
.cal-grid .cal-corner { border-bottom: 1px solid var(--border); }
.cal-day {
  text-align: center; padding: 8px 4px; font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.cal-day.today span { background: #f26d6d; color: #fff; border-radius: 999px; padding: 3px 12px; }
.cal-time {
  color: var(--text-muted); font-size: 12px; text-align: right; padding: 0 8px 0 0;
  transform: translateY(-6px);
}
.cal-cell {
  border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
  height: 52px; position: relative; background: #fafbfd;
}
.cal-cell:nth-child(8n) { border-right: 1px solid var(--border); }
.cal-event {
  position: absolute; inset: 3px; border-radius: 8px; padding: 5px 8px;
  font-size: 11px; line-height: 1.3; overflow: hidden; cursor: pointer;
}
.cal-event b { display: block; font-size: 11px; }

/* ---------- Карточки настроек ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.settings-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 26px; cursor: pointer;
}
.settings-card:hover { border-color: var(--border); box-shadow: 0 4px 18px rgba(23,28,38,.06); }
.settings-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.settings-icon svg { width: 20px; height: 20px; }
.settings-card h3 { font-size: 19px; margin-bottom: 8px; }
.settings-card p { color: var(--text-muted); font-size: 14px; }

/* ---------- Селекты в модальном фильтре ---------- */
.filter-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.filter-row label { min-width: 150px; font-size: 14px; font-weight: 600; }
.filter-row select,
.filter-row input[type="text"] {
  flex: 1; border: 1px solid var(--border); border-radius: 10px; height: 42px;
  padding: 0 12px; font-size: 14px; color: var(--text); background: var(--surface);
}
.filter-row input[type="text"]:focus,
.filter-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,67,107,.12); }
.filter-row.top { align-items: flex-start; }
.filter-row.top label { margin-top: 8px; }
.filter-section {
  color: var(--text-muted); font-size: 13px; margin: 18px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.filter-section::after { content: ""; flex: 1; border-top: 1px dashed var(--border); }
.reset-all {
  width: 100%; border: 0; background: var(--bg); color: var(--text-muted);
  border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  margin-bottom: 22px;
}
.reset-all:hover { color: var(--red); }

/* ---------- Кабинет ученика: карточка класса ---------- */
.class-cover-sm {
  width: 96px; height: 96px; border-radius: 12px; flex: none; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: rgba(43,54,72,.45); text-align: center;
}
.teacher-badge {
  position: absolute; right: -12px; bottom: -6px;
  width: 34px; height: 34px; border-radius: 50%;
  background: #fdf3d9; color: #854f0b; border: 2px solid var(--surface);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.progress-ring { position: relative; width: 48px; height: 48px; flex: none; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .pr-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--amber);
}

/* ---------- Мои слова ---------- */
.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.stat-emoji { font-size: 26px; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 18px; font-weight: 700; }

.segmented { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.segmented button {
  flex: 1; border: 0; padding: 10px; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text-muted); font-size: 14px; font-weight: 600;
}
.segmented button.active { background: var(--surface); color: var(--text); }

.word-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.word-en { font-weight: 600; font-size: 15px; }
.word-ru { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.word-row input[type="checkbox"] { margin-left: auto; width: 17px; height: 17px; }
.speak-btn {
  border: 0; background: none; cursor: pointer; color: var(--text-muted);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.speak-btn:hover { color: var(--accent); }

/* ---------- Плеер урока ---------- */
.player-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px; padding: 0 24px;
}
.player-progress { font-size: 12px; color: var(--text-muted); line-height: 1.3; }
.player-progress b { display: block; font-size: 14px; color: var(--text); }
.player-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px;
  max-width: 1160px; margin: 0 auto; padding: 84px 24px 24px;
}
.lesson-sheet { background: var(--surface); border-radius: 16px; padding: 40px; min-height: 75vh; }
.side-panel {
  background: var(--surface); border-radius: 16px; padding: 22px;
  align-self: start; position: sticky; top: 84px;
}
.side-panel .course-head { display: flex; gap: 12px; margin-bottom: 18px; }
.course-thumb {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.section-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer;
}
.section-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.section-link.muted { color: var(--text-muted); }
.section-link:hover { background: var(--bg); }

.video-block {
  aspect-ratio: 16 / 9; background: #232a38; border-radius: 12px; margin: 20px 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
}
.play-btn {
  width: 64px; height: 46px; border-radius: 12px; background: #e05252;
  display: flex; align-items: center; justify-content: center;
}
.play-btn::after { content: ""; border-left: 16px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 4px; }
.video-caption { position: absolute; left: 16px; top: 12px; color: #fff; font-size: 14px; font-weight: 600; }

.quiz-option {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 12px 14px; margin-bottom: 10px; font-size: 15px; color: var(--text);
}
.quiz-option:hover { border-color: var(--accent); }
.quiz-option.correct { border-color: var(--green); background: #e3f6ec; }
.quiz-option.wrong { border-color: var(--red); background: #fdecec; }
.quiz-result { font-size: 14px; font-weight: 600; margin-top: 4px; }

@media (max-width: 900px) {
  .player-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

/* ==================== МОБИЛЬНАЯ ВЕРСИЯ ==================== */
@media (max-width: 768px) {
  /* Боковое меню превращается в нижнюю панель вкладок */
  .sidebar {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 64px;
    flex-direction: row; justify-content: space-around; align-items: center;
    padding: 0 8px;
    border-right: 0; border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(46,42,36,.05);
  }
  .side-item { width: 52px; height: 48px; }

  .topbar { height: 56px; padding: 0 16px; }
  .logo { font-size: 17px; }
  .logo-mark { width: 32px; height: 32px; font-size: 11px; }
  .avatar { width: 34px; height: 34px; }

  /* Контент: без левого поля, с запасом снизу под панель вкладок */
  .layout { padding: 68px 10px 84px; }
  .container { padding: 20px 16px; border-radius: 16px; min-height: auto; }
  .page-title { font-size: 22px; }

  /* Сетки и списки */
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card-cover { font-size: 40px; }
  .cover-portrait { font-size: 18px !important; padding: 12px; }

  .toolbar { flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .filter-btn { flex: 1; justify-content: center; }

  .page-head .btn { flex: 1 1 auto; justify-content: center; }

  .student-row { flex-wrap: wrap; gap: 12px; }
  .student-row .row-actions { width: 100%; justify-content: flex-end; }

  .tabs { gap: 16px; }
  .trow { grid-template-columns: 1fr; }

  /* Плеер урока */
  .player-topbar { position: static; height: auto; min-height: 56px; flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .player-progress { font-size: 12px; }
  .player-layout { padding: 12px 10px 24px; }
  .lesson-sheet { padding: 22px 16px; }

  /* Модалки и панели */
  .modal { padding: 20px 16px; }
  .demo-panel { bottom: 76px; right: 10px; max-width: 190px; opacity: .92; }
  .login-card { padding: 32px 22px; }

  /* Календарь и таблицы прокручиваются по горизонтали — это норма */
  .cal-nav { justify-content: center; }
}

@media (max-width: 400px) {
  .grid { gap: 10px; }
  .chips { gap: 6px; }
  .chip { padding: 7px 12px; font-size: 13px; }
}

/* ---------- Селект в формах-модалках ---------- */
.sel {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 15px; font-family: inherit;
  color: var(--text); background: var(--surface); outline: none;
}
.sel:focus { border-color: var(--accent); }

/* ---------- Блоки настроек ---------- */
.settings-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; margin-bottom: 18px;
}

/* ---------- Данные приглашённого ученика ---------- */
.creds-box { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cred-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.cred-row + .cred-row { border-top: 1px solid var(--border); }
.cred-label { font-size: 13px; color: var(--text-muted); }
.cred-val { font-family: ui-monospace, Menlo, monospace; font-size: 15px; font-weight: 600; color: var(--text); }

/* ---------- Выбор класса (добавить ученика) ---------- */
.pick-row {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.pick-row:hover:not(.disabled) { border-color: var(--accent); background: var(--accent-light); }
.pick-row.disabled { opacity: .6; cursor: default; }
.pick-add { color: var(--accent-ink); display: flex; }
.pick-add svg { width: 18px; height: 18px; }

/* ---------- Фиксированный тост ---------- */
.toast-fixed {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff; border-radius: 12px; padding: 12px 18px;
  font-size: 14px; box-shadow: var(--shadow-pop);
}
.toast-fixed .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- Переключатель режима редактирования ---------- */
.edit-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.edit-toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.edit-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
.edit-toggle.on {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.edit-toggle.on .dot { background: var(--gold-bright); box-shadow: 0 0 0 3px rgba(226,182,86,.3); }

/* Элементы, доступные только владельцу в режиме редактирования.
   Сервер всё равно защищает (403), это только чтобы кураторы не видели лишних кнопок. */
body:not(.edit-mode) .owner-only { display: none !important; }
/* Подсказка, видимая ТОЛЬКО в режиме проверки (обратное owner-only) */
body.edit-mode .edit-hint { display: none !important; }
.edit-hint {
  display: flex; align-items: center; gap: 10px; margin: 0 0 4px;
  background: var(--accent-light); color: var(--accent-ink);
  border-radius: 12px; padding: 12px 16px; font-size: 13px; line-height: 1.5;
}

/* Чипы групп куратора + селект назначения */
.chip-x {
  border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--gold-ink); padding: 0 2px; border-radius: 4px;
}
.chip-x:hover { color: var(--red); }
.assign-select {
  height: 30px; border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 0 8px; font-size: 13px; color: var(--text-muted); background: var(--surface); cursor: pointer;
}

/* Пагинация списков */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 20px 0 4px; }
.page-btn {
  min-width: 36px; height: 36px; padding: 0 10px; border: 0.5px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: var(--radius);
  font-size: 14px; cursor: pointer; transition: all .12s;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent-ink); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-gap { align-self: center; color: var(--text-muted); padding: 0 2px; }

/* ---------- Пикеры эмодзи/цвета (создание класса и т.п.) ---------- */
.emoji-pick, .color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt {
  width: 40px; height: 40px; border-radius: 10px; font-size: 20px; line-height: 1;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .12s;
}
.emoji-opt:hover { border-color: var(--accent); }
.emoji-opt.active { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 2px var(--accent) inset; }
.color-opt {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); transition: all .12s;
}
.color-opt.active { border-color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Файлы материала ---------- */
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
}
.file-ic { color: var(--accent-ink); display: flex; }
.file-ic svg { width: 18px; height: 18px; }
.file-name { flex: 1; font-size: 15px; color: var(--text); font-weight: 500; }
.file-name:hover { color: var(--accent-ink); text-decoration: underline; }
.file-size { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- Выполнение задания учеником ---------- */
.answer-box {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  background: var(--bg); white-space: pre-wrap; line-height: 1.6; margin-bottom: 16px;
}
.status-line { font-size: 15px; }
.status-line.wait { color: var(--accent-ink); background: var(--accent-light);
  padding: 12px 16px; border-radius: 10px; display: inline-block; }
.status-line.ok { display: flex; align-items: center; }
.opt-choose {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 10px; margin-bottom: 8px; font-size: 15px;
}
.opt-choose:hover { border-color: var(--accent); }
.opt-choose input { width: 18px; height: 18px; accent-color: var(--accent); }
.q-review { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.opt-review { padding: 8px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 6px; background: var(--bg); }
.opt-correct { background: var(--green-bg); color: var(--green-ink); font-weight: 600; }
.opt-wrong { background: var(--red-bg); color: var(--red-ink); }

/* ---------- Проверка работ (учитель) ---------- */
.review-card { border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.review-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.review-meta { font-size: 13px; color: var(--text-muted); }
.grade-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.grade-row input[type=number] {
  width: 90px; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; outline: none;
}
.grade-row input[type=text] {
  flex: 1; min-width: 200px; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; outline: none;
}
.grade-row input:focus { border-color: var(--accent); }

/* ---------- Задание в списке (ученик) со статусом ---------- */
.assign-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.assign-badge {
  width: 54px; height: 54px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}

/* ---------- Конструктор заданий ---------- */
.type-switch { display: flex; gap: 12px; flex-wrap: wrap; }
.type-btn {
  flex: 1; min-width: 220px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px;
  background: var(--surface); font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 4px;
}
.type-btn b { font-size: 15px; }
.type-btn span { font-size: 13px; color: var(--text-muted); }
.type-btn.active { border-color: var(--accent); background: var(--accent-light); }
.type-btn.active b { color: var(--accent-ink); }

.q-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.q-head b { font-size: 14px; }
.q-remove, .opt-remove {
  border: 0; background: none; cursor: pointer; color: var(--text-muted);
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.q-remove:hover, .opt-remove:hover { color: var(--red-ink); }
.q-text {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; color: var(--text);
  outline: none; margin-bottom: 12px;
}
.q-text:focus, .opt-text:focus { border-color: var(--accent); }
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.opt-row input[type=radio] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); cursor: pointer; }
.opt-text {
  flex: 1; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; font-family: inherit; color: var(--text); outline: none;
}

/* ---------- Страница класса ---------- */
.class-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.class-cover {
  width: 84px; height: 84px; border-radius: 16px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: rgba(34,48,63,.4);
}
.prog-bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 8px; width: 220px; max-width: 100%; }
.prog-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.prog-text { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile { border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat-tile .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile .l { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.lesson-item { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.lesson-item:hover .student-name { color: var(--accent-ink); }
.lesson-cover {
  width: 52px; height: 52px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: rgba(34,48,63,.4);
}

/* ---------- Модалка «Статистика ученика» ---------- */
.stat-block {
  border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px;
}
.stat-block h4 { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-bottom: 14px; }
.points-line { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.points-line .big { font-size: 28px; font-weight: 700; }
.points-line .of { font-size: 28px; font-weight: 700; color: var(--text-muted); opacity: .5; }
.tri-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg); margin-top: 8px; }
.tri-bar span { height: 100%; }
.rating-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.rating-place { color: var(--accent-ink); font-weight: 700; font-size: 15px; }
.rating-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 10px; padding: 9px 14px; margin-bottom: 8px; font-size: 14px;
}
.rating-row .medal { width: 26px; text-align: center; font-size: 16px; color: var(--text-muted); flex: none; }
.rating-row .r-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  color: rgba(43,54,72,.5);
}
.rating-row b.pts { margin-left: auto; }
.rating-row.me { outline: 2px solid var(--accent); background: var(--accent-light); }

/* ---------- Всплывашка перевода выделенного слова ---------- */
.word-popup {
  position: absolute; z-index: 60; width: 260px;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(23,28,38,.16); border: 1px solid var(--border);
  overflow: hidden;
}
.word-popup .wp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; font-size: 15px; width: 100%;
  border: 0; background: none; text-align: left; color: var(--text);
}
.word-popup .wp-row:hover { background: var(--bg); }
.word-popup .wp-word { font-weight: 700; cursor: default; }
.word-popup .wp-word:hover { background: none; }
.word-popup .wp-row + .wp-row { border-top: 1px solid var(--border); }
.word-popup .wp-muted { color: var(--text-muted); }
.word-popup .wp-added { color: var(--green); cursor: default; }
.word-popup svg { flex: none; }

.badge-new {
  position: absolute; top: 10px; left: 10px;
  background: var(--gold-bright); color: var(--accent-ink);
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 999px; padding: 4px 11px;
  box-shadow: 0 2px 8px rgba(198,154,60,.35);
}
