/* ============ Токены ============ */
:root {
  --accent: #7c5cff;
  --accent-hover: color-mix(in srgb, var(--accent) 82%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --bg: #0a0c11;
  --bg-2: #0f1218;
  --card: #141821;
  --card-2: #1a1f2b;
  --border: #232a38;
  --border-2: #2e3647;
  --text: #e9ecf3;
  --text-2: #c3c9d6;
  --muted: #8a93a6;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .14);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, .14);
  --danger: #f04452;
  --danger-soft: rgba(240, 68, 82, .14);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Manrope Variable', 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.block { display: block; }
.text-success { color: var(--success); }
.link-accent { color: var(--accent-hover); display: inline-flex; align-items: center; gap: 6px; }
.link-accent:hover { text-decoration: underline; }
.i { flex-shrink: 0; vertical-align: middle; }
.clamp-1, .clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.top-gap { margin-top: 16px; }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .container { padding: 0 24px; } }
.page { padding-top: 28px; padding-bottom: 64px; }
.narrow { max-width: 760px; }
.narrow-form { max-width: 820px; }

/* ============ Шапка ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #00d4ff));
  box-shadow: 0 6px 18px var(--accent-soft);
}
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px; transition: .15s;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: var(--text); background: var(--card-2); }
@media (max-width: 560px) { .nav a span { display: none; } .brand-name { max-width: 46vw; } }

.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-hover); font-weight: 800; font-size: 13px;
  border: 1px solid var(--accent-line);
}
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px;
  background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dropdown-head { padding: 10px 12px; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head .muted { font-size: 13px; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--text-2); background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--card-2); color: var(--text); }

/* ============ Кнопки ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1.2; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px var(--accent-soft); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--card-2); color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--accent-line); background: color-mix(in srgb, var(--card-2) 70%, var(--accent-soft)); }
.btn-success { background: var(--success); color: #04150a; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: var(--danger-soft); color: #ff8a94; border-color: rgba(240, 68, 82, .35); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: none; border: 0; color: var(--muted); cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ============ Карточки, бейджи ============ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
@media (min-width: 760px) { .card { padding: 24px; } }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 14px; }
.stack > .card-title, .card.stack > .card-title { margin-bottom: 0; }
.sub-title { font-size: 14px; color: var(--muted); margin: 18px 0 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--card-2); color: var(--text-2); border: 1px solid var(--border-2);
  white-space: nowrap; vertical-align: middle;
}
.badge.big { font-size: 15px; padding: 10px 16px; }
.badge-success { background: var(--success-soft); color: #4ade80; border-color: rgba(34, 197, 94, .3); }
.badge-warning { background: var(--warning-soft); color: #fbbf24; border-color: rgba(245, 165, 36, .3); }
.badge-danger { background: var(--danger-soft); color: #ff8a94; border-color: rgba(240, 68, 82, .3); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  padding: 5px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border-2);
  color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }

.progress { height: 6px; background: var(--card-2); border-radius: 999px; overflow: hidden; width: 100%; }
.progress > div {
  height: 100%; border-radius: inherit; transition: width .4s;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #00d4ff));
}
.mini-progress { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.mini-progress .progress { flex: 1; }

/* ============ Уведомления ============ */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 600; font-size: 14px; transition: opacity .4s; }
.alert-success { background: var(--success-soft); border-color: rgba(34, 197, 94, .3); color: #86efac; }
.alert-error { background: var(--danger-soft); border-color: rgba(240, 68, 82, .3); color: #fda4ab; }
.alert + form, .alert + .stack { margin-top: 0; }
.credentials { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.credentials-head { display: flex; align-items: center; gap: 10px; }
.credentials-text {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; resize: vertical;
  background: rgba(0, 0, 0, .3); color: var(--text); border: 1px solid rgba(34, 197, 94, .3); border-radius: 10px; padding: 12px;
}

/* ============ Формы ============ */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field.short { max-width: 360px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #5d6678; }
select:disabled { opacity: .6; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 700; margin-right: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  background: var(--card-2); color: var(--text); border: 1px solid var(--border-2);
}
input[type=color] { width: 52px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--bg-2); cursor: pointer; }
.color-row { display: flex; align-items: center; gap: 12px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-list { display: grid; gap: 8px; }
.check-list .check { padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 42px; height: 24px; border-radius: 999px; background: var(--border-2); position: relative; transition: .2s; flex-shrink: 0; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch input:disabled + .switch-ui { opacity: .5; }

.segmented { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; align-self: flex-start; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted); transition: .15s; }
.segmented input:checked + span { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 var(--border-2) inset; }
.segmented input:focus-visible + span { box-shadow: 0 0 0 2px var(--accent); }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 28px 16px; border: 1.5px dashed var(--border-2); border-radius: var(--radius); background: var(--bg-2); color: var(--muted); cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--bg-2) 85%, var(--accent-soft)); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-text { font-weight: 700; color: var(--text-2); }
.dropzone.small-zone { padding: 18px 16px; flex-direction: row; }
.dropzone.has-file { border-color: var(--success); border-style: solid; }
.current-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--bg-2); border-radius: 10px; font-size: 14px; }
.video-preview { border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.video-preview iframe, .video-preview video { width: 100%; height: 100%; border: 0; display: block; }
.video-preview.error { aspect-ratio: auto; background: var(--danger-soft); color: #fda4ab; padding: 12px; font-size: 14px; }
.emoji-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.emoji-input { width: 72px !important; text-align: center; font-size: 22px !important; padding: 8px !important; }
.emoji-picks { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 200px; }
.emoji-pick { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); font-size: 18px; cursor: pointer; }
.emoji-pick:hover { border-color: var(--accent); }
.cover-preview { height: 140px; border-radius: 12px; background-size: cover; background-position: center; border: 1px solid var(--border); }
.logo-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 16px; border: 1px solid var(--border); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.form-side.sticky { position: sticky; top: 132px; }
@media (max-width: 900px) {
  .form-layout { grid-template-columns: 1fr; }
  .form-side.sticky { position: static; }
}
.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-progress .progress { height: 8px; }
.upload-error { color: #fda4ab !important; font-weight: 700; }

.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 24px; padding: 16px 20px; border: 1px solid rgba(240, 68, 82, .25); border-radius: var(--radius); background: rgba(240, 68, 82, .04);
}

/* ============ Страница входа ============ */
.login-page {
  background:
    radial-gradient(700px 400px at 15% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; padding: 32px 24px;
  background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
@media (min-width: 480px) { .login-card { padding: 40px 36px; } }
.login-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-brand h1 { font-size: 24px; }
.login-logo { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; }
.login-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 4px; border-top: 1px solid var(--border); padding-top: 18px; }

/* ============ Главная ученика ============ */
.hero {
  position: relative; overflow: hidden; display: flex; gap: 32px; align-items: center; justify-content: space-between;
  padding: 28px 24px; border-radius: 22px; border: 1px solid var(--border);
  background:
    radial-gradient(500px 260px at 0% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    linear-gradient(180deg, var(--card), var(--bg-2));
}
@media (min-width: 760px) { .hero { padding: 40px; } }
.hero-text { max-width: 640px; display: flex; flex-direction: column; gap: 12px; }
.eyebrow { color: var(--accent-hover); font-weight: 700; font-size: 14px; }
.hero h1 { font-size: clamp(24px, 4vw, 34px); }
.lead { color: var(--text-2); font-size: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.next-hint { margin-top: -2px; }
.hero-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; flex-shrink: 0; }
.ring {
  --p: 0; width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--card-2) 0);
}
.ring-inner { width: 112px; height: 112px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-inner strong { font-size: 28px; font-weight: 800; line-height: 1; }
.ring-inner span { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: stretch; }
  .hero-progress { flex-direction: row; justify-content: flex-start; }
  .ring { width: 84px; height: 84px; }
  .ring-inner { width: 66px; height: 66px; }
  .ring-inner strong { font-size: 18px; }
  .ring-inner span { display: none; }
}

.block { margin-top: 36px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.block-head h2 { display: flex; align-items: center; gap: 10px; }

.news-list { display: grid; gap: 12px; }
.news-item { display: block; padding: 18px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); }
.news-item.pinned { border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-soft), var(--card) 60%); }
.news-item h3 { margin: 6px 0 4px; }
.news-item p { color: var(--text-2); font-size: 14px; }
.news-item a { color: var(--accent-hover); text-decoration: underline; }
.news-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-link { transition: border-color .15s; }
.card-link:hover { border-color: var(--accent-line); }

.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.section-card {
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--card);
  border: 1px solid var(--border); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.section-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
.section-cover {
  position: relative; height: 130px; display: grid; place-items: center; background-size: cover; background-position: center;
  background-color: var(--card-2);
  background-image: radial-gradient(240px 120px at 30% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%);
}
.section-icon { font-size: 46px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .4)); }
.section-num { position: absolute; top: 12px; left: 14px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .08em; background: rgba(0,0,0,.35); padding: 2px 8px; border-radius: 999px; }
.lock-badge, .draft-badge {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(0, 0, 0, .6); color: #fff;
}
.draft-badge { background: var(--warning); color: #1d1200; }
.lock-badge + .draft-badge { top: 40px; }
.section-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.section-body p { font-size: 14px; }
.section-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.section-meta span { display: inline-flex; align-items: center; gap: 5px; }
.section-card.locked .section-cover { filter: grayscale(.7) brightness(.7); }
.section-card.locked .section-body h3 { color: var(--text-2); }
.section-card.draft { border-style: dashed; }
.add-card {
  align-items: center; justify-content: center; gap: 10px; min-height: 220px; color: var(--muted);
  border: 1.5px dashed var(--border-2); background: transparent; font-weight: 700;
}
.add-card:hover { color: var(--text); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 20px;
  border: 1.5px dashed var(--border-2); border-radius: 18px; color: var(--muted);
}
.empty-state h3 { color: var(--text); font-size: 18px; }
.empty-state p { max-width: 460px; }
.empty-state .btn { margin-top: 8px; }
.empty-state.big { border: 0; padding-top: 80px; }
.error-code { font-size: 72px; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--accent), #00d4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ============ Раздел ============ */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a:hover { color: var(--text); }
.crumbs span { color: var(--text-2); }
.section-header { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 24px; }
.section-header-icon {
  width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; font-size: 38px; flex-shrink: 0;
  background-color: var(--card-2); background-size: cover; background-position: center; border: 1px solid var(--border);
}
.section-header-text { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 8px; }
.section-header-text h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.section-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-progress { display: flex; align-items: center; gap: 12px; max-width: 360px; margin-top: 4px; }

.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); transition: .15s;
}
.lesson-row:hover { border-color: var(--accent-line); background: color-mix(in srgb, var(--card) 85%, var(--accent-soft)); }
.lesson-check {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--card-2); border: 1px solid var(--border-2); font-weight: 800; font-size: 13px; color: var(--muted);
}
.lesson-row.done .lesson-check { background: var(--success); border-color: var(--success); color: #04150a; }
.lesson-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lesson-row-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.lesson-row-meta span { display: inline-flex; align-items: center; gap: 4px; }
.lesson-row .chev { color: var(--muted); }
@media (max-width: 560px) { .lesson-row-meta { display: none; } }

/* ============ Урок ============ */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .lesson-layout { grid-template-columns: 1fr; } }
.lesson-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.lesson-header { display: flex; flex-direction: column; gap: 10px; }
.lesson-header h1 { font-size: clamp(22px, 3.4vw, 30px); }
.lesson-header-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.lesson-header-meta > span { display: inline-flex; align-items: center; gap: 5px; }

.player { position: relative; aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--border); box-shadow: var(--shadow); }
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.watermark {
  position: absolute; z-index: 2; pointer-events: none; user-select: none; top: 12%; left: 8%;
  font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .22); text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  transition: top 1.5s ease, left 1.5s ease; white-space: nowrap;
}

.rich { font-size: 16px; line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; }
.rich > * + * { margin-top: .8em; }
.rich h1, .rich h2, .rich h3 { color: var(--text); margin-top: 1.4em; }
.rich h1 { font-size: 24px; } .rich h2 { font-size: 21px; } .rich h3 { font-size: 18px; }
.rich > :first-child { margin-top: 0; }
.rich a { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.rich strong { color: var(--text); }
.rich img { border-radius: 12px; display: block; margin: 1em 0; }
.rich ol, .rich ul { padding-left: 1.5em; }
.rich li { margin: .25em 0; }
.rich li[data-list="bullet"] { list-style-type: disc; }
.rich li[data-list="ordered"] { list-style-type: decimal; }
.rich li[data-list="checked"], .rich li[data-list="unchecked"] { list-style: none; }
.rich li[data-list="checked"]::before { content: '☑ '; }
.rich li[data-list="unchecked"]::before { content: '☐ '; }
.rich li.ql-indent-1 { margin-left: 1.5em; } .rich li.ql-indent-2 { margin-left: 3em; } .rich li.ql-indent-3 { margin-left: 4.5em; }
.rich blockquote { margin: 1em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--text); }
.rich pre, .rich .ql-code-block-container { background: var(--bg); border: 1px solid var(--border); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-family: ui-monospace, Menlo, monospace; font-size: 14px; white-space: pre; }
.rich code { background: var(--card-2); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.rich .ql-align-center { text-align: center; } .rich .ql-align-right { text-align: right; } .rich .ql-align-justify { text-align: justify; }
.rich .ql-size-small { font-size: .8em; } .rich .ql-size-large { font-size: 1.4em; } .rich .ql-size-huge { font-size: 2em; }
.rich iframe.ql-video { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; border-radius: 12px; }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border); transition: .15s;
}
a.file-row:hover { border-color: var(--accent-line); }
.file-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-hover); display: grid; place-items: center; flex-shrink: 0; }
.file-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.removing { opacity: .4; }

.lesson-complete { display: flex; justify-content: center; padding: 8px 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager-link {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); min-width: 0; transition: .15s;
}
.pager-link:hover { border-color: var(--accent-line); }
.pager-link span { display: flex; flex-direction: column; min-width: 0; font-weight: 700; font-size: 14px; }
.pager-link span small { font-weight: 600; }
.pager-link.next { justify-content: flex-end; text-align: right; grid-column: 2; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager-link.next { grid-column: auto; } }

.lesson-aside { position: sticky; top: 82px; }
@media (max-width: 980px) { .lesson-aside { position: static; } }
.aside-card { padding: 16px; }
.aside-title { display: flex; align-items: center; gap: 8px; font-weight: 800; padding: 4px 6px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: calc(100vh - 220px); overflow-y: auto; }
.aside-list a { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.aside-list a:hover { background: var(--card-2); color: var(--text); }
.aside-list a.current { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.aside-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; font-weight: 800; background: var(--card-2); color: var(--muted); margin-top: 1px; }
.aside-list a.done .aside-num { background: var(--success); color: #04150a; }
.aside-name { min-width: 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ============ Админка ============ */
.admin-tabs-wrap { border-bottom: 1px solid var(--border); background: var(--bg-2); position: sticky; top: 62px; z-index: 40; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 8px 0; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; white-space: nowrap;
  color: var(--muted); font-weight: 700; font-size: 14px;
}
.admin-tabs a:hover { color: var(--text); background: var(--card); }
.admin-tabs a.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 6px; max-width: 640px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 18px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 28px; font-weight: 800; line-height: 1.1; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.activity li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: 0; padding-bottom: 0; }
.activity a:hover { color: var(--accent-hover); }

.content-tree { display: grid; gap: 14px; }
.tree-section { padding: 0; overflow: hidden; }
.tree-section-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tree-icon { font-size: 22px; }
.tree-title { flex: 1; min-width: 160px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.tree-title a:hover { color: var(--accent-hover); }
.tree-actions { display: flex; gap: 6px; }
.tree-lessons { list-style: none; margin: 0; padding: 8px; min-height: 12px; display: grid; gap: 4px; }
.tree-lesson { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid transparent; }
.tree-lesson:hover { border-color: var(--border-2); }
.tree-lesson-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-lesson-title:hover { color: var(--accent-hover); }
.tree-lesson-meta { display: flex; align-items: center; gap: 6px; }
.tree-lesson-actions { display: flex; }
.tree-empty { padding: 4px 18px 16px; }
.drag-handle { cursor: grab; color: var(--muted); display: inline-grid; place-items: center; padding: 2px; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { background: var(--card-2) !important; }
.save-indicator { position: fixed; right: 20px; bottom: 20px; z-index: 60; padding: 10px 16px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border-2); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
@media (max-width: 560px) { .tree-lesson-meta { display: none; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select { width: auto; min-width: 200px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--card-2); }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 200px; }

.user-head { display: flex; align-items: center; gap: 16px; }
.user-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .user-grid { grid-template-columns: 1fr; } }
.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.progress-list li { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; align-items: center; font-size: 14px; }
.progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sessions li { display: flex; flex-direction: column; padding: 10px 12px; background: var(--bg-2); border-radius: 10px; }

.tariff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tariff-card { display: flex; flex-direction: column; gap: 10px; transition: border-color .15s; }
a.tariff-card:hover { border-color: var(--accent-line); }
.muted-card { background: transparent; border-style: dashed; }
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border-2); }

/* ============ Редактор Quill (тёмная тема) ============ */
.editor { min-height: 280px; }
.ql-toolbar.ql-snow { border: 1px solid var(--border-2); border-radius: 12px 12px 0 0; background: var(--card-2); padding: 8px; position: sticky; top: 124px; z-index: 5; }
.ql-container.ql-snow { border: 1px solid var(--border-2); border-top: 0; border-radius: 0 0 12px 12px; background: var(--bg-2); font-family: var(--font); font-size: 16px; color: var(--text); }
.ql-editor { min-height: 280px; line-height: 1.7; }
.ql-editor.ql-blank::before { color: #5d6678; font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--text-2); }
.ql-snow .ql-picker { color: var(--text-2); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-picker-label:hover .ql-stroke, .ql-snow .ql-picker-label.ql-active .ql-stroke { stroke: var(--accent-hover); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent-hover); }
.ql-snow.ql-toolbar button:hover, .ql-snow.ql-toolbar button.ql-active, .ql-snow .ql-picker-label:hover, .ql-snow .ql-picker-label.ql-active { color: var(--accent-hover); }
.ql-snow .ql-picker-options { background: var(--card); border-color: var(--border-2) !important; border-radius: 10px; }
.ql-snow .ql-picker.ql-expanded .ql-picker-label { border-color: var(--border-2); }
.ql-snow .ql-tooltip { background: var(--card); border: 1px solid var(--border-2); color: var(--text); box-shadow: var(--shadow); border-radius: 10px; z-index: 10; }
.ql-snow .ql-tooltip input[type=text] { background: var(--bg-2); color: var(--text); border: 1px solid var(--border-2); border-radius: 6px; padding: 4px 8px; width: 220px; }
.ql-snow .ql-tooltip a.ql-action, .ql-snow .ql-tooltip a.ql-remove { color: var(--accent-hover); }
.ql-snow a { color: var(--accent-hover); }
.ql-editor blockquote { border-left: 3px solid var(--accent) !important; padding-left: 14px; color: var(--text); }
.ql-editor .ql-code-block-container, .ql-snow .ql-editor pre.ql-syntax { background: var(--bg) !important; color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.ql-editor img { border-radius: 10px; }
@media (max-width: 900px) { .ql-toolbar.ql-snow { top: 116px; } }

/* Русские подписи редактора */
.ql-snow .ql-picker.ql-header .ql-picker-label::before, .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: 'Обычный текст'; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: 'Заголовок'; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: 'Подзаголовок'; }
.ql-snow .ql-picker.ql-header { width: 150px; }
.ql-snow .ql-tooltip::before { content: 'Ссылка:'; }
.ql-snow .ql-tooltip[data-mode=link]::before { content: 'Вставь ссылку:'; }
.ql-snow .ql-tooltip[data-mode=video]::before { content: 'Ссылка на видео:'; }
.ql-snow .ql-tooltip a.ql-action::after { content: 'Изменить'; }
.ql-snow .ql-tooltip a.ql-remove::before { content: 'Убрать'; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: 'Сохранить'; }

/* ============ Направления ============ */
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.track-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: 20px;
  border: 1px solid var(--border); transition: transform .15s, border-color .15s, box-shadow .15s; min-height: 220px;
  background:
    linear-gradient(180deg, rgba(10,12,17,.35), rgba(10,12,17,.92)),
    var(--cover, radial-gradient(420px 220px at 0% 0%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%)),
    var(--card);
  background-size: cover; background-position: center;
}
.track-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 16px 36px rgba(0,0,0,.4); }
.track-card h3 { font-size: 22px; }
.track-card p { font-size: 14px; color: var(--text-2); }
.track-top { display: flex; align-items: center; gap: 8px; }
.track-icon { font-size: 40px; line-height: 1; margin-right: auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.4)); }
.track-card .section-meta { margin-top: auto; }
.track-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: var(--accent-hover); }
.track-card.locked { filter: grayscale(.6); }
.track-card.draft { border-style: dashed; }

.tree-track { border: 1px solid var(--border); border-radius: 18px; background: var(--bg-2); padding: 10px; display: grid; gap: 10px; }
.tree-track.loose { border-style: dashed; }
.tree-track-head { display: flex; align-items: center; gap: 12px; padding: 6px 8px; flex-wrap: wrap; }
.tree-track-head strong { font-size: 17px; }
.tree-track-icon { font-size: 26px; }
.tree-sections { display: grid; gap: 10px; min-height: 16px; }
.tree-track > .tree-empty { padding: 0 10px 6px; }
