/* Стили страниц группы «forms» — дополнение к modern.css
   Формы (.form-shell/.form-card), подтверждения удаления (.confirm-card),
   служебные сообщения (.fx-notice), кабинеты (.dash-*), таблицы-карточки на телефоне (.table-stack). */

/* ---------- каркас формы ---------- */
.form-shell { max-width: 760px; margin: 0 auto; }
.form-shell.is-narrow { max-width: 520px; }
.form-shell .page-head { margin-bottom: 20px; }
.form-card { padding: 0; }
.form-card > .card-body { padding: 28px 30px; }
.form-card .form-field { margin-bottom: 20px; }
.form-card .form-field:last-child { margin-bottom: 0; }
.form-card .form-label .req { color: var(--a-danger); margin-left: 2px; }
.form-card .form-text { color: var(--a-muted); font-size: .84rem; margin-top: 6px; }
.form-card textarea.form-control { min-height: 96px; }
.form-card input[type="file"].form-control { padding: .5rem .7rem; }
.form-card input[type="file"].form-control::file-selector-button { border-radius: 8px; margin-right: 10px; }
.form-card .form-select[multiple] { min-height: 140px; }
.form-card .field-error { display: flex; gap: 6px; align-items: flex-start; }
.form-card .field-error::before { content: "\F33A"; font-family: "bootstrap-icons"; line-height: 1.5; }
.form-card .has-error .form-control, .form-card .has-error .form-select { border-color: #fca5a5; }

/* файл с текущим значением (ClearableFileInput) */
.file-current { font-size: .86rem; color: var(--a-muted); overflow-wrap: anywhere; }
.file-current a { font-weight: 600; }
.file-current input[type="checkbox"] { margin: 0 4px 0 8px; vertical-align: -2px; }
.file-current input[type="file"] { display: block; width: 100%; margin-top: 6px; }

/* флажок */
.form-switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--a-border);
  border-radius: var(--a-radius-sm); background: #fafbff; }
.form-switch-row .form-check-input { margin: 3px 0 0; flex-shrink: 0; width: 1.15em; height: 1.15em; }
.form-switch-row label { font-weight: 600; font-size: .92rem; cursor: pointer; }
.form-check-input:checked { background-color: var(--a-primary); border-color: var(--a-primary); }
.form-check-input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(79,70,229,.12); }

/* список флажков (CheckboxSelectMultiple) */
.fx-checks > div { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; padding: 10px 12px;
  border: 1px solid var(--a-border); border-radius: var(--a-radius-sm); background: #fff; }
.fx-checks label { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer; margin: 0; }
.fx-checks input[type="checkbox"] { margin-top: 4px; flex-shrink: 0; accent-color: var(--a-primary); }

/* CKEditor */
.form-card .cke { border-radius: var(--a-radius-sm); overflow: hidden; border-color: var(--a-border) !important; box-shadow: none !important; max-width: 100%; }
.form-card .django-ckeditor-widget { display: block !important; width: 100%; }

/* группы полей в длинной форме */
.form-group-title { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--a-primary); margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--a-border); }
.form-group-title.is-first, .form-group-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* кнопки внизу формы */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--a-border); }
.form-actions .spacer { flex: 1; }
.form-errors { display: flex; gap: 10px; align-items: flex-start; }

/* ---------- подтверждение удаления и служебные сообщения ---------- */
.confirm-card, .fx-notice { max-width: 560px; margin: 24px auto 0; text-align: center; padding: 40px 36px; }
.confirm-icon, .fx-icon { width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; font-size: 1.8rem;
  color: var(--a-primary); background: linear-gradient(135deg, #eef2ff, #e0f2fe); }
.confirm-icon, .fx-icon.is-danger { color: #dc2626; background: #fee2e2; }
.fx-icon.is-success { color: #059669; background: #d1fae5; }
.confirm-card h1, .fx-notice h1 { font-size: 1.6rem; margin-bottom: 10px; }
.confirm-card p, .fx-notice p { color: var(--a-muted); margin-bottom: 0; }
.confirm-card .confirm-object { display: inline-block; margin: 14px 0 0; padding: 8px 14px; border-radius: var(--a-radius-sm);
  background: #f8fafc; border: 1px solid var(--a-border); color: var(--a-text); font-weight: 600; overflow-wrap: anywhere; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.confirm-card .btn-danger { background: var(--a-danger); border-color: var(--a-danger); box-shadow: 0 8px 20px rgba(239,68,68,.25); }
.confirm-card .btn-danger:hover { background: #dc2626; border-color: #dc2626; }

/* ---------- вход-подобные одиночные карточки (сброс пароля) ---------- */
.auth-solo { max-width: 480px; margin: 16px auto 0; padding: 40px 38px; border-radius: 28px; box-shadow: var(--a-shadow-lg); }
.auth-solo h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-solo .fx-icon { margin: 0 0 18px; }
.auth-solo .lead-muted { color: var(--a-muted); margin-bottom: 22px; }
.auth-solo .input-icon .form-control { height: 48px; }
.auth-solo .auth-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--a-border); font-size: .9rem; color: var(--a-muted); text-align: center; }
.auth-solo ul { padding-left: 18px; color: var(--a-muted); font-size: .84rem; margin: 8px 0 0; }

/* ---------- кабинеты ---------- */
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.dash-stat { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 18px 20px; }
.dash-stat .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0;
  color: var(--a-primary); background: var(--a-primary-50); }
.dash-stat .num { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.dash-stat .cap { color: var(--a-muted); font-size: .84rem; }
a.dash-stat { color: inherit; transition: transform .15s, box-shadow .15s; }
a.dash-stat:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--a-shadow-lg); }
.fx-section { margin-top: 32px; }
.fx-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.fx-head h2 { font-size: 1.25rem; margin: 0; display: flex; align-items: center; gap: 10px; }
.fx-head h2 i { color: var(--a-primary); font-size: 1.1rem; }
.fx-head .count { font-size: .8rem; font-weight: 700; color: var(--a-muted); background: #f1f5f9; border-radius: 999px; padding: 2px 10px; }
.dash-card { overflow: hidden; }
.dash-card .empty { padding: 36px 16px; }
.dash-card .table td { font-size: .92rem; }
.dash-card .table tbody tr:last-child td { border-bottom: 0; }
.cell-sub { display: block; color: var(--a-muted); font-size: .82rem; overflow-wrap: anywhere; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; }
.pill-danger { color: #b91c1c; background: #fee2e2; }
.pill-warning { color: #92400e; background: #fef3c7; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }

/* список курсов учителя */
.teach-list { display: grid; gap: 10px; }
.teach-item { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 14px 18px; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.teach-item:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--a-shadow-lg); border-color: #dcdff0; }
.teach-item .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--a-primary-50); color: var(--a-primary); flex-shrink: 0; }
.teach-item .main { flex: 1; min-width: 0; }
.teach-item .main b { display: block; overflow-wrap: anywhere; }
.teach-item .go { color: var(--a-muted); }

/* карточка проверки ДЗ */
.hw-review textarea { min-height: 64px; }
.hw-review .btns { display: flex; gap: 8px; }
.hw-review .btns .btn { flex: 1; }
.btn-success-soft { color: #047857; background: #d1fae5; border: 1px solid transparent; }
.btn-success-soft:hover { color: #fff; background: #059669; }
.btn-danger-soft { color: #b91c1c; background: #fee2e2; border: 1px solid transparent; }
.btn-danger-soft:hover { color: #fff; background: #dc2626; }

/* учителя (админ) */
.teacher-card .card-header { display: flex; align-items: center; gap: 12px; }
.teacher-card .avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--a-grad); flex-shrink: 0; }
.teacher-card .who { min-width: 0; }
.teacher-card .who b { display: block; overflow-wrap: anywhere; }
.teacher-card .who span { color: var(--a-muted); font-size: .86rem; font-weight: 500; overflow-wrap: anywhere; }
.teacher-card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--a-muted); margin: 0 0 10px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plain-list li { display: flex; align-items: baseline; gap: 8px; overflow-wrap: anywhere; min-width: 0; }
.plain-list li i { color: var(--a-primary); }

/* рассылки */
.nl-list { display: grid; gap: 12px; }
.nl-item { display: flex; flex-direction: row; align-items: center; gap: 18px; padding: 18px 22px; }
.nl-item .main { flex: 1; min-width: 0; }
.nl-item h3 { font-size: 1.05rem; margin: 0 0 6px; overflow-wrap: anywhere; }
.nl-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--a-muted); font-size: .85rem; }
.nl-meta i { color: var(--a-primary); margin-right: 4px; }
.nl-item .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* тарифы-подписка */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { padding: 24px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.plan-card h3 { margin: 0; }
.plan-card p { color: var(--a-muted); margin: 0 0 6px; flex: 1; }

/* ---------- таблица → карточки на телефоне ---------- */
@media (max-width: 767.98px) {
  .form-card > .card-body { padding: 22px 18px; }
  .form-actions .btn { flex: 1 1 100%; }
  .form-actions .spacer { display: none; }
  .confirm-card, .fx-notice { padding: 30px 20px; margin-top: 8px; }
  .confirm-actions .btn { flex: 1 1 100%; }
  .auth-solo { padding: 30px 20px; border-radius: 22px; }
  .dash-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-stat { padding: 14px; gap: 10px; }
  .dash-stat .ico { width: 38px; height: 38px; font-size: 1.05rem; }
  .dash-stat .num { font-size: 1.25rem; }
  .nl-item { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 18px; }
  .nl-item .acts { justify-content: flex-start; }
  .plan-grid { grid-template-columns: 1fr; }

  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 14px 16px; border-bottom: 1px solid var(--a-border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { padding: 4px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; overflow-wrap: break-word; min-width: 0; }
  .table-stack td > div { min-width: 0; }
  .table-stack td::before { content: attr(data-label); color: var(--a-muted); font-size: .8rem; font-weight: 600; text-align: left; flex-shrink: 0; max-width: 45%; }
  .table-stack td.td-main { display: block; font-weight: 700; font-size: 1rem; text-align: left; overflow-wrap: anywhere; }
  .table-stack td.td-main::before, .table-stack td.td-block::before { display: none; }
  .table-stack td.td-block { display: block; text-align: left; padding-top: 10px; }
  .table-stack td[colspan] { display: block; text-align: center; }
  .table-stack td[colspan]::before { display: none; }
  .table-stack .cell-actions { justify-content: flex-end; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
}
.plain-list.is-scroll { max-height: 320px; overflow-y: auto; padding-right: 6px; }
@media (min-width: 992px) { .sticky-lg { position: sticky; top: calc(var(--nav-h) + 16px); } }
