/* ─────────────────────────────────────────────────────────────────────────────
   app-fixes.css — слой правок к app.css (v26)
   Подключать ПОСЛЕ app.css:
     <link rel="stylesheet" href="/static/app.css?v=platform-v26">
     <link rel="stylesheet" href="/static/app-fixes.css?v=fixes-v12">
   Либо перенести содержимое в конец app.css одним блоком.

   Каждый пункт помечен номером дефекта из «Аудит и ТЗ». Ничего, кроме
   перечисленного, слой не меняет: он не вводит новых цветов, шрифтов и
   компонентов — только доводит существующие до одного состояния.
   ───────────────────────────────────────────────────────────────────────── */


/* Д1, Д13 — недостающие токены.
   `--radius-lg` использовался в app.css:6884 и 6890, но не был объявлен нигде:
   объявление становилось невалидным на этапе вычисления значения, и карточка
   «С чего начать?» вместе с панелями правой колонки получала border-radius: 0
   на десктопе — при 12px у тех же панелей на телефоне.
   Белые значения рамки и фона панели (app.css:6870, 6876) в тёмной теме давали
   яркую обводку и молочную панель, поэтому они тоже стали токенами. */
:root {
  --radius-lg: 18px;
  --card-edge: rgba(255, 255, 255, 0.8);
  --rail-bg: rgba(255, 255, 255, 0.45);
  /* Д11 — цвет текста статуса отдельно от цвета плашки: --warn/--ok рассчитаны
     на фон, а не на надпись поверх него. */
  --warn-ink: #8a5a09;
  --ok-ink: #16764a;
}

html[data-theme="dark"] {
  --card-edge: rgba(255, 255, 255, 0.07);
  --rail-bg: rgba(255, 255, 255, 0.03);
  --warn-ink: #e9b765;
  --ok-ink: #5fcf9b;
}

@media (min-width: 861px) {
  main.site-shell[data-conversation] {
    border-color: var(--card-edge);
  }

  main.site-shell[data-conversation] .site-sidebar {
    background: var(--rail-bg);
  }
}

/* Д2 — `--ink-soft` не объявлен (app.css:2084): цвет не применялся вовсе. */
.retrieved__preview {
  color: var(--ink);
}

.pill--ok,
.site-provenance__state {
  color: var(--ok-ink);
}

/* Д11 — контраст надписи на цветной плашке. Warning идёт после общего provenance state,
   иначе селектор с тем же весом перекрасит предупреждение в зелёный. */
.pill--warn,
.site-provenance__state--warn {
  color: var(--warn-ink);
}

.readiness-summary__list {
  color: var(--ink);
}


/* Д7 — одна типографика на экран.
   Последний слой app.css (6740) снял моноширинный капслок только с `.site-kicker`
   и `.site-source-chip-row__label`. Остальные надписи из той же группы правил
   (app.css:1060) остались капслоком: заголовки панелей «ФОКУС НА СЕГОДНЯ»,
   «АКТИВНОСТЬ», метки «ВОПРОС»/«АССИСТЕНТ», подписи KPI. */
main.site-shell .site-panel__head h3,
main.site-shell .site-sidebar__title,
main.site-shell .site-drawer__label,
.profile-workspace .kpi__label,
.profile-workspace .site-stat span {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

main.site-shell .site-sidebar__title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

main.site-shell .site-bubble__label,
main.site-shell .site-exchange__label {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

/* Вкладки профиля выглядели как служебная навигация консоли: моноширинный
   капслок с подчёркиванием. Тот же выбор из двух состояний, что и «Тема» или
   «Размер текста» в настройках, — значит и вид тот же. */
.profile-workspace > .tabs {
  display: inline-flex;
  /* Родитель — grid, в нём inline-flex блокифицируется и растягивается по колонке: нужен
     justify-self, а не align-self (тот управляет поперечной осью). */
  justify-self: start;
  max-width: 100%;
  gap: 6px;
  margin-top: 8px;
  padding: 5px;
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: visible;
}

.profile-workspace > .tabs .tab {
  top: 0;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.profile-workspace > .tabs .tab.is-active {
  border-color: var(--accent-border);
  border-bottom-width: 1px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}


/* Д8, Д9 — одна ось чтения.
   Профиль и команда центрировали содержимое в собственной колонке 1100px внутри
   сцены, у которой уже есть свои отступы: левый край текста не совпадал ни с
   краем панели, ни с осью чата. `main.profile-shell` (app.css:6755) при этом
   вообще не срабатывало — profile.html отдаёт `<section class="profile-shell">`,
   а не `<main>`. */
.site-stage > .profile-shell,
.site-stage > .courses-shell,
.site-stage > .console {
  width: 100%;
  max-width: 1100px;
  margin-right: auto;
  margin-left: 0;
  padding-top: 0;
}

@media (min-width: 861px) {
  main.site-shell .site-stage {
    padding: 25px 32px 30px;
  }
}


/* Д6 — стартовая карточка чата одна и та же на всех ширинах.
   На десктопе она уже карточка (app.css:6880), а ниже 861px оставалась
   прозрачным блоком с декоративной синей полосой слева. */
@media (max-width: 860px) {
  main.site-shell .site-hero-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    background-image: none;
    box-shadow: var(--shadow);
  }

  main.site-shell .site-hero-card::before {
    display: none;
  }
}


/* Д3 — провал 701–860px.
   Градиентная шапка чата была описана дважды: в `min-width: 861px` и в
   `max-width: 700px`. Между ними — планшет и половина ноутбуков в оконном
   режиме: шапки нет, а `.site-topbar__intro` при этом скрыт (app.css:6250).
   Оформление переносится на весь диапазон «не десктоп». */
@media (max-width: 860px) {
  main.site-shell[data-conversation] .site-topbar--home {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    margin-bottom: 18px;
    padding: 24px 22px;
    overflow: hidden;
    border-radius: 23px;
    color: #fff;
    background: linear-gradient(112deg, #495fd2 0%, #6875e7 48%, #9a74eb 100%);
    box-shadow: 0 16px 30px rgb(82 105 223 / 22%);
  }

  main.site-shell[data-conversation="empty"] .site-topbar--home .site-topbar__intro {
    display: block;
  }

  main.site-shell[data-conversation] .site-topbar--home .site-kicker {
    color: rgb(255 255 255 / 75%);
  }

  main.site-shell[data-conversation] .site-topbar--home h2 {
    max-width: none;
    color: #fff;
    font-size: clamp(22px, 5vw, 28px);
  }

  main.site-shell[data-conversation] .site-topbar--home p {
    color: rgb(255 255 255 / 76%);
  }

  main.site-shell[data-conversation] .site-topbar--home .site-topbar__compact-title {
    display: none;
  }
}

/* Плашки со счётчиками стоят на градиенте, а не на фоне страницы: --accent-soft
   на нём читается как случайная вставка, а в тёмной теме — как тёмное пятно на
   светлом. */
main.site-shell[data-conversation] .site-topbar--home .site-hero-stat {
  border-color: rgb(255 255 255 / 24%);
  background: rgb(255 255 255 / 14%);
}

main.site-shell[data-conversation] .site-topbar--home .site-hero-stat strong {
  color: #fff;
}

main.site-shell[data-conversation] .site-topbar--home .site-hero-stat span {
  color: rgb(255 255 255 / 78%);
}


/* ── Exact prototype port ───────────────────────────────────────────────────
   The authoritative visual source is `Прототип ТехКон.dc.html` from the approved design archive.
   Keep this final layer deliberately small and scoped: the existing selectors/data contracts remain
   intact, while shell geometry, blue palette, rail behavior, chat composition and responsive drawer
   match the prototype's 1440/390 states. */
:root {
  --bg: #f3f6fa;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: #eaeff5;
  --ink: #132033;
  --muted: #5f6b80;
  --border: #e3e9f1;
  --border-strong: #d2dbe6;
  --accent: #1f6ba8;
  --accent-strong: #164f80;
  --accent-soft: #e6f1fa;
  --accent-border: rgba(31, 107, 168, 0.28);
  --brand-deep: #132a4d;
  --brand-light: #69c7e8;
  --ok: #26a269;
  --ok-bg: #e9f8f0;
  --ok-border: #ccebd9;
  --ok-ink: #16764a;
  --warn: #de9b38;
  --warn-bg: #fff5e5;
  --warn-border: #f5dfb3;
  --warn-ink: #8a5a09;
  --danger: #a3241c;
  --danger-bg: #fbe9e7;
  --danger-border: #ecb6af;
  --radius: 20px;
  --radius-lg: 18px;
  --card-edge: rgba(255, 255, 255, 0.8);
  --rail-bg: rgba(255, 255, 255, 0.45);
  --shadow: 0 8px 24px rgba(19, 42, 77, 0.08);
  /* Эти два остались от прошлой (индиговой) палитры: подсветка при наведении светилась сиреневым
     поверх синей темы, а тень оболочки уводила её край в фиолетовый. */
  --interactive-hover: var(--accent-soft);
  --shadow-shell: 0 24px 70px rgba(19, 42, 77, 0.11);
}

html[data-theme="dark"] {
  --bg: #0e1520;
  --surface: rgba(21, 30, 45, 0.92);
  --surface-2: #182231;
  --ink: #eaf0f8;
  --muted: #95a3ba;
  --border: #28344a;
  --border-strong: #37465e;
  --accent: #3d8ecb;
  --accent-strong: #7cbde8;
  --accent-soft: #12314a;
  --accent-border: rgba(105, 199, 232, 0.32);
  --brand-deep: #0e2440;
  --brand-light: #69c7e8;
  --ok: #4cc38a;
  --ok-bg: #173a2c;
  --ok-border: #1f4a34;
  --ok-ink: #5fcf9b;
  --warn: #de9b38;
  --warn-bg: #3d301c;
  --warn-border: #4a3a20;
  --warn-ink: #e9b765;
  --danger: #f09087;
  --danger-bg: #3a1b1b;
  --danger-border: #6a302d;
  --card-edge: rgba(255, 255, 255, 0.07);
  --rail-bg: rgba(255, 255, 255, 0.03);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  --interactive-hover: var(--accent-soft);
  --shadow-shell: 0 24px 70px rgba(0, 0, 0, 0.28);
  /* Белая подпись на светло-синей кнопке тёмной темы давала 3.5:1, а при наведении (accent-strong
     светлее фона) подпись пропадала совсем. Все места, где используется этот токен, — текст
     поверх --accent или градиента от него, поэтому тёмная подпись подходит везде. */
  --accent-ink: #0e1520;
}

/* Второй селектор перекрывает индиговое свечение из app.css: у экрана чата фон был сиреневый,
   у всех остальных страниц — синий. */
body:has(main.site-shell),
body:has(main.site-shell[data-conversation]) {
  background:
    radial-gradient(circle at 76% -10%, rgb(105 199 232 / 16%), transparent 32rem),
    radial-gradient(circle at -8% 74%, rgb(31 107 168 / 10%), transparent 30rem),
    var(--bg);
}

main.site-shell {
  display: grid;
  width: min(1440px, calc(100% - 32px));
  max-width: none;
  min-height: calc(100dvh - 32px);
  margin: 16px auto;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--card-edge);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(35, 48, 86, 0.11);
  /* A backdrop filter makes this card the containing block for fixed descendants. The rail must
     stay attached to the viewport while long pages scroll, so the surface uses its own colour. */
  backdrop-filter: none;
}

main.site-shell .site-sidebar {
  /* The page can be much taller than the viewport (console, course authoring). Keep account
     actions and navigation available instead of stretching the rail to the document height. */
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 40;
  width: 244px;
  min-height: 0;
  height: calc(100dvh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 24px 16px 18px;
  overflow-y: auto;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--rail-bg);
  box-shadow: none;
}

main.site-shell .site-sidebar__head {
  padding: 4px 8px 2px;
}

main.site-shell .site-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: auto;
}

main.site-shell .workspace-nav__row {
  display: flex;
  align-items: center;
  gap: 2px;
}

main.site-shell .workspace-nav__row .workspace-nav__tab {
  flex: 1;
}

main.site-shell .workspace-nav__tab {
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 500;
}

main.site-shell .workspace-nav__tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

main.site-shell .workspace-nav__add {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
}

main.site-shell .site-sidebar__section {
  gap: 2px;
}

main.site-shell .site-sidebar__title,
main.site-shell .site-panel__head h3 {
  color: var(--muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

main.site-shell .site-sidebar__foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

main.site-shell .site-sidebar__foot .site-account {
  min-height: 34px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

main.site-shell .site-sidebar__foot .site-account:hover,
main.site-shell .site-account__theme:hover {
  background: var(--surface-2);
}

main.site-shell .site-account__theme {
  width: auto;
  height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: left;
}

/* Prototype account rows use the text label itself; retain the hidden marker in
   the DOM so auth.js can keep the control's accessible name stable. */
main.site-shell .site-account__mark {
  display: none;
}

main.site-shell .site-stage {
  min-width: 0;
  padding: 25px 32px 30px;
  overflow: hidden;
}

main.site-shell .site-topbar--home {
  display: flex;
  align-items: center;
  width: min(100%, 840px);
  min-height: 0;
  margin: 0 auto 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

main.site-shell .site-topbar--home .site-topbar__intro {
  max-width: none;
}

main.site-shell .site-topbar--home .site-topbar__intro h2 {
  margin: 0;
  max-width: none;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

main.site-shell .site-topbar__description,
main.site-shell .site-hero-stats,
main.site-shell .site-topbar--home .site-kicker {
  display: none;
}

main.site-shell .site-topbar--home .site-topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

main.site-shell .site-topbar--home .site-toggle {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

/* The previous prototype-parity rules target the conversation shell with higher specificity.
   This exact-prototype override intentionally wins over that older gradient hero. */
main.site-shell[data-conversation] .site-topbar--home {
  min-height: 0;
  margin-bottom: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

/* An active chat has no hero copy above the thread. Keep only the small breathing room needed
   for the share control; the previous stage padding made an empty band look like a second panel. */
main.site-shell[data-conversation] .site-stage {
  padding-top: 8px;
  padding-bottom: 12px;
}

/* The compact chat header is intentionally transparent.  The older gradient-header
   decoration is more specific than the reset above, so its two circular outlines leaked into
   the page as unexplained diagonal stripes (especially visible in the dark theme). */
main.site-shell[data-conversation] .site-topbar--home::before,
main.site-shell[data-conversation] .site-topbar--home::after {
  display: none;
}

main.site-shell[data-conversation] .site-topbar--home .site-topbar__intro h2 {
  color: var(--ink);
  font-size: 1.05rem;
}

main.site-shell[data-conversation] .site-topbar--home .site-topbar__description,
main.site-shell[data-conversation] .site-topbar--home .site-kicker {
  display: none;
}

main.site-shell .site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 17px;
  width: min(100%, 840px);
  min-height: 0;
  margin: 0 auto;
}

main.site-shell .site-chat-column {
  max-width: none;
}

main.site-shell .site-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding-bottom: 8px;
  overflow-y: auto;
  justify-content: safe center;
}

main.site-shell[data-conversation="active"] .site-scroll {
  justify-content: flex-start;
}

/* A short refusal/answer should not reserve the whole viewport before the composer. Keep a
   readable scroll area for long answers, but let a short conversation collapse to its content. */
main.site-shell[data-conversation="active"] .site-chat-column {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  align-content: stretch;
}

main.site-shell[data-conversation="active"] .site-scroll {
  max-height: none;
}

main.site-shell .site-new-answer {
  grid-row: 1;
  align-self: end;
  justify-self: center;
  position: relative;
  z-index: 5;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

main.site-shell .site-new-answer:hover {
  background: var(--accent-soft);
}

main.site-shell .site-review-context {
  display: flex;
  align-items: center;
  gap: 7px;
  width: auto;
  max-width: min(440px, 48vw);
  margin: 0;
  padding: 4px 6px 4px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
}

main.site-shell .site-review-context__copy {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

main.site-shell .site-review-context__label,
main.site-shell .site-review-context__lesson {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

main.site-shell .site-review-context strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

main.site-shell .site-review-context .site-toggle {
  flex: none;
  padding: 4px 8px;
  border-color: transparent;
  background: var(--surface);
  font-size: 0.72rem;
  line-height: 1.2;
}

main.site-shell[data-review-mode] #site-focus-column {
  display: none !important;
}

@media (max-width: 640px) {
  main.site-shell .site-review-context {
    max-width: min(100%, 62vw);
    gap: 4px;
  }

  main.site-shell .site-review-context__label {
    display: none;
  }
}

main.site-shell .answer__brief {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: var(--accent-soft);
}

main.site-shell .answer__brief::before {
  content: "Кратко";
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

main.site-shell .site-hero-card {
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

main.site-shell .site-hero-card__head {
  display: block;
}

main.site-shell .site-hero-card h3 {
  margin: 2px 0 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

main.site-shell .site-hero-card__head p,
main.site-shell .site-note,
main.site-shell .site-source-chip-row__label {
  font-size: 0.86rem;
  line-height: 1.5;
}

main.site-shell .site-hero-card__head p {
  margin: 4px 0 0;
}

main.site-shell .site-scenario-picker {
  margin: 14px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

main.site-shell .site-scenario-options,
main.site-shell .site-chip-list--hero {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

main.site-shell .site-scenario-option {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

main.site-shell .site-scenario-option.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

main.site-shell .site-recommendations-head {
  margin: 13px 0 9px;
}

main.site-shell .site-chip {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 500;
}

main.site-shell .site-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

main.site-shell .site-composer__label { display: none; }

main.site-shell .site-composer textarea {
  height: 28px;
  min-height: 28px;
  max-height: 180px;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.45;
  overflow-y: auto;
  resize: none;
}

main.site-shell .site-composer textarea:focus-visible { outline: 0; }

main.site-shell .site-composer__footer {
  min-height: 30px;
}

main.site-shell .site-attach-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
}

main.site-shell .site-voice-button {
  font-size: 1.1rem;
  font-weight: 800;
}

main.site-shell .site-voice-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

main.site-shell .site-voice-button.is-recording {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
  animation: voice-recording-pulse 1.1s ease-in-out infinite;
}

.site-voice-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 2px 6px 2px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.site-voice-preview[hidden] { display: none; }

@keyframes voice-recording-pulse {
  50% { transform: scale(0.94); opacity: 0.78; }
}

main.site-shell .site-send-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
}

main.site-shell .site-exchange { gap: 10px; }

main.site-shell .site-user-bubble {
  align-self: flex-end;
  width: min(100%, 520px);
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-2);
}

main.site-shell .site-answer-card {
  padding: 4px 0 0;
  border: 0;
  background: transparent;
}

main.site-shell .site-answer-card__head {
  justify-content: flex-start;
}

main.site-shell .site-answer-card .answer__text {
  padding: 6px 16px 5px;
  font-size: 0.98rem;
  line-height: 1.6;
}

main.site-shell .site-source-chip-row {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

main.site-shell .site-source-chip.site-source-card {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

main.site-shell .site-focus-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin-top: 12px;
  overflow: visible;
}

main.site-shell .site-focus-column[hidden] { display: none !important; }
main.site-shell .site-focus-column .site-panel { padding: 14px; }
main.site-shell .site-focus-column .site-panel__head { margin-bottom: 10px; }
main.site-shell .site-focus-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

main.site-shell .site-continue-panel { padding: 0 !important; overflow: hidden; }
main.site-shell .site-continue-card__cover { background: linear-gradient(125deg, var(--brand-deep), #1f6ba8 58%, var(--brand-light)); }

/* The prototype caps the conversation column at 840px.  The legacy shell
   rules otherwise let the home topbar stretch to the full stage width. */
@media (min-width: 701px) {
  main.site-shell[data-conversation] .site-topbar--home,
  main.site-shell[data-conversation] .site-layout,
  main.site-shell[data-conversation] .site-chat-column {
    width: min(100%, 840px) !important;
    max-width: 840px !important;
    margin-right: auto;
    margin-left: auto;
  }

  main.site-shell[data-conversation] .site-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Shell switches to a real drawer at the same 860px boundary where the desktop rail stops.
   Previously 701–860px used a translated sidebar but still reserved its desktop grid column. */
@media (max-width: 860px) {
  body:has(main.site-shell) { overflow-x: hidden; }

  main.site-shell {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  main.site-shell[data-conversation] .site-sidebar,
  main.site-shell .site-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: min(86%, 300px);
    height: auto;
    padding: 24px 16px 18px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 56px rgba(15, 23, 30, 0.28);
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(.2,.8,.2,1);
  }

  main.site-shell[data-conversation][data-nav="open"] .site-sidebar,
  main.site-shell[data-nav="open"] .site-sidebar { transform: none; }
  main.site-shell[data-conversation] .site-sidebar__head,
  main.site-shell[data-conversation] .site-sidebar__section,
  main.site-shell[data-conversation] .site-sidebar__foot { display: flex; }
  main.site-shell[data-conversation] .site-sidebar__head { align-items: center; }
  main.site-shell[data-conversation] #workspace-rail-collapse,
  main.site-shell #workspace-rail-collapse {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: auto;
  }
  main.site-shell[data-conversation] .site-sidebar__section { flex-direction: column; }
  main.site-shell[data-conversation] .site-sidebar__nav { flex-direction: column; align-items: stretch; justify-content: initial; width: auto; }
  main.site-shell[data-conversation] .site-sidebar__nav .workspace-nav__row { flex: 0 0 auto; width: auto; }
  main.site-shell[data-conversation] .site-sidebar__nav .workspace-nav__tab { width: auto; height: auto; justify-content: flex-start; padding: 8px 10px; }
  main.site-shell[data-conversation] .site-sidebar__nav .workspace-nav__tab span,
  main.site-shell[data-conversation] .site-sidebar__nav .workspace-nav__guard,
  main.site-shell[data-conversation] .workspace-nav__add { display: inline; }
  main.site-shell[data-conversation] .site-sidebar__nav .workspace-nav__icon { display: block; width: 18px; height: 18px; }
  main.site-shell[data-conversation] .site-stage,
  main.site-shell .site-stage { padding: 62px 15px 20px; }
  main.site-shell[data-conversation] .site-topbar--home,
  main.site-shell .site-topbar--home { width: 100%; max-width: none; margin-bottom: 16px; }
  main.site-shell[data-conversation] .site-layout,
  main.site-shell .site-layout { width: 100%; max-width: none; }
  main.site-shell[data-conversation] .site-scroll,
  main.site-shell .site-scroll { justify-content: flex-start; }
  main.site-shell[data-conversation] .workspace-mobile-menu,
  main.site-shell .workspace-mobile-menu {
    display: grid;
    position: absolute;
    z-index: 60;
    top: 12px;
    left: 12px;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
  }

  main.site-shell .site-focus-column { margin-top: 12px; }
  main.site-shell .site-sidebar__foot { margin-top: auto; }

  /* The standalone prototype keeps every console section visible by wrapping the tab rail.
     Horizontal clipping hides "Метрики", "Пробелы" and quality review on a phone. */
  main.site-shell .console-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  /* The reference keeps source details inside the phone viewport. */
  main.site-shell .site-drawer {
    top: 12px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  main.site-shell .site-drawer__body {
    min-height: 0;
    overflow-y: auto;
  }

  /* Share and answer inspection are real mobile actions, not desktop-only decoration. */
  main.site-shell[data-conversation] .site-topbar--home {
    flex-flow: row wrap;
    align-items: center;
    gap: 8px;
  }

  main.site-shell[data-conversation] .site-topbar--home .site-topbar__actions {
    display: flex;
    width: auto;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  main.site-shell[data-conversation] .site-topbar--home .site-topbar__actions > button,
  main.site-shell[data-conversation] .site-topbar--home .site-topbar__actions > a {
    width: auto;
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  .site-recommendations-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

  /* One DOM tree keeps selects, checkboxes and action buttons functional. Rows simply become
     labelled cards on a phone, as in the prototype's People and Quality sections. The curator's
     practical-task queue is the same kind of table and gets the same treatment — it lives on its
     own page rather than inside .console, so the selector has to name it. */
  .console .table-wrap,
  .practical-tasks-shell .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .console .table-wrap table,
  .console .table-wrap tbody,
  .practical-tasks-shell .table-wrap table,
  .practical-tasks-shell .table-wrap tbody {
    display: grid;
    width: 100%;
    gap: 10px;
  }

  .console .table-wrap thead,
  .practical-tasks-shell .table-wrap thead {
    display: none;
  }

  .console .table-wrap tr,
  .practical-tasks-shell .table-wrap tr {
    display: grid;
    gap: 0;
    padding: 5px 13px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-2);
  }

  .console .table-wrap td,
  .practical-tasks-shell .table-wrap td {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }

  .console .table-wrap td:last-child,
  .practical-tasks-shell .table-wrap td:last-child {
    border-bottom: 0;
  }

  .console .table-wrap td::before,
  .practical-tasks-shell .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
  }
}

@media (max-width: 640px) {
  /* Keep the home widgets useful below the composer without giant blank side-by-side cards. */
  main.site-shell .site-focus-column {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  main.site-shell .site-focus-column > .site-panel {
    flex: 0 1 auto;
  }
}


/* Д17 — названия диалогов различимы.
   Строка была ограничена двумя строками при фиксированной высоте 2.8em, и две
   записи с одинаковым началом превращались в два одинаковых обрезка. Высоту
   считает содержимое, дата стоит под названием отдельной строкой — её вернуть
   в разметку списка в site.js (сейчас она только в подсказке). */
main.site-shell .site-sidebar .site-list__item-main {
  display: block;
  min-height: 0;
  padding: 8px 34px 8px 10px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  -webkit-line-clamp: none;
}

main.site-shell .site-sidebar .site-list__item-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 400;
}


/* Д16 — экран входа.
   `100vh` на мобильном Safari считается по окну без адресной строки: подвал
   уезжает под неё. Две колонки полей на 390px дают поля по 155px. */
.auth-page {
  min-height: 100dvh;
  /* Общее правило `main` (app.css) сжимало двухпанельный вход до 760px с полями: для рабочей
     оболочки исключение сделано (`main.site-shell` выше), для входа — не было. */
  max-width: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 860px) {
  .auth-page__form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Ценностное предложение — единственное, что объясняет незнакомому человеку,
     куда он попал по ссылке-приглашению; на телефоне оно скрывалось целиком. */
  .auth-page__manifesto p {
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
  }
}


/* Д15 — «Команда» получает то же состояние «не вошёл», что профиль и обучение.
   Разметку добавляет team.html (см. ТЗ), здесь — только вид. */
.team-shell .team-signin[hidden] {
  display: none;
}

.team-shell .team-signin {
  display: flex;
  justify-content: center;
  padding-top: 40px;
}

/* The reference switches the five-column team table to cards on phones. */
.team-member-cards {
  display: none;
}

.team-member-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.team-member-card__head,
.team-member-card__progress,
.team-member-card__metrics {
  display: flex;
  align-items: center;
}

.team-member-card__head {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.team-member-card__head strong {
  font-size: 0.9rem;
}

.team-member-card__role,
.team-member-card__progress,
.team-member-card__metrics {
  color: var(--muted);
  font-size: 0.81rem;
}

.team-member-card__status {
  display: inline-flex;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}

.team-member-card__status--active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.team-member-card__status--ok {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.team-member-card__status--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.team-member-card__status--neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.team-member-card__progress {
  gap: 8px;
}

.team-member-card__track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.team-member-card__track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.team-member-card__metrics {
  flex-wrap: wrap;
  gap: 6px 14px;
}

.team-member-card__metrics strong {
  color: var(--ink);
}

.team-member-card__weak {
  color: var(--muted);
  font-size: 0.81rem;
}

.team-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.team-panel-heading > span,
.team-panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.team-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
}

.team-filter-pill,
.team-sort-pill,
.team-topic-clear {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.81rem;
  white-space: nowrap;
  cursor: pointer;
}

.team-filter-pill.is-active,
.team-sort-pill.is-active,
.team-topic-clear {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.team-sort-pill {
  font-weight: 600;
}

.team-toolbar__divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--border);
}

.team-member-row {
  cursor: pointer;
}

.team-member-row:hover,
.team-member-row:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.team-member-inline-progress {
  display: flex;
  min-width: 150px;
  align-items: center;
  gap: 8px;
}

.team-member-inline-progress > span {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.team-member-inline-progress i,
.team-topic-item__track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.team-member-inline-progress em,
.team-member-detail__course-progress + em {
  min-width: 3.2em;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  text-align: right;
}

.team-empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.team-topic-list {
  display: grid;
  gap: 4px;
}

.team-topic-item {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(80px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.team-topic-item:hover,
.team-topic-item.is-active {
  background: var(--accent-soft);
}

.team-topic-item__track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.team-topic-item strong {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.team-member-dialog {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 24px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.team-member-dialog::backdrop {
  background: rgb(15 23 42 / 42%);
  backdrop-filter: blur(2px);
}

.team-member-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.team-member-detail__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 38px;
}

.team-member-detail__identity > span {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.team-member-detail__identity h2,
.team-member-detail__identity p,
.team-member-detail__weak,
.team-member-detail__courses p {
  margin: 0;
}

.team-member-detail__identity h2 {
  font-size: 1.1rem;
}

.team-member-detail__identity p,
.team-member-detail__weak span {
  color: var(--muted);
  font-size: 0.82rem;
}

.team-member-detail__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.team-member-detail__facts > div,
.team-member-detail__weak {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface-2);
}

.team-member-detail__facts span {
  color: var(--muted);
  font-size: 0.76rem;
}

.team-member-detail__facts strong,
.team-member-detail__weak strong {
  font-size: 0.9rem;
}

.team-member-detail__weak {
  margin-top: 8px;
}

.team-member-detail section {
  margin-top: 18px;
}

.team-member-detail section h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
}

.team-member-detail__courses {
  display: grid;
  gap: 10px;
}

.team-member-detail__courses > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 10px;
}

.team-member-detail__courses > div > span:first-child {
  display: grid;
  gap: 2px;
}

.team-member-detail__courses small {
  color: var(--muted);
}

.team-member-detail__course-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.team-member-detail__course-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.team-member-detail__course-admin {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.team-member-detail__assign {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.team-member-detail__assign label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.team-member-detail__assign select {
  min-width: 0;
}

.team-member-detail__assigned-courses {
  display: grid;
  gap: 8px;
}

.team-member-detail__assigned-courses > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.team-member-detail__assigned-courses > div > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.team-member-detail__assigned-courses small {
  color: var(--muted);
}

@media (max-width: 700px) {
  .team-member-table {
    display: none;
  }

  .team-member-cards {
    display: grid;
    gap: 10px;
  }

  .team-toolbar__divider {
    display: none;
  }

  .team-topic-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .team-topic-item__track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .team-member-detail__facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-member-detail__courses > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .team-member-detail__course-progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .team-member-detail__assign {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-member-detail__assigned-courses > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Свёрнутая панель на desktop исчезает целиком. Мини-rail со значками оказался ребусом, а на
   экранах небольшой высоты ещё и оставлял кнопку раскрытия в случайной точке страницы. */
@media (min-width: 861px) {
  main.site-shell:not([data-rail="collapsed"]) .site-stage {
    grid-column: 2;
  }

  main.site-shell[data-rail="collapsed"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  main.site-shell[data-rail="collapsed"] .site-sidebar {
    display: none !important;
  }

  main.site-shell[data-rail="collapsed"] .site-stage {
    grid-column: 1;
  }

  main.site-shell:not([data-rail="collapsed"]) ~ #workspace-rail-expand {
    display: none !important;
  }

  main.site-shell[data-rail="collapsed"] ~ #workspace-rail-expand {
    display: grid !important;
    position: fixed;
    /* The opener belongs in the gutter beside the centred workspace, not on the
       rounded application surface.  Placing it at the old (4px, 4px) origin made
       the shell corner read as a second, broken button in dark mode. */
    top: 24px;
    left: max(20px, calc(50vw - 610px));
    z-index: 90;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    box-shadow: none;
  }

  /* Без боковой панели сцена занимает всё окно. Обычные экраны оставляем компактными и
     центрируем на новой оси; редактор курса остаётся полноширинным по отдельному правилу. */
  main.site-shell[data-rail="collapsed"] .site-stage > .courses-shell:not(.is-authoring),
  main.site-shell[data-rail="collapsed"] .site-stage > .profile-shell,
  main.site-shell[data-rail="collapsed"] .site-stage > .console {
    margin-inline: auto;
  }
}

/* Последний слой владеет геометрией shell: зарезервированный scrollbar не даёт сцене смещаться
   на несколько пикселей между короткой страницей профиля и прокручиваемым чатом. */
html { scrollbar-gutter: stable; }

/* Browser-default blue selection made blue interface text unreadable.  A quiet cyan tint keeps
   selected knowledge-base text legible without looking like an active destructive state. */
*::selection {
  background: #dceefc !important;
  color: #10233d !important;
  text-shadow: none !important;
}

[data-theme="dark"] *::selection {
  background: #376d98 !important;
  color: #ffffff !important;
}

/* The catalogue switcher and its search controls are two distinct levels of navigation. */
.courses-workspace > .courses-filters[role="tablist"] {
  margin-bottom: 16px;
}

.course-create-panel {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr);
  gap: 20px;
  align-items: start;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.course-create-panel h3 { margin: 0 0 5px; }
.course-create-panel .hint { margin: 0; }
.course-create-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.course-create-form label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 600; }
.course-create-form input, .course-create-form textarea { width: 100%; min-height: 40px; box-sizing: border-box; }
.course-create-form button { min-height: 40px; white-space: nowrap; }
@media (max-width: 860px) { .course-create-panel, .course-create-form { grid-template-columns: minmax(0, 1fr); } }

main.site-shell .site-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main.site-shell .workspace-sidebar__scroll {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  padding: 0 4px 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

main.site-shell .site-sidebar__foot {
  flex: 0 0 auto;
  margin-top: 0;
  background: var(--rail-bg);
}

/* Diagnostics is a workspace screen, not the legacy trace layout.  The old dev flag imposed a
   1360px max-width and a different sidebar grid, so switching Chat ↔ Diagnostics visibly jumped. */
@media (min-width: 861px) {
  main.site-shell[data-dev-mode="true"] {
    max-width: none;
    grid-template-columns: 244px minmax(0, 1fr);
  }

  /* Chat used to retain the prototype rail padding while every other workspace page used the
     shared rail.  That two-pixel horizontal shift was visible on every tab switch. */
  main.site-shell[data-conversation] .site-sidebar {
    padding: 24px 16px 18px;
  }
}

/* Material upload is a compact, deliberate control instead of a full-width dashed banner. */
.course-materials__upload {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.course-materials__field {
  min-width: 0;
  gap: 7px;
  font-weight: 600;
}

.course-materials__field input[type="file"],
.course-materials__field input[type="text"] {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
}

.course-materials__upload .site-primary-action {
  min-height: 42px;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .course-materials__upload { grid-template-columns: minmax(0, 1fr); }
  .course-materials__upload .site-primary-action { width: 100%; }
}

/* Course authoring is a real workspace, not a narrow dialog.  The programme editor needs a
   stable outline and enough horizontal room for the lesson body and attachments. */
.course-authoring-workspace {
  width: 100%;
  max-width: none;
  min-height: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 56px) 48px;
}

/* The author lives inside the same content stage as the course catalogue.  Expanding only while
   authoring keeps the catalogue compact but gives the programme editor the full workspace width. */
.courses-shell.is-authoring {
  width: 100%;
  max-width: none;
}

.course-authoring-workspace[hidden] { display: none !important; }

.course-authoring-workspace__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--border);
}

.course-authoring-workspace__head h1 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: clamp(1.55rem, 2.5vw, 2.2rem);
  line-height: 1.12;
}

.course-authoring-workspace__head p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.course-authoring-workspace__close {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.course-authoring-workspace__close:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.course-authoring-workspace__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.course-authoring-workspace__actions [hidden] { display: none !important; }

.course-builder-removal {
  display: flex;
  flex: 1 1 360px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--danger-border, #efb2ae);
  border-radius: 10px;
  background: var(--danger-bg, #fff1f0);
  color: var(--ink);
  font-size: 0.82rem;
}

.course-builder-removal > span { flex: 1 1 180px; }

.course-authoring-workspace .course-builder-body {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 26px 0 0;
}

.course-authoring-workspace .course-builder-steps {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.course-authoring-workspace .course-builder-step-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border-color: transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.course-authoring-workspace .course-builder-step-tab:disabled {
  cursor: default;
  opacity: 0.48;
}

.course-authoring-workspace .course-builder-step-tab__mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.course-authoring-workspace .course-builder-step-tab.is-active .course-builder-step-tab__mark {
  background: var(--accent);
  color: var(--accent-ink);
}

.course-authoring-workspace .course-builder-step-tab.is-done .course-builder-step-tab__mark {
  background: var(--ok-bg);
  color: var(--ok);
}

.course-authoring-workspace .course-builder-step-tab:hover:not(:disabled),
.course-authoring-workspace .course-builder-step-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.course-authoring-workspace .course-builder-step {
  grid-column: 2;
  min-width: 0;
  padding: clamp(18px, 2.5vw, 30px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(15, 23, 30, 0.05);
}

.course-authoring-workspace .course-builder-step > .courses-field {
  max-width: 820px;
}

.course-builder-chips,
.course-builder-covers,
.course-builder-nav,
.course-builder-required-row,
.course-builder-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.course-builder-chip {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.course-builder-chip.is-selected {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.course-builder-required-row {
  justify-content: space-between;
  max-width: 820px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.course-builder-required-row .hint { margin: 3px 0 0; }

.course-builder-cover {
  width: 86px;
  height: 50px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}

.course-builder-cover.is-selected { border-color: var(--accent); }
.course-builder-cover--blue { background: linear-gradient(125deg, var(--brand-deep), #1f6ba8 58%, var(--brand-light)); }
.course-builder-cover--green { background: linear-gradient(125deg, #16563f, #1f8a63 60%, #4cc38a); }
.course-builder-cover--steel { background: linear-gradient(125deg, #24303f, #4a5a70 60%, #93a4b8); }

.course-builder-summary { display: grid; gap: 0; margin: 0; }
.course-builder-summary dt { color: var(--muted); font-size: 0.86rem; }
.course-builder-summary dd {
  margin: 3px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 650;
}
.course-builder-blocker { display: block; margin: 0 0 8px; }
.course-builder-banner {
  padding: 14px 16px;
  border: 1px solid var(--ok-border);
  border-radius: 12px;
  background: var(--ok-bg);
  color: var(--ok);
}
.course-builder-banner[hidden] { display: none; }
.course-builder-doc-list { display: grid; gap: 8px; max-height: 270px; overflow-y: auto; }
.course-builder-doc { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.course-builder-ai-stages { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.course-authoring-workspace .course-builder-nav {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.course-authoring-workspace .course-builder-nav #course-builder-next {
  margin-left: auto;
}

.course-authoring-workspace #course-builder-content-mount > div {
  display: grid !important;
  /* Keep the lesson editor usable even with the navigation rail open.  The previous 260px
     minimum for the outline left the editor at ~200px on a normal laptop and pushed uploads
     outside the card; the collapsed rail still gets the larger proportional layout. */
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) !important;
  gap: 20px !important;
  align-items: start;
}

.course-authoring-workspace #course-builder-content-mount aside.card {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 72px);
  overflow: auto;
}

.course-authoring-workspace #course-builder-content-mount textarea,
.course-authoring-workspace #course-builder-content-mount input[type="text"] {
  max-width: 100%;
  box-sizing: border-box;
}

.course-authoring-workspace #course-builder-content-mount .cbc-article-title {
  width: 100%;
  min-height: 44px;
  font-size: 1.12rem !important;
}

.course-authoring-workspace #course-builder-content-mount .cbc-article-heading {
  flex: 1 1 auto;
}

.course-authoring-workspace #course-builder-content-mount .row {
  flex-wrap: wrap;
}

.course-authoring-workspace #course-builder-content-mount > div > aside.card,
.course-authoring-workspace #course-builder-content-mount > div > [data-cbc-editor] {
  min-width: 0;
}

/* The outer shell can leave the authoring area narrow even on a desktop viewport when the
   application rail and wizard steps are both open. Let the content container decide when the
   outline should stack instead of tying this to a global viewport breakpoint. */
.course-authoring-workspace #course-builder-content-mount {
  container-type: inline-size;
  container-name: lesson-authoring;
}

@container lesson-authoring (max-width: 850px) {
  .course-authoring-workspace #course-builder-content-mount > div {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .course-authoring-workspace #course-builder-content-mount aside.card {
    position: static;
    max-height: none;
  }
}

.course-authoring-workspace #course-builder-content-mount .card {
  margin-bottom: 18px;
}

.course-authoring-workspace #course-builder-content-mount form[data-cbc-form="save-content"] > .row {
  gap: 9px;
  margin-top: 14px;
}

.course-authoring-workspace .course-lesson-test {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--accent-soft);
}

.course-authoring-workspace .course-lesson-test[hidden] { display: none; }

.course-lesson-test__settings {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.course-lesson-test__required {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}

.course-lesson-test__question {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.course-lesson-test__intro {
  margin: 0;
  color: var(--muted);
}

.course-lesson-test__question-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.course-lesson-test__step {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  vertical-align: middle;
}

.course-lesson-test__field-label { display: inline-flex; align-items: center; }
.course-lesson-test__field-label .course-lesson-test__step { flex: 0 0 auto; }

.course-lesson-test__question .course-quiz-field > input,
.course-lesson-test__question .course-quiz-field > textarea { margin-top: 7px; }

.course-lesson-test__question .course-quiz-options { padding: 16px; background: var(--surface); }
.course-lesson-test__question .course-quiz-options legend { padding: 0 4px; }
.course-lesson-test__question .course-quiz-options .hint { margin: 0 0 10px; }

.course-lesson-test__question .course-quiz-options .course-lesson-test__answer {
  display: grid;
  grid-template-columns: 20px 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.course-lesson-test__answer > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.course-lesson-test__answer:has(input[type="radio"]:checked) > span {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.course-lesson-test__error { margin: -2px 0 0; }

.course-lesson-test__saved {
  display: grid;
  gap: 12px;
}

.course-lesson-test__saved-question {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.course-lesson-test__saved-question header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.course-lesson-test__saved-question h4,
.course-lesson-test__saved-question ol,
.course-lesson-test__saved-question p { margin: 0; }

.course-lesson-test__saved-question ol {
  display: grid;
  gap: 7px;
  padding: 0;
  list-style: none;
}

.course-lesson-test__saved-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-2);
}

.course-lesson-test__saved-option.is-correct {
  background: var(--ok-bg);
  color: var(--ok);
}

.course-lesson-test__saved-option-number {
  font-weight: 750;
  text-align: center;
}

.course-lesson-test__saved-option strong { font-size: 0.76rem; }

.course-lesson-test__saved-explanation {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

.course-lesson-test__add > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 700;
}

.course-lesson-test__add[open] > summary { margin-bottom: 12px; }

.course-lesson-test__edit {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.course-lesson-test__edit > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 700;
}

.course-lesson-test__edit[open] > summary { margin-bottom: 12px; }

.course-builder-preview {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--surface-2);
}

.course-builder-preview[hidden] { display: none !important; }

.course-builder-preview .card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.course-builder-preview .course-page {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.course-builder-preview .course-page + .course-page { margin-top: 10px; }

.cbc-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.cbc-editor-toolbar__primary,
.cbc-editor-toolbar__format,
.cbc-editor-toolbar__actions { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }

.cbc-editor-toolbar button,
.cbc-editor-toolbar summary {
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  white-space: nowrap;
}

.cbc-editor-toolbar .site-primary-action { width: auto; padding-inline: 16px; }
.cbc-editor-toolbar__icon { min-width: 38px; padding-inline: 0 !important; font-weight: 800; font-family: Georgia, serif; }
.cbc-editor-toolbar__divider { width: 1px; height: 24px; background: var(--border); }

.cbc-editor-toolbar__insert { position: relative; }
.cbc-editor-toolbar__insert summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.cbc-editor-toolbar__insert summary::-webkit-details-marker { display: none; }
.cbc-editor-toolbar__insert summary::after { content: "⌄"; margin-left: 8px; color: var(--muted); }
.cbc-editor-toolbar__insert[open] summary { border-color: var(--accent-border); color: var(--accent-strong); }

.cbc-editor-toolbar__menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  display: grid;
  min-width: 192px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cbc-editor-toolbar__menu button {
  justify-content: flex-start;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
}

.cbc-editor-toolbar__menu button:hover,
.cbc-editor-toolbar__menu button:focus-visible { background: var(--accent-soft); color: var(--accent-strong); outline: none; }
.cbc-editor-toolbar__preview { margin-left: 0 !important; }
.cbc-editor-toolbar__status { flex: 1 0 100%; min-height: 1.25em; margin: 0; padding-left: 2px; }

.cbc-inline-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--ink);
}

.cbc-inline-confirm[hidden] { display: none; }
.cbc-inline-confirm p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.cbc-inline-confirm__actions { display: inline-flex; flex-wrap: wrap; gap: 7px; }

.course-builder-notice {
  position: fixed;
  z-index: 30;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--border));
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 14px 34px rgb(0 0 0 / 22%);
}

.course-builder-notice[hidden] { display: none; }
.course-builder-notice__close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.course-builder-notice__input {
  min-width: min(280px, 100%);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.course-builder-notice__actions { display: inline-flex; flex: 0 0 auto; flex-wrap: wrap; gap: 7px; }
.course-builder-notice[data-dialog="prompt"] { flex-wrap: wrap; }
.course-builder-notice[data-dialog="prompt"] #course-builder-notice-text { flex-basis: 100%; }

.site-ui-dialog {
  position: fixed;
  z-index: 40;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--border));
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 14px 34px rgb(0 0 0 / 22%);
}
.site-ui-dialog[hidden] { display: none; }
.site-ui-dialog__input {
  min-width: min(280px, 100%);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.site-ui-dialog__actions { display: inline-flex; flex: 0 0 auto; flex-wrap: wrap; gap: 7px; }
/* The inline-flex rule above otherwise wins over the browser's default [hidden] style. */
.site-ui-dialog__actions[hidden] { display: none; }
.site-ui-dialog__close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.site-ui-dialog[data-dialog-kind="prompt"] { flex-wrap: wrap; }
.site-ui-dialog[data-dialog-kind="prompt"] #site-ui-dialog-text { flex-basis: 100%; }
@media (max-width: 640px) {
  .site-ui-dialog { right: 16px; bottom: 16px; }
}

@media (max-width: 640px) {
  .course-builder-notice { right: 16px; bottom: 16px; }
}

@media (max-width: 640px) {
  .cbc-editor-toolbar {
    align-items: stretch;
  }

  .cbc-editor-toolbar__primary,
  .cbc-editor-toolbar__format,
  .cbc-editor-toolbar__insert,
  .cbc-editor-toolbar__actions,
  .cbc-editor-toolbar__preview {
    min-width: 0;
  }

  .cbc-editor-toolbar__primary,
  .cbc-editor-toolbar__format,
  .cbc-editor-toolbar__insert,
  .cbc-editor-toolbar__actions,
  .cbc-editor-toolbar__preview {
    width: 100%;
  }

  .cbc-editor-toolbar__primary > *,
  .cbc-editor-toolbar__format > *,
  .cbc-editor-toolbar__insert,
  .cbc-editor-toolbar__insert summary,
  .cbc-editor-toolbar__actions > *,
  .cbc-editor-toolbar__preview {
    flex: 1 1 auto;
    justify-content: center;
  }

  .cbc-editor-toolbar__divider { display: none; }
}

/* Read-only course overview in the KB console: navigation, search and status filtering are kept
   above a bounded card set.  Without them a long-lived admin database becomes an undifferentiated
   wall of draft cards. */
.console-course-browser {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.console-course-browser__search input {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.console-course-browser__search input:focus-visible {
  border-color: var(--accent-border);
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 1px;
}
.console-course-browser__filters { display: flex; flex-wrap: wrap; gap: 6px; }
.console-course-browser__filters .is-active,
.console-course-browser__filters [aria-pressed="true"] { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-strong); }
.console-course-browser > .hint { margin: 0; text-align: right; white-space: nowrap; }
.courses-console-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

@media (max-width: 860px) {
  .console-course-browser { grid-template-columns: minmax(0, 1fr); }
  .console-course-browser > .hint { text-align: left; white-space: normal; }
}

.course-quiz-create,
.course-quiz-create > form,
.course-quiz-field,
.course-quiz-options {
  display: grid;
  gap: 10px;
}

.course-quiz-create {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.course-quiz-create > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 700;
}

.course-quiz-field span,
.course-quiz-options legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.course-quiz-options {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.course-quiz-options label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.course-quiz-options input[type="text"] { min-width: 0; }

@media (min-width: 861px) {
  main.site-shell[data-rail="collapsed"] .courses-shell.is-authoring,
  main.site-shell[data-rail="collapsed"] .course-authoring-workspace {
    width: 100%;
    max-width: none;
  }
}

/* The course flow keeps its four steps, but uses the full authoring width. A narrow
   vertical rail made the first screen feel like a broken two-column form and forced
   the long step name to wrap. */
.course-authoring-workspace .course-builder-body {
  display: block;
  padding-top: 24px;
}

.course-authoring-workspace .course-builder-steps {
  position: static;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px;
  border-color: var(--border);
  border-radius: 18px;
  background: var(--surface-2);
}

.course-authoring-workspace .course-builder-step-tab {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: transparent;
}

.course-authoring-workspace .course-builder-step-tab__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.course-authoring-workspace .course-builder-step-tab__body strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-authoring-workspace .course-builder-step-tab__body small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-authoring-workspace .course-builder-step-tab.is-active {
  border-color: var(--accent-border);
  box-shadow: 0 5px 14px rgba(15, 23, 30, 0.08);
}

.course-authoring-workspace .course-builder-step-tab.is-done {
  color: var(--ok);
}

.course-authoring-workspace .course-builder-step {
  max-width: 1080px;
  margin: 20px auto 0;
  padding: clamp(22px, 3vw, 34px);
}

.course-authoring-workspace .course-builder-step > .courses-field {
  max-width: none;
}

.course-builder-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.course-builder-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.course-builder-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.course-builder-section-heading__number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

.course-builder-section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.course-builder-section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.course-builder-cover-hint {
  margin: 4px 0 8px;
}

.course-authoring-workspace .course-builder-nav {
  max-width: 1080px;
  margin: 18px auto 0;
}

@media (max-width: 760px) {
  .course-authoring-workspace .course-builder-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-authoring-workspace .course-builder-step-tab {
    min-height: 56px;
    padding: 8px 9px;
  }

  .course-authoring-workspace .course-builder-step-tab__body small {
    display: none;
  }
}

/* The lesson editor is intentionally narrower than the author workspace because it shares a row
   with the programme outline.  Attachment fields must therefore stay vertical: native file inputs
   have an intrinsic filename width and two cramped columns look and behave worse than one clear form. */
.course-authoring-workspace .course-materials__upload {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
}

.course-authoring-workspace .course-materials__field input[type="file"],
.course-authoring-workspace .course-materials__field input[type="text"] {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.course-authoring-workspace .course-materials__upload .site-primary-action {
  grid-column: auto;
  min-width: 168px;
  justify-self: start;
}

.console-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.console-pagination__range,
.console-pagination__page {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.console-pagination__range strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.console-pagination__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.stage-checklist {
  position: relative;
  min-width: 168px;
  margin: 0;
}

.stage-checklist__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.stage-checklist__summary::-webkit-details-marker { display: none; }
.stage-checklist__toggle { color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.stage-checklist--done .stage-checklist__summary { border-color: var(--ok-border); }
.stage-checklist--active .stage-checklist__summary { border-color: var(--accent-border); }
.stage-checklist--failed .stage-checklist__summary { border-color: var(--danger-border); }
.stage-checklist--unknown .stage-checklist__summary { border-color: var(--warn-border); }

.stage-checklist__list {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.stage-checklist__item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.25;
}

.stage-checklist__marker { font-weight: 800; text-align: center; }
.stage-checklist__label { min-width: 0; color: var(--ink); }
.stage-checklist__detail { color: var(--muted); white-space: nowrap; }
.stage-checklist__item--done .stage-checklist__marker { color: var(--ok); }
.stage-checklist__item--active .stage-checklist__marker { color: var(--accent-strong); }
.stage-checklist__item--failed .stage-checklist__marker { color: var(--danger); }
.stage-checklist__item--unknown .stage-checklist__marker { color: var(--warn); }

.doc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-actions__menu {
  position: relative;
}

.doc-actions__menu summary {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.79rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.doc-actions__menu summary::-webkit-details-marker { display: none; }

.doc-actions__menu[open] {
  z-index: 4;
}

.doc-actions__menu[open] > summary {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.doc-actions__menu[open] > button {
  display: block;
  width: 100%;
  margin-top: 5px;
}

.materials-review__filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 0;
}

.materials-review__filter {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 11px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.materials-review__filter select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-inline: 10px 34px;
  background: var(--surface);
}

.materials-review__selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.materials-review__selection.has-selection {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 44%, var(--surface));
}

.materials-review__selection-state,
.materials-review__selection-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.materials-review__selection-actions { margin-left: auto; }
.materials-review__actions-label { color: var(--muted); font-size: 0.79rem; margin-right: 2px; }
.materials-review__selected-count { color: var(--ink); font-size: 0.84rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.materials-review__selection-hint { color: var(--muted); font-size: 0.82rem; }

.invite-course-picker {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.invite-course-picker__head,
.invite-course-picker__tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invite-course-picker__head strong { display: block; color: var(--ink); font-size: 0.93rem; }
.invite-course-picker__head p { margin: 3px 0 0; color: var(--muted); font-size: 0.8rem; }
.invite-course-picker__count { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: var(--surface); color: var(--accent-strong); font-size: 0.78rem; font-weight: 750; }
.invite-course-picker__tools input { flex: 1 1 220px; min-width: 0; height: 38px; }

.invite-course-picker__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
  max-height: 236px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.invite-course-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.84rem;
  line-height: 1.3;
}

.invite-course-option:hover { background: var(--accent-soft); }
.invite-course-option input { flex: 0 0 auto; margin: 2px 0 0; }
.invite-course-option span { min-width: 0; overflow-wrap: anywhere; }
.invite-course-picker__empty { margin: 12px; color: var(--muted); font-size: 0.84rem; }

@media (max-width: 860px) {
  .materials-review__filters { grid-template-columns: 1fr; }
  .materials-review__selection-actions { margin-left: 0; }
}

@media (max-width: 640px) {
  .console-pagination,
  .console-pagination__controls,
  .invite-course-picker__head,
  .invite-course-picker__tools { align-items: stretch; flex-direction: column; }
  .console-pagination__controls { width: 100%; }
  .console-pagination__controls > * { width: 100%; text-align: center; }
  .materials-review__selection-state,
  .materials-review__selection-actions { width: 100%; }
  .materials-review__selection-actions > button { flex: 1 1 auto; }
  .invite-course-picker__tools > button { width: 100%; }
  .invite-course-picker__count { align-self: flex-start; }
  .stage-checklist { min-width: 150px; }
}

.person-course-assign {
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.person-course-assign select {
  min-width: min(360px, 100%);
}

.console-overview__gate,
.console-overview__gate--clickable,
.console-overview__gate--clickable strong {
  color: var(--ink);
}

.console-overview__gate--clickable {
  background: var(--surface);
}

.console-documents__uploads > .card { min-width: 0; }

.console-upload-workspace {
  display: grid;
  gap: 22px;
  padding: 26px 28px;
  border-color: var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
}

.console-upload-workspace__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
}

.console-upload-workspace__head h2 { margin: 4px 0 0; font-size: 1.2rem; }
.console-upload-workspace__head p:not(.console-upload-card__eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }

.console-upload-mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.console-upload-mode-switch button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
}

.console-upload-mode-switch button.is-active {
  border-color: var(--accent-border);
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 1px 2px rgba(19, 42, 77, .08);
}

.console-upload-mode-switch button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 1px;
}

.console-upload-pane {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.console-upload-pane[hidden] { display: none; }
.console-upload-pane__intro { margin: 0 0 16px; }
.console-upload-pane__intro strong { color: var(--ink); }
.console-upload-pane__intro p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }

.console-upload-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 28px;
  border-color: var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
}

.console-upload-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, .95fr);
  gap: 24px;
  align-items: start;
}

.console-upload-card__head h2 { margin: 4px 0 0; font-size: 1.2rem; }
.console-upload-card__head > p { margin: 1px 0 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.console-upload-card__eyebrow { margin: 0; color: var(--accent-strong); font-size: .68rem; font-weight: 800; letter-spacing: .11em; }

.console-upload-form { display: grid; gap: 16px; }
.google-drive-card { display: grid; gap: 14px; }
.google-drive-preview { min-height: 0; }
.console-upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.console-upload-field { display: grid; min-width: 0; gap: 7px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.console-upload-field input,
.console-upload-field select { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; }

.console-upload-field input:not([type="file"]),
.console-upload-field select {
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.console-upload-field input:not([type="file"]):focus-visible,
.console-upload-field select:focus-visible {
  border-color: var(--accent-border);
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 1px;
}

.console-upload-form__footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-top: 4px;
}

.console-upload-form__footer > button { min-height: 46px; padding-inline: 20px; white-space: nowrap; }

.console-file-picker {
  position: relative;
  min-width: 0;
}

.console-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.console-file-picker__label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
}

.console-file-picker__label:focus-within,
.console-file-picker__label:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.console-file-picker.is-selected .console-file-picker__label {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.console-file-picker.is-selected .console-file-picker__name { color: var(--ink); font-weight: 600; }

.console-file-picker__action {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 700;
}

.console-file-picker__name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .console-upload-card__head { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .console-upload-workspace__head { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .console-upload-mode-switch { justify-self: start; }
}

@media (max-width: 700px) {
  .console-upload-card { gap: 18px; padding: 20px; }
  .console-upload-workspace { gap: 18px; padding: 20px; }
  .console-upload-mode-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .console-upload-grid,
  .console-upload-form__footer { grid-template-columns: minmax(0, 1fr); }
  .console-upload-form__footer > button { width: 100%; }
}

.course-authoring-workspace--ai .course-builder-body {
  display: block;
  max-width: 860px;
}

.course-authoring-workspace--ai #course-builder-ai-body {
  padding: clamp(18px, 2.5vw, 30px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

@media (max-width: 860px) {
  .course-authoring-workspace { padding: 18px 16px 32px; }
  .course-authoring-workspace__head { gap: 14px; }
  .course-authoring-workspace__close { font-size: 0.85rem; }
  .course-authoring-workspace .course-builder-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .course-authoring-workspace .course-builder-steps {
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 6px;
  }
  .course-authoring-workspace .course-builder-step-tab { width: auto; white-space: nowrap; }
  .course-authoring-workspace .course-builder-step,
  .course-authoring-workspace .course-builder-nav { grid-column: 1; }
  .course-authoring-workspace #course-builder-content-mount > div { grid-template-columns: minmax(0, 1fr) !important; }
  .course-authoring-workspace #course-builder-content-mount aside.card { position: static; max-height: none; }
  .course-authoring-workspace #course-builder-content-mount aside.card li {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .course-authoring-workspace #course-builder-content-mount aside.card li > span {
    flex: 0 0 auto;
    margin-left: auto;
  }
  .course-lesson-test__settings { grid-template-columns: minmax(0, 1fr); }
  .course-authoring-workspace .course-materials__upload .site-primary-action { width: 100%; }
}

@media (max-width: 560px) {
  .course-authoring-workspace__head { flex-direction: column; }
  .course-authoring-workspace__close { width: 100%; }
  .course-authoring-workspace .course-builder-step { padding: 16px; }
  .course-authoring-workspace .course-builder-nav { flex-wrap: wrap; }
  .course-authoring-workspace .course-builder-nav #course-builder-next { width: 100%; margin-left: 0; }
  .course-authoring-workspace .course-builder-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
  .course-authoring-workspace .course-builder-step-tab {
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
  }
  .course-authoring-workspace #course-builder-content-mount aside.card li > span {
    flex-basis: 100%;
    justify-content: flex-end;
  }
}

/* Course builder polish: keep the existing four-step flow, but make hierarchy and
   the program outline readable at a glance on both narrow and wide screens. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Не склеивать подпись и inline-action в формах входа/регистрации. */
.courses-signin__switch > .courses-linkbutton {
  margin-left: 4px;
}

.course-builder-step__intro {
  display: grid;
  gap: 6px;
  max-width: 760px;
  margin-bottom: 22px;
}

.course-builder-step__eyebrow {
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.course-builder-step__intro h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
}

.course-builder-step__intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.course-authoring-workspace .course-builder-step-tab.is-locked {
  opacity: 0.42;
}

.course-authoring-workspace .course-builder-nav {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin-top: 18px;
  padding: 14px 0 max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, transparent, var(--surface) 18px, var(--surface));
}

.course-builder-nav__hint {
  flex: 1 1 240px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.course-authoring-workspace .course-builder-nav #course-builder-next {
  width: auto;
  min-width: 152px;
}

.cbc-outline {
  overflow: hidden;
}

.cbc-outline__count {
  margin: 4px 0 0;
}

.cbc-module {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

/* `.row` в мастере переносит содержимое (`flex-wrap: wrap` выше, специфичность больше), и
   заголовок модуля с тремя кнопками расползался на две строки. Сетка снимает вопрос о переносе
   целиком: поле занимает всё свободное место, кнопки — свою ширину. */
.cbc-module-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 4px;
}

.cbc-module-title {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
}

.cbc-module-title:focus {
  border-color: var(--accent-border);
  background: var(--surface);
  outline: none;
}

.cbc-lesson-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cbc-lesson-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-width: 0;
  border-radius: 9px;
}

.cbc-lesson-row.is-selected {
  background: var(--accent-soft);
}

.cbc-lesson-select {
  min-width: 0;
  overflow: hidden;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.cbc-lesson-row.is-selected .cbc-lesson-select {
  color: var(--accent-strong);
  font-weight: 650;
}

.cbc-lesson-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

.cbc-add-lesson,
.cbc-add-module {
  gap: 6px;
  margin-top: 4px;
}

.cbc-add-lesson input,
.cbc-add-module input {
  min-width: 0;
  flex: 1 1 110px;
}

@media (max-width: 860px) {
  .cbc-lesson-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cbc-lesson-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .course-lesson-test__question-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cbc-editor-toolbar__primary,
  .cbc-editor-toolbar__preview {
    width: 100%;
  }

  .cbc-editor-toolbar__format,
  .cbc-editor-toolbar__insert,
  .cbc-editor-toolbar__actions {
    width: calc(50% - 4px);
  }

  .cbc-editor-toolbar__primary > *,
  .cbc-editor-toolbar__format > *,
  .cbc-editor-toolbar__insert summary,
  .cbc-editor-toolbar__actions > *,
  .cbc-editor-toolbar__preview {
    width: 100%;
  }

  .course-builder-nav__hint {
    flex-basis: 100%;
  }

  .course-authoring-workspace .course-builder-nav #course-builder-next {
    width: 100%;
  }
}

/* On the empty mobile chat the starter card is content, not a fixed-height viewport.  The
   previous two-row grid gave the scroll area only the space above the pinned composer, so the
   wrapped third scenario could be clipped halfway through its button with no visible cue. */
@media (max-width: 700px) {
  body:has(main.site-shell[data-conversation="empty"]) {
    overflow-y: auto;
  }

  main.site-shell[data-conversation="empty"] {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  main.site-shell[data-conversation="empty"] .site-stage {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    grid-template-rows: auto auto;
  }

  main.site-shell[data-conversation="empty"] .site-layout {
    display: flex;
    flex-direction: column;
    align-content: start;
    min-height: max-content;
  }

  main.site-shell[data-conversation="empty"] .site-chat-column {
    display: flex;
    flex-direction: column;
    min-height: max-content;
  }

  main.site-shell[data-conversation="empty"] .site-focus-column {
    flex: none;
  }

  main.site-shell[data-conversation="empty"] .site-scroll {
    flex: none;
    height: auto;
    overflow: visible;
    min-height: 0;
  }

  main.site-shell[data-conversation="empty"] .site-thread {
    display: none;
  }

  main.site-shell[data-conversation="empty"] .site-composer {
    flex: none;
  }
}

/* ── Предрелизная полировка ─────────────────────────────────────────────────
   Каждое правило ниже закрывает то, что видно на экране, и ничего не переносит. */

/* `overflow: hidden` делал из сцены контейнер прокрутки: после первого вопроса браузер
   подкручивал саму сцену, топбар уезжал под кнопку ☰, и та накрывала подпись «Вопрос».
   `clip` режет так же, но контейнером прокрутки не становится. */
main.site-shell .site-stage {
  overflow: clip;
}

/* Выбранный урок в программе при наведении получал глобальный `button:hover` с фоном --accent
   и оставался с акцентным же текстом — надпись сливалась с фоном. */
.cbc-lesson-select:hover,
.cbc-lesson-select:focus-visible,
.cbc-lesson-row.is-selected .cbc-lesson-select:hover,
.cbc-lesson-row.is-selected .cbc-lesson-select:focus-visible {
  background: var(--accent-soft);
  color: var(--ink);
}

/* Виджеты «Фокус на сегодня» относятся к пустому экрану. Под тредом в узком окне они съедали
   его высоту: ответ читался через окно высотой в пару строк. */
@media (max-width: 1080px) {
  main.site-shell[data-conversation="active"] .site-focus-column {
    display: none !important;
  }
}

/* Низкое окно ноутбука: приветственная карточка не влезала, и «Рекомендуемые вопросы» —
   единственная подсказка «с чего начать» — оказывались за нижним краем прокрутки. */
@media (min-width: 861px) and (max-height: 780px) {
  main.site-shell[data-conversation="empty"] .site-topbar--home {
    margin-bottom: 12px;
  }

  main.site-shell[data-conversation="empty"] .site-hero-card {
    padding: 14px;
  }

  main.site-shell[data-conversation="empty"] .site-topbar__description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}

/* Предрелизная полировка, часть 2 --------------------------------------------------------- */

/* Моноширинный шрифт в интерфейсе означает «это машинный текст»: код, идентификатор, лог.
   Им же были набраны статусы курса, заголовки таблиц и надзаголовок консоли — обычные русские
   слова, которые от разрядки и капслока читаются как техническая выдача, а не как подпись.
   Оставляем моноширинность там, где она несёт смысл, и убираем оттуда, где она его подменяет. */
.pill,
.console-hero__eyebrow,
th {
  font-family: inherit;
}

.console-hero__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

th {
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

/* «Здесь пока пусто» выглядело тремя разными способами: пунктирный бокс в курсах, такой же, но
   другого размера, в команде, и просто серая строка в консоли. Пустое состояние списка или раздела
   теперь всюду выглядит одинаково — этим боксом. Подпись внутри компактной карточки сводки, где
   непустое состояние умещается в одну строку, остаётся подписью: бокс сделал бы такую карточку
   выше соседних в том же ряду. */
.team-empty {
  padding: 28px;
  border-radius: var(--radius);
}

/* Оглавление курса. На широком экране это боковая колонка: сворачивать нечего, поэтому сводка
   спрятана, а `<details open>` остаётся раскрытым навсегда. */
.course-reader__toc-summary {
  display: none;
}

.course-reader__toc > .course-reader__module:first-of-type {
  margin-top: 0;
}

@media (max-width: 860px) {
  /* На телефоне список из двух десятков уроков отодвигал текст урока почти на два экрана вниз. */
  .course-reader__toc-summary {
    display: list-item;
    padding: 8px 0;
    color: var(--accent-strong);
    font-weight: 600;
    cursor: pointer;
  }

  .course-reader__toc-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

/* Урок открывается внутри экрана каталога, и над ним оставалась вся каталожная обвязка: описание
   раздела, поиск по курсам, фильтры «Обязательные / В процессе / Пройденные». К открытому уроку
   они не относятся, а текст урока отодвигали вниз — на телефоне почти на два экрана. Пока в
   #courses-view лежит читалка, эти элементы не показываем; вернуться к списку можно кнопкой
   «← Все курсы» в оглавлении и вкладками разделов, которые остаются на месте. */
body:has(#courses-view .course-reader) .courses-tools,
body:has(#courses-view .course-reader) .courses-topbar__text {
  display: none;
}

.course-program-admin,
.course-program-group {
  margin: 0 0 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.course-program-admin h2,
.course-program-group h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.course-program-admin > p,
.course-program-group > p {
  margin: 0 0 16px;
  color: var(--ink-muted);
}

.course-program-group__audience {
  font-size: 0.875rem;
  font-weight: 600;
}

.course-program-admin form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.course-program-admin label,
.course-program-group label {
  display: grid;
  gap: 6px;
  min-width: min(220px, 100%);
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.course-program-admin input,
.course-program-admin select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.course-program-admin :focus-visible,
.course-program-group :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.course-program-links {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.course-program-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-raised, var(--canvas));
}

.course-program-links li > a,
.course-program-links li > span:first-child {
  flex: 1 1 220px;
  color: var(--ink);
  font-weight: 600;
}

.course-program-links li > span:not(:first-child) {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.course-program-links button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.course-program-links button:hover {
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .course-program-admin,
  .course-program-group {
    padding: 16px;
  }

  .course-program-admin form > *,
  .course-program-admin form label {
    width: 100%;
  }
}
