/* Панель управления: по макетам «Уроки», «Карточка урока», «Ученики». */
.layout { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.side {
  background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 32px 20px 24px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 22px; padding: 0 16px 28px; display: flex; gap: 8px; align-items: center; }
.side nav { display: grid; gap: 8px; }
.side nav a {
  color: rgba(255, 255, 255, .86); padding: 14px 16px; border-radius: 12px; font-size: 17px; font-weight: 600; text-decoration: none;
}
.side nav a:hover { background: var(--navy-2); color: #fff; }
.side nav a.active { background: var(--blue); color: #fff; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .12); padding: 18px 16px 0; color: rgba(255, 255, 255, .78); }
.side-foot .link-btn { color: rgba(255, 255, 255, .6); font-weight: 500; margin-top: 6px; font-size: 14px; }
.topbar { display: none; }

.main { padding: 40px 48px; max-width: 1400px; width: 100%; }
.loading { display: flex; justify-content: center; padding: 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.back { display: inline-block; color: var(--muted); margin-bottom: 6px; font-size: 16px; }

/* следующий урок */
.next {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 32px;
  border-left: 8px solid var(--green); display: flex; align-items: center; gap: 24px; margin-bottom: 24px;
}
.next .label { color: var(--green); font-weight: 800; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
.next h2 { font-size: 26px; margin: 6px 0; }
.next .grow { flex: 1; min-width: 0; }
.next.live { border-left-color: var(--red); }
.next.live .label { color: var(--red); }
.server-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #b8c0cc; display: inline-block; }
.dot.ready { background: var(--green); }
.dot.starting { background: #f0a020; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* таблицы */
.table-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 20px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; color: var(--muted); font-weight: 700; font-size: 15px; padding: 18px 16px 12px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
table.t td { padding: 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8fafd; }
table.t td.title { font-weight: 700; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* карточка урока */
.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
.stack { display: grid; gap: 28px; }
.card h3 { font-size: 20px; margin-bottom: 18px; display: flex; gap: 8px; align-items: center; }
.files { display: grid; }
.file { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.file .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--blue-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.file .name { font-weight: 700; word-break: break-word; }
.file .grow { flex: 1; min-width: 0; }
.file .ops { display: flex; gap: 4px; align-items: center; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 18px; min-width: 44px; min-height: 44px; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }
.drop {
  margin-top: 18px; border: 2px dashed #b9cbe3; border-radius: 14px; padding: 26px 16px; text-align: center;
  color: #4b6b97; cursor: pointer; transition: background .15s;
}
.drop b { color: var(--blue); }
.drop.over { background: var(--blue-soft); border-color: var(--blue); }
.rec { display: flex; gap: 20px; align-items: center; }
.thumb {
  width: 230px; aspect-ratio: 16/9; background: #121826; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-size: 36px; cursor: pointer; flex: none; border: 0;
}
.rec-meta b { font-size: 20px; display: block; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; }
.radio-card {
  display: flex; gap: 14px; padding: 16px 18px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer;
  margin-bottom: 12px; align-items: flex-start;
}
.radio-card input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.radio-card.on { border-color: var(--blue); background: var(--blue-soft); }
.radio-card b { display: block; font-size: 16px; }
.days { display: flex; align-items: center; gap: 14px; }
.days input { width: 110px; text-align: center; font-weight: 700; }
.section-title { font-size: 18px; font-weight: 700; margin: 22px 0 12px; display: flex; gap: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.danger { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ученики */
.students { display: grid; grid-template-columns: 1fr 440px; gap: 28px; align-items: start; }
.invite { position: sticky; top: 24px; }
.invite h2 { font-size: 26px; margin-bottom: 18px; }
.group-select { display: inline-flex; gap: 10px; align-items: center; }
.group-select select { height: 40px; width: auto; min-width: 180px; font-size: 15px; }
.badge-note { background: var(--amber-soft); color: #7a5410; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }

/* видео в окне */
.player { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 16/9; }

@media (max-width: 1100px) {
  .grid-2, .students { grid-template-columns: 1fr; }
  .invite { position: static; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 800; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .topbar {
    display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 12px 16px;
    position: sticky; top: 0; z-index: 700;
  }
  .burger { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; width: 44px; height: 44px; }
  .main { padding: 20px 16px 60px; }
  h1 { font-size: 26px; }
  .next { flex-direction: column; align-items: stretch; padding: 20px; }
  .next .btn { width: 100%; }
  .card { padding: 20px; }
  .rec { flex-direction: column; align-items: stretch; }
  .thumb { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .page-head { margin-bottom: 20px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .main { min-width: 0; }
  .page-head .actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .page-head .actions .btn { width: 100%; }
  .page-head .actions .group-select { width: 100%; }
  .page-head .actions .group-select select { flex: 1; }
  .table-card { padding: 4px 8px; }
  table.t th, table.t td { padding: 12px 8px; }
  /* на телефоне в таблице уроков — дата, название и запись */
  table.t.lessons td:first-child { white-space: normal !important; font-size: 13px; min-width: 76px; }
  table.t.lessons .chip { font-size: 12px; padding: 3px 8px; }
  table.t.lessons .chip { white-space: normal; text-align: center; }
  .file { flex-wrap: wrap; gap: 10px 14px; }
  .file .grow { flex: 1 1 calc(100% - 64px); }
  .file .chip { margin-left: 60px; }
  .file .ops { margin-left: auto; }
  .next h2 { font-size: 22px; }
  .students .table-card td:nth-child(3), .students .table-card th:nth-child(3) { display: none; }
}

/* упрощённая панель */
.start-step { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.start-step:last-child { border-bottom: 0; }
.start-step .num { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.start-step.done .num { background: var(--green); }
.start-step.done .grow { color: var(--muted); text-decoration: line-through; }
.start-step .grow { flex: 1; }
.sub { font-weight: 400; margin-top: 2px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.filter.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.toggle-row { cursor: pointer; min-height: 48px; }
.invite-result { margin-top: 16px; background: var(--green-soft); border-radius: 14px; padding: 14px 16px; }
.invite-list { max-height: 260px; overflow: auto; }
.invite-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.invite-item .grow { flex: 1; min-width: 0; word-break: break-all; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.settings-grid h2 { margin-bottom: 16px; }
td.soon { color: #b42323; font-weight: 700; }
.name-btn { color: var(--text) !important; text-align: left; padding-left: 0; }
.group-select { display: inline-flex; gap: 10px; align-items: center; }
.group-select select { height: 44px; width: auto; min-width: 200px; font-size: 15px; }
details summary { cursor: pointer; display: inline-block; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .students-t th:nth-child(3), .students-t td:nth-child(3) { display: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter { white-space: nowrap; }
}

/* выбор цвета школы */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; position: relative; padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--text); }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(#e44, #ec4, #4c4, #4cc, #44e, #c4c, #e44); overflow: hidden; }
.swatch.custom span { color: #fff; font-weight: 800; font-size: 20px; text-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none; }
.swatch.custom .color-pick { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.hint-box { background: var(--blue-soft); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; margin: 4px 0 12px; }
.settings-grid .file { flex-wrap: wrap; }
.settings-grid .file .grow { flex: 1 1 220px; }
.settings-grid .file .ops { flex-wrap: wrap; }

/* ---------- шлифовка панели: логотип, отметка раздела, акцент ---------- */
.brand { font-size: 18px; line-height: 1.25; align-items: flex-start; gap: 10px; text-wrap: balance; }
.brand-mark { color: var(--gold); font-size: 22px; line-height: 1; margin-top: 1px; flex: none; }
.side nav a { position: relative; transition: background-color .15s ease-out, color .15s ease-out; }
.side nav a.active { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.side nav a.active::before {
  content: ""; position: absolute; left: -20px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--gold);
}
.page-head h1 { position: relative; padding-bottom: 10px; }
.page-head h1::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px; border-radius: 3px; background: var(--gold);
}
.start-step .num { background: var(--gold); }
.swatch { transition: transform .15s ease-out, box-shadow .15s ease-out; }
.swatch:hover { transform: translateY(-1px); }
.hint-box { border-left: 3px solid var(--gold); }
.topbar b { text-wrap: balance; line-height: 1.25; }

/* узор школы */
html[data-decor] .side, html[data-decor] .topbar {
  background-image: var(--decor-mark), var(--decor-tile);
  background-repeat: no-repeat, repeat; background-size: 360px, var(--decor-tile-size);
  background-position: 50% calc(100% + 150px), 0 0;
}
html[data-decor] .topbar { background-size: 0, var(--decor-tile-size); }
html[data-decor="astro"] .main { position: relative; isolation: isolate; }
html[data-decor="astro"] .main::before {
  content: ""; position: absolute; z-index: -1; top: -170px; right: -170px; width: 440px; height: 440px;
  background: var(--decor-mark) center / contain no-repeat; opacity: .38; pointer-events: none;
}
@media (max-width: 820px) { html[data-decor="astro"] .main::before { width: 300px; height: 300px; top: -140px; right: -150px; opacity: .3; } }
html[data-decor] .main { overflow: hidden; }
.decor-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.decor-opt {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 600; cursor: pointer;
  transition: border-color .15s ease-out, background-color .15s ease-out;
}
.decor-opt:hover { border-color: var(--blue); }
.decor-opt.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.decor-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--navy); color: var(--gold); font-size: 14px; }

/* субтитры */
.subs-btn { border: 0; background: none; padding: 4px 0; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; }
.subs-list { max-height: 46vh; overflow: auto; display: grid; gap: 6px; padding-right: 4px; margin-bottom: 14px; }
.subs-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; }
.subs-row .subs-time { padding-top: 10px; }
.subs-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; text-align: right; }
.subs-row textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; line-height: 1.35; width: 100%; resize: none; }
.modal:has(.subs-list) { width: min(760px, 100%); }
.subs-row textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.subs-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* таблицы на телефоне: каждая строка — карточка, название сверху, без прокрутки вбок */
@media (max-width: 640px) {
  table.t, table.t tbody { display: block; width: 100%; }
  table.t thead { display: none; }
  table.t tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 14px 6px; border-bottom: 1px solid var(--line); }
  table.t tr:last-child { border-bottom: 0; }
  table.t td { display: block; padding: 0; border: 0; }
  table.t td.title, .students-t td:first-child { order: -1; flex: 1 1 100%; font-size: 16px; }
  table.t td:empty { display: none; }
  table.t td .chip { white-space: nowrap; }
  .students .table-card td:nth-child(3) { display: block; }
  .table-card { overflow-x: visible; }
}
.subs-row textarea[rows="1"] { min-height: 40px; }
