/* ZeroForm-Обучалка — монохром. Цветов, кроме серых, нет намеренно. */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --border: #242424;
  --border-strong: #3a3a3a;
  --text: #fafafa;
  --text-2: #a1a1a1;
  --text-3: #6b6b6b;
  --radius: 8px;
  --w: 1200px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 Inter, "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 32px; line-height: 1.25; font-weight: 600; margin: 0 0 24px; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 600; margin: 0 0 16px; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.muted { color: var(--text-2); font-size: 13px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  max-width: var(--w); margin: 0 auto;
}
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand span { color: var(--text-3); }
.top-nav { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.top-nav a { color: var(--text-2); }
.top-nav a:hover { color: var(--text); }

main { max-width: var(--w); margin: 0 auto; padding: 48px 24px 80px; }
main.wide { max-width: 100%; }
.bottom {
  max-width: var(--w); margin: 0 auto; padding: 24px;
  border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px;
}

/* Формы */
.auth { max-width: 380px; margin: 60px auto; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
input, select, textarea {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; font: inherit; font-size: 15px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); }
.btn {
  display: inline-block; background: var(--text); color: var(--bg);
  border: 1px solid var(--text); border-radius: var(--radius);
  padding: 10px 20px; font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-align: center;
}
.btn:hover { background: #fff; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--text); background: transparent; }
button.link {
  background: none; border: none; color: var(--text-2);
  font: inherit; font-size: 14px; cursor: pointer; padding: 0;
}
button.link:hover { color: var(--text); text-decoration: underline; }

/* Сообщения — без цвета, только рамка и знак */
.alert, .ok {
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.alert::before { content: "! "; font-weight: 600; }
.ok::before { content: "✓ "; font-weight: 600; }

/* Карточки каталога */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card:hover { border-color: var(--border-strong); }
.card.locked { opacity: 0.5; cursor: default; }
.cover {
  aspect-ratio: 16 / 9; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
.card:hover .cover img { filter: grayscale(1) brightness(1.1); }
.lock { font-size: 12px; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 2px 8px; }
.card-body { padding: 14px 16px 16px; }

.empty { text-align: center; padding: 80px 20px; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h1 { margin-bottom: 8px; }

/* Панели и таблицы */
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; background: var(--surface); }
.panel h2 { display: flex; align-items: baseline; gap: 12px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 400; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 12px 8px 0; }
.table td { padding: 10px 12px 10px 0; border-top: 1px solid var(--border); vertical-align: middle; }
.tag { font-size: 11px; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }

@media (max-width: 768px) {
  main { padding: 32px 16px 60px; }
  h1 { font-size: 26px; }
  .top { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
}

/* ── Страницы плейлиста и урока ─────────────────────────────────────────── */
.back { display: inline-block; color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.back:hover { color: var(--text); }
.lead { margin-top: -16px; margin-bottom: 20px; }
.desc { color: var(--text-2); max-width: 70ch; margin-bottom: 24px; }

.lessons { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.lessons li { border-bottom: 1px solid var(--border); }
.lessons a { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 16px; align-items: center; padding: 16px 8px; }
.lessons a:hover { background: var(--surface); }
.num { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.ttl { font-weight: 500; }
.meta { color: var(--text-2); font-size: 13px; }
.dur { font-size: 13px; font-variant-numeric: tabular-nums; }
.bar { height: 2px; background: var(--border); }
.bar i { display: block; height: 100%; background: var(--text-2); }

.lesson-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 32px; align-items: start; }
/* Пропорции держит контейнер, а не сам <video>: Safari считает размеры
   replaced-элементов по-своему и с aspect-ratio на видео плывёт вёрстка. */
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 78vh;
  background: #000; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.player video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
/* Запасной путь для старых Safari без aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .player { height: 0; padding-top: 56.25%; }
}
.wm {
  position: absolute; top: 12%; left: 8%; pointer-events: none; user-select: none;
  color: rgba(255,255,255,0.30); font-size: 13px; letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6); transition: top 1.2s ease, left 1.2s ease; z-index: 2;
}
.lesson-side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); font-weight: 400; }
.side-list { list-style: none; padding: 0; margin: 0; }
.side-list a { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); }
.side-list a:hover { background: var(--surface); color: var(--text); }
.side-list li.cur a { background: var(--surface-2); color: var(--text); }
.side-list .done { margin-left: auto; color: var(--text-3); }
.files { list-style: none; padding: 0; margin: 0; }
.files li { padding: 8px 0; border-top: 1px solid var(--border); }
.files a { text-decoration: underline; text-underline-offset: 3px; }

/* ── Админка ─────────────────────────────────────────────────────────────── */
.head-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.head-row h1 { margin: 0; }
.actions { display: flex; gap: 10px; }
.kv4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin: 0; }
.kv4 dt { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.kv4 dd { margin: 0; font-size: 20px; font-weight: 600; }
.panel.warn { border-color: var(--border-strong); }
.table td.right { text-align: right; white-space: nowrap; }
.table td.right form { display: inline-block; margin-left: 12px; }
.form.narrow { max-width: 520px; }
.form label.row { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form label.row input { width: auto; }
textarea { resize: vertical; font-family: inherit; }
input[type="file"] { padding: 8px; background: var(--surface-2); }
.progress { margin-top: 12px; }
.pbar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.pbar i { display: block; height: 100%; width: 0; background: var(--text); transition: width 0.2s; }

@media (max-width: 900px) {
  .lesson-wrap { grid-template-columns: 1fr; }
  .lesson-side { order: 2; }
  .lessons a { grid-template-columns: 32px 1fr auto; }
  .lessons .meta { display: none; }
}

/* ── Пользователи и доступы ──────────────────────────────────────────────── */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.more { margin-top: 16px; }
.more summary { cursor: pointer; color: var(--text-2); font-size: 14px; padding: 8px 0; }
.more summary:hover { color: var(--text); }
.link-a { color: var(--text-2); font-size: 14px; }
.link-a:hover { color: var(--text); text-decoration: underline; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-size: 13px; }
@media (max-width: 768px) { .two { grid-template-columns: 1fr; } }
.plain { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.plain li { padding: 10px 0; border-top: 1px solid var(--border); color: var(--text-2); }
.plain b { color: var(--text); }


/* ── Мобильная версия: правки после прогона на телефоне ─────────────────── */
@media (max-width: 768px) {
  /* Шапка: переносим на вторую строку вместо сжатия */
  .top { flex-wrap: wrap; gap: 10px 18px; padding: 14px 16px; }
  .brand { font-size: 16px; }
  .top-nav { gap: 16px; font-size: 13px; }

  /* Кнопки админки: в две колонки, а не в одну строку за край экрана */
  .head-row { gap: 12px; margin-bottom: 20px; }
  .head-row h1 { width: 100%; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .actions .btn { padding: 12px 10px; font-size: 14px; }

  /* Панели и таблицы: панель фиксирует свою ширину (contain), широкая
     таблица скроллится ВНУТРИ неё, а не распирает страницу. Только
     overflow-x:auto без contain <table> не удерживает — проверено замером. */
  main { overflow-x: hidden; }
  .panel { padding: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; contain: inline-size; }
  .table { min-width: 460px; }
  .table th { font-size: 11px; }
  .table td { padding: 12px 10px 12px 0; }
  /* Действия в строке — столбиком, чтобы не растягивать таблицу */
  .table td.right { text-align: left; }
  .table td.right form { display: block; margin: 0 0 6px; }
  .table td.right form:last-child { margin-bottom: 0; }

  /* Показатели состояния — две колонки, читаемо */
  .kv4 { grid-template-columns: 1fr 1fr; gap: 16px; }
  .kv4 dd { font-size: 18px; }

  /* Формы и чекбоксы */
  .checks { grid-template-columns: 1fr; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }
  .form.narrow, .auth { max-width: 100%; }
  /* Поля крупнее 16px — иначе iOS зумит страницу при фокусе */
  input, select, textarea { font-size: 16px; }
}

@media (max-width: 420px) {
  .actions { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
  .panel { padding: 14px; }
}


/* ── Топбар с бургером ───────────────────────────────────────────────────── */
.top { justify-content: flex-start; gap: 14px; }
.top-spacer { flex: 1; }
.burger {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 9px 8px; background: none; border: none;
  cursor: pointer; border-radius: 8px; flex-shrink: 0;
}
.burger:hover { background: var(--surface); }
.burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: 0.2s; }

/* ── Боковая панель ──────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); opacity: 0;
  visibility: hidden; transition: opacity 0.25s; z-index: 40;
}
.scrim.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 84vw;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 50;
  transform: translateX(-100%); transition: transform 0.25s ease;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
}
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-2); font-size: 16px; cursor: pointer; border-radius: 8px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.drawer-nav { display: flex; flex-direction: column; padding: 12px 12px; gap: 2px; }
.drawer-link {
  padding: 12px 14px; border-radius: 10px; color: var(--text-2); font-size: 15px; font-weight: 500;
}
.drawer-link:hover { background: var(--surface-2); color: var(--text); }

.drawer-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }
.profile-card {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
}
.profile-card:hover { border-color: var(--border-strong); }
.profile-meta { min-width: 0; display: flex; flex-direction: column; }
.profile-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { font-size: 12px; color: var(--text-2); }
.drawer-logout {
  width: 100%; margin-top: 8px; padding: 10px; background: none; border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer;
}
.drawer-logout:hover { border-color: var(--border-strong); color: var(--text); }

/* ── Аватар (круг: фото или инициалы) ────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 700;
  background-size: cover; background-position: center; overflow: hidden; letter-spacing: 0.02em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* ── Кабинет: шапка профиля и загрузка фото ──────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-head-name { font-size: 18px; font-weight: 600; }
.avatar-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.file-btn {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer;
}
.file-btn:hover { border-color: var(--text); }
.file-btn input { display: none; }
.avatar-form form { margin: 0; }

/* Ссылки под формами входа/регистрации */
.auth-links { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; font-size: 14px; flex-wrap: wrap; }
.auth-links a { color: var(--text-2); }
.auth-links a:hover { color: var(--text); text-decoration: underline; }
.auth-links a.btn { color: var(--bg); text-decoration: none; }

/* ── Лендинг и тарифы ─────────────────────────────────────────────────────── */
.landing { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 16px; }
.hero-sub { color: var(--text-2); font-size: 17px; line-height: 1.6; max-width: 560px; margin: 0 auto; }
.tariffs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0 32px; }
.tariff { border: 1px solid var(--border); border-radius: 16px; padding: 28px; background: var(--surface); display: flex; flex-direction: column; }
.tariff-pro { border-color: var(--text); }
.tariff-name { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.tariff-pro .tariff-name { color: var(--text); }
.tariff-price { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 20px; }
.tariff-price span { font-size: 15px; font-weight: 400; color: var(--text-3); }
.tariff-feats { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.tariff-feats li { font-size: 14px; color: var(--text-2); padding-left: 22px; position: relative; }
.tariff-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--text); font-weight: 700; }
.tariff .btn { width: 100%; }
.landing-login { text-align: center; color: var(--text-2); font-size: 14px; padding: 8px 0 48px; }
.landing-login a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 700px) {
  .hero h1 { font-size: 30px; }
  .tariffs { grid-template-columns: 1fr; }
}

/* Раздел «Разработки» */
.dev-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.dev-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.dev-info { flex: 1; min-width: 0; }
.dev-title { font-weight: 600; margin-bottom: 2px; }
.dev-meta { font-size: 12px; margin-top: 4px; }
.dev-item .btn { flex-shrink: 0; }

/* Вложения урока (админ) + locked-pro блок */
.att-list { list-style: none; padding: 0; margin: 0; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.att-name { font-size: 14px; }
.files { list-style: none; padding: 0; margin: 0; }
.files li { padding: 8px 0; border-top: 1px solid var(--border); }
.files a { text-decoration: underline; text-underline-offset: 3px; }
.locked-pro { border-style: dashed; text-align: center; }
.locked-pro .btn { margin-top: 8px; }
