/* ============================================================
   features/school.css — кабинет автошколы.

   Префикс .sch-, потому что .card, .btn, .pill, .field и .lesson-head
   уже заняты дизайн-системой: их используем как есть, добавляя только
   свою обвязку.

   Цвета, радиусы, тени и шрифты берутся исключительно из переменных
   styles.css. Своих значений здесь нет, кроме прозрачностей для
   подложек и рамок: для них переменных в системе не заведено.

   Главное решение файла — таблица. На широком экране это настоящая
   таблица с выравненными колонками. На телефоне те же строки CSS
   складывает в карточки и подставляет названия колонок из data-label,
   не требуя второй разметки. Директор смотрит группу с телефона,
   и тридцать строк должны читаться там так же, как на компьютере.
   ============================================================ */

/* -------------------------------------------------- каркас */

.sch-screen { width: 100%; }
.sch-screen--narrow { max-width: 620px; }

.sch-head { margin-bottom: 18px; }

.sch-lead {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
  max-width: 58ch;
}

.sch-card { margin-bottom: 18px; }

/* -------------------------------------------------- сообщения */

.sch-msg {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}
.sch-msg .ico { flex: none; margin-top: 1px; }
.sch-msg .btn { margin-left: auto; flex: none; }

.sch-msg--err {
  background: rgba(255,92,108,.1);
  border: 1px solid rgba(255,92,108,.3);
  color: var(--red);
}
.sch-msg--ok {
  background: rgba(46,204,143,.1);
  border: 1px solid rgba(46,204,143,.24);
  color: var(--green);
}
.sch-msg--warn {
  background: var(--amber-glow);
  border: 1px solid rgba(255,159,28,.28);
  color: var(--amber-soft);
}

/* -------------------------------------------------- загрузка */

.sch-skeleton { display: grid; gap: 10px; }
.sch-skeleton__row {
  height: 58px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  opacity: .55;
  animation: sch-pulse 1.4s var(--ease) infinite;
}
.sch-skeleton__row:nth-child(2) { animation-delay: .12s; }
.sch-skeleton__row:nth-child(3) { animation-delay: .24s; }
.sch-skeleton__row:nth-child(4) { animation-delay: .36s; }
.sch-skeleton__row:nth-child(5) { animation-delay: .48s; }

@keyframes sch-pulse {
  0%, 100% { opacity: .35; }
  50% { opacity: .7; }
}

@media (prefers-reduced-motion: reduce) {
  .sch-skeleton__row { animation: none; opacity: .5; }
}

/* -------------------------------------------------- вход */

.sch-gate { text-align: center; }
.sch-gate__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  background: var(--amber-glow);
  color: var(--amber);
  margin-bottom: 14px;
}
.sch-gate__text {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}

/* -------------------------------------------------- сводка */

.sch-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sch-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--lift-1);
}
.sch-tile__val {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sch-tile__label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}
.sch-tile--green .sch-tile__val { color: var(--green); }
.sch-tile--amber .sch-tile__val { color: var(--amber); }
.sch-tile--red .sch-tile__val { color: var(--red); }

/* -------------------------------------------------- места */

.sch-seats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.sch-seats__text {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.sch-seats__text b {
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.sch-seats__acts {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* -------------------------------------------------- выданный код */

.sch-fresh {
  padding: 15px 16px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  background: var(--cyan-glow);
  border: 1px solid rgba(46,199,221,.26);
}
.sch-fresh__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cyan-soft);
  margin-bottom: 12px;
}
.sch-fresh__head .ico { flex: none; }
.sch-fresh__code {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.sch-fresh__code code {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text);
  padding: 8px 13px;
  border-radius: var(--r-xs);
  background: var(--bg-2);
  border: 1px solid var(--border);
  user-select: all;
}
.sch-fresh__hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}

/* -------------------------------------------------- список кодов */

.sch-invites__title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 12px;
}
.sch-invites__empty {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-3);
}
.sch-invites__list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.sch-invite {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.sch-invite__code {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  user-select: all;
}
.sch-invite__meta {
  font-size: 12.5px;
  color: var(--text-3);
}
.sch-invite__acts {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* -------------------------------------------------- фильтры */

.sch-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.sch-controls__right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}
.sch-controls__count {
  width: 100%;
  font-size: 12.5px;
  color: var(--text-3);
}

.sch-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.sch-chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.sch-chip:hover { background: var(--surface-2); color: var(--text); }
.sch-chip.is-on {
  background: var(--amber-glow);
  border-color: rgba(255,159,28,.35);
  color: var(--amber-soft);
}

.sch-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: var(--r-xs);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-3);
  min-height: 36px;
}
.sch-search__input {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  width: 160px;
  padding: 7px 0;
}
.sch-search__input::placeholder { color: var(--text-3); }

/* -------------------------------------------------- таблица */

.sch-tablewrap {
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--lift-1);
  overflow: hidden;
}

.sch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.sch-table thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.sch-row { border-bottom: 1px solid var(--hairline); }
.sch-row:last-child { border-bottom: 0; }
.sch-row:hover { background: var(--surface-2); }

.sch-cell {
  padding: 12px 14px;
  vertical-align: middle;
  color: var(--text-2);
}

.sch-cell--who { display: flex; align-items: center; gap: 10px; }

.sch-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--text-3);
}
.sch-dot--green { background: var(--green); box-shadow: 0 0 0 3px rgba(46,204,143,.16); }
.sch-dot--amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.sch-dot--red { background: var(--red); box-shadow: 0 0 0 3px rgba(255,92,108,.16); }
.sch-dot--grey { background: var(--text-3); box-shadow: 0 0 0 3px rgba(109,122,145,.16); }

.sch-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sch-who__name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  letter-spacing: -.01em;
}
.sch-who__sub {
  font-size: 11.5px;
  color: var(--text-3);
  word-break: break-all;
}

/* Готовность: число, полоса и словесная оценка одной колонкой. */
.sch-ready { display: flex; align-items: center; gap: 9px; }
.sch-ready__num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
}
.sch-bar {
  display: block;
  width: 62px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  flex: none;
}
.sch-bar__fill { display: block; height: 100%; border-radius: 999px; }
.sch-bar__fill--green { background: var(--green); }
.sch-bar__fill--amber { background: var(--amber); }
.sch-bar__fill--red { background: var(--red); }
.sch-bar__fill--grey { background: var(--text-3); }

.sch-level {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 700;
}
.sch-level--green { color: var(--green); }
.sch-level--amber { color: var(--amber-soft); }
.sch-level--red { color: var(--red); }
.sch-level--grey { color: var(--text-3); }

.sch-cell--num {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sch-numval { display: block; white-space: nowrap; }

/* «из» между числами набирается основным шрифтом: в моноширинном
   предлог растягивается и читается как ещё одно число. */
.sch-of {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-3);
  margin: 0 5px;
}

.sch-whenwrap { display: block; }
.sch-when { display: block; font-size: 13px; color: var(--text-2); }
.sch-when--cold { color: var(--amber-soft); }
.sch-effort {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-3);
}

.sch-nodata { color: var(--text-3); }

.sch-cell--act { text-align: right; white-space: nowrap; }
.sch-kick { opacity: .45; transition: opacity var(--t-fast) var(--ease); }
.sch-row:hover .sch-kick { opacity: 1; }
.sch-kick:hover { color: var(--red); border-color: rgba(255,92,108,.4); }

.sch-none {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 44px 20px;
  color: var(--text-3);
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.sch-none p { margin: 0; font-size: 14px; }

/* -------------------------------------------------- граница приватности */

.sch-privacy {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.sch-privacy__ico { flex: none; color: var(--text-3); margin-top: 1px; }
.sch-privacy p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
  max-width: 76ch;
}

/* -------------------------------------------------- вступление */

.sch-form { display: block; }
.sch-field { margin-bottom: 2px; }
.sch-field + .field__hint { margin-bottom: 16px; }

.sch-code {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  min-height: 50px;
}
.sch-code::placeholder { letter-spacing: .1em; color: var(--text-3); opacity: .45; }

.sch-submit { margin-top: 18px; }

.sch-found {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: rgba(46,204,143,.1);
  border: 1px solid rgba(46,204,143,.24);
  color: var(--green);
  font-size: 13.5px;
  line-height: 1.45;
}
.sch-found .ico { flex: none; }
.sch-found b { color: var(--text); font-weight: 700; }

/* -------------------------------------------------- согласие */

.sch-consent {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}
.sch-consent--flat { background: transparent; border-color: var(--hairline); }

.sch-consent__box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 14px;
}
.sch-consent__box input {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--amber);
  cursor: pointer;
}

.sch-consent__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.sch-consent__col { min-width: 0; }
.sch-consent__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 7px;
}
.sch-consent__col:first-child .sch-consent__title { color: var(--green); }
.sch-consent__col:last-child .sch-consent__title { color: var(--text-3); }
.sch-consent__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.sch-consent__col li {
  position: relative;
  padding-left: 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.sch-consent__col li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-3);
}

/* -------------------------------------------------- членство */

.sch-member {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.sch-member__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-xs);
  background: var(--amber-glow);
  color: var(--amber);
}
.sch-member__name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
  min-width: 0;
}

.sch-mystats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0 12px;
}
.sch-mystat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.sch-mystat__val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sch-mystat__label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}
.sch-mystat--green .sch-mystat__val { color: var(--green); }
.sch-mystat--amber .sch-mystat__val { color: var(--amber); }
.sch-mystat--red .sch-mystat__val { color: var(--red); }
.sch-mystat--grey .sch-mystat__val { color: var(--text-3); }

.sch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.sch-actions .btn { flex: 1 1 180px; justify-content: center; }

/* ============================================================
   Телефон.

   Таблица разбирается на карточки: заголовок колонки уезжает в
   ::before из data-label, строка становится блоком с рамкой.
   Тридцать таких карточек листаются большим пальцем и читаются
   без горизонтальной прокрутки — на неё директор не согласится.
   ============================================================ */

@media (max-width: 760px) {
  .sch-tablewrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  /* Заголовок таблицы прячем от глаз, но оставляем скринридерам. */
  .sch-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sch-table, .sch-table tbody { display: block; width: 100%; }

  /* Карточка — сетка: имя и готовность на всю ширину, три числа
     полосой в один ряд. Иначе тридцать учеников превращаются в
     двести строк, которые никто не пролистает до конца. */
  .sch-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    margin-bottom: 10px;
    padding: 13px 15px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--lift-1);
  }
  .sch-row:hover { background: var(--surface); }

  .sch-cell--who, .sch-cell--ready, .sch-cell--when, .sch-cell--act { flex: 1 1 100%; }

  /* Три числа рядом: охват, точность, экзамены.
     Основа 30%, а не 0: с нулевой основой первая ячейка втискивается
     в остаток строки готовности и схлопывается в ноль ширины. */
  .sch-cell--num {
    flex: 1 1 30%;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    padding: 10px 0 8px;
  }
  .sch-cell--num + .sch-cell--num { padding-left: 10px; }

  /* Цветная полоса слева: светофор виден при пролистывании,
     не читая цифр. */
  .sch-row--green { border-left: 3px solid var(--green); }
  .sch-row--amber { border-left: 3px solid var(--amber); }
  .sch-row--red { border-left: 3px solid var(--red); }
  .sch-row--grey { border-left: 3px solid var(--text-3); }

  .sch-cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    width: 100%;
  }
  .sch-cell::before {
    content: attr(data-label);
    flex: none;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-3);
  }

  /* Имя — шапка карточки: без подписи, во всю ширину. */
  .sch-cell--who {
    align-items: center;
    justify-content: flex-start;
    padding: 0 0 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--hairline);
  }
  .sch-cell--who::before { content: none; }

  .sch-cell--ready { align-items: center; }
  .sch-cell--ready .sch-level { margin: 0 0 0 8px; }
  .sch-bar { width: 54px; }

  .sch-cell--when {
    align-items: flex-start;
    padding-top: 8px;
    border-top: 1px solid var(--hairline);
  }
  .sch-cell--when .sch-whenwrap { text-align: right; }

  .sch-cell--act {
    justify-content: flex-end;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--hairline);
  }
  .sch-cell--act::before { content: none; }
  .sch-kick { opacity: 1; }

  .sch-controls__right { margin-left: 0; width: 100%; }
  .sch-search { flex: 1 1 auto; }
  .sch-search__input { width: 100%; }

  .sch-seats__acts { margin-left: 0; width: 100%; }
  .sch-seats__acts .btn { flex: 1 1 auto; justify-content: center; }

  .sch-summary { grid-template-columns: repeat(2, 1fr); }
  .sch-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 460px) {
  .sch-fresh__code code { font-size: 15px; width: 100%; text-align: center; }
  .sch-fresh__code .btn { flex: 1 1 auto; justify-content: center; }
  .sch-invite__acts { margin-left: 0; width: 100%; }
  /* 16px: поле кода — input, меньший кегль зумит Safari на iOS. */
  .sch-code { font-size: 16px; letter-spacing: .06em; }
}
