/* ==========================================================================
   ПОЛЬЗОВАТЕЛЬ: профиль, авторизация, аватар, меню аватара, чат-виджет,
   ученики, привязка MAX.
   Подключать ПОСЛЕДНИМ.
   ========================================================================== */

/* ==========================================================================
   1. Профиль — базовая карточка
   ========================================================================== */
.profile-card {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: clamp(20px, 2.5vw, 30px);
}
.profile-card-title {
  font-size: var(--fs-lg); color: var(--primary);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.profile-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px 26px; margin-bottom: 20px;
}
.profile-card-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 10px;
  align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed var(--divider);
}
.profile-card-row:last-child { border-bottom: none; }
.profile-card-label {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-light); font-weight: 600;
}
.profile-card-value { font-size: 14px; color: var(--text); word-break: break-word; }
.profile-empty { color: var(--text-light); opacity: 0.5; }
.profile-edit-btn { display: inline-flex; align-items: center; gap: 8px; }
.profile-editor .form-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 16px; row-gap: 4px; align-items: center; padding: 4px 0;
}
.profile-editor .form-row > label { font-weight: 500; font-size: 14px; color: var(--text); }
.profile-editor .form-row > input {
  width: 100%; min-width: 0; box-sizing: border-box;
  padding: 8px 12px; font-size: 14px; font-family: inherit;
  color: var(--input-text); background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: 6px; margin: 0 !important;
}
.profile-editor .form-row > input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.profile-editor .form-row > input:disabled {
  background: var(--tint-bg); color: var(--text-light); cursor: not-allowed;
}
@media (max-width: 640px) {
  .profile-card-row { grid-template-columns: 1fr; gap: 2px; }
  .profile-card-label { font-size: 11px; }
  .profile-editor .form-row { grid-template-columns: 1fr; row-gap: 4px; }
}

/* Карточка профиля — обновлённая сетка 2×N */
.account-layout {
  max-width: none;
  width: 100%;
  margin-top: 20px;
}
.account-card-wrap { width: 100%; }
.profile-card {
  width: 100%;
  min-height: 460px;
  padding: clamp(24px, 3vw, 40px);
  box-sizing: border-box;
}
.profile-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 48px;
  margin-bottom: 28px;
}
.profile-card-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px dashed var(--divider);
}
.profile-card-row:nth-last-child(-n+2) { border-bottom: none; }
.profile-card-label { font-size: 12px; letter-spacing: 0.5px; }
.profile-card-value { font-size: 14.5px; line-height: 1.5; }
.profile-card-head { margin-bottom: 28px; }
.profile-edit-btn { margin-top: 8px; }

@media (max-width: 900px) {
  .profile-card-grid { gap: 0 24px; }
  .profile-card-row { grid-template-columns: 130px minmax(0, 1fr); padding: 12px 0; }
  .profile-card { min-height: 0; }
}
@media (max-width: 640px) {
  .profile-card-grid { grid-template-columns: 1fr; gap: 0; }
  .profile-card-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
  .profile-card-row:nth-last-child(-n+2) { border-bottom: 1px dashed var(--divider); }
  .profile-card-row:last-child { border-bottom: none; }
  .profile-card { min-height: 0; padding: 20px 18px; }
  .profile-card-head { margin-bottom: 18px; gap: 12px; }
  .profile-card-avatar { width: 52px; height: 52px; }
  .profile-card-avatar--placeholder { font-size: 22px; }
}

/* Блок «Опасная зона» в модалке профиля */
.profile-danger-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--sem-error-bg);
  border: 1px solid var(--sem-error-border);
  border-radius: 12px;
}
.profile-danger-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sem-error-text);
}
.profile-danger-block .btn { align-self: flex-start; }

/* ==========================================================================
   2. Аватар — общий компонент
   ========================================================================== */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  user-select: none;
}
.user-avatar--header {
  width: 44px;
  height: 44px;
  font-size: 18px;
}
.user-avatar--md { width: 64px; height: 64px; font-size: 26px; }
.user-avatar--lg { width: 96px; height: 96px; font-size: 38px; }
.user-avatar--placeholder {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

/* Редактор аватара в модалке профиля */
.avatar-edit-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 4px 0 6px;
}
.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
  border: 3px solid var(--hover-tint);
  box-sizing: border-box;
  user-select: none;
  flex-shrink: 0;
}
.avatar-preview img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.avatar-edit-controls {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.avatar-edit-controls .btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px; align-self: flex-start;
}
.avatar-edit-hint {
  margin: 2px 0 0; font-size: 12px; color: var(--text-light); line-height: 1.4;
}
.profile-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.profile-card-avatar-wrap { flex-shrink: 0; }
.profile-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--hover-tint);
  box-sizing: border-box;
}
.profile-card-avatar--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 26px;
  font-family: 'Montserrat', sans-serif;
}
.profile-card-title { margin: 0; }
@media (max-width: 480px) {
  .avatar-edit-row {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .avatar-edit-controls { align-items: center; }
  .avatar-edit-controls .btn { align-self: center; }
}

/* ==========================================================================
   3. Иконки в шапке и меню аватара
   ========================================================================== */
.header-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.header-icon-btn:hover {
  background: var(--primary);
  color: var(--surface);
  transform: rotate(-8deg);
}
.header-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--sem-error);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid var(--header-bg);
  box-sizing: content-box;
}
.header-icon-badge[hidden] { display: none; }

.user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.user-avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.user-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 25%, transparent);
}
.user-avatar-btn[aria-expanded="true"] {
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
}
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  padding: 6px;
  z-index: var(--z-user-menu);
  animation: user-menu-pop 0.15s ease;
}
@keyframes user-menu-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu[hidden] { display: none; }
.user-menu-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 6px;
}
.user-menu-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-username {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.user-menu-item:hover {
  background: var(--hover-tint);
  color: var(--primary);
}
.user-menu-item i {
  width: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  transition: color 0.15s;
}
.user-menu-item:hover i { color: var(--primary); }
.user-menu-divider {
  height: 1px;
  background: var(--divider);
  margin: 6px 8px;
}
.user-menu-item--danger { color: var(--sem-error-text); }
.user-menu-item--danger:hover {
  background: var(--sem-error-bg);
  color: var(--sem-error-text);
}
.user-menu-item--danger i { color: var(--sem-error-text); }
.user-menu-item--danger:hover i { color: var(--sem-error-text); }

/* Мини-аватар-ссылка (старая версия шапки) */
.header-avatar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s;
  margin: 0 6px;
}
.header-avatar-link:hover {
  transform: scale(1.06);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 25%, transparent);
}

/* ==========================================================================
   4. Модалка авторизации (SweetAlert2)
   ========================================================================== */
.swal2-popup.auth-modal {
  width: min(520px, 94vw) !important;
  max-width: 94vw !important;
  padding: 44px 46px 32px !important;
  border-radius: 20px !important;
  max-height: 92vh !important;
  overflow-y: auto !important;
}
.swal2-popup.auth-modal .swal2-title {
  font-size: 26px !important;
  font-weight: 700;
  color: var(--primary);
  padding: 0 0 8px !important;
  margin: 0 0 20px !important;
}
.swal2-popup.auth-modal .swal2-html-container {
  margin: 0 0 8px !important;
  padding: 0 !important;
  max-height: 60vh;
  overflow-y: auto;
}
.swal2-popup.auth-modal .swal2-input {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 14px 0 !important;
  padding: 14px 18px !important;
  font-size: 15px !important;
  border-radius: 10px !important;
  border: 1px solid var(--input-border) !important;
  box-sizing: border-box !important;
  font-family: inherit !important;
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s !important;
}
.swal2-popup.auth-modal .swal2-input:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  background: var(--input-bg) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent) !important;
}
.swal2-popup.auth-modal .swal2-input::placeholder { color: var(--input-placeholder); }
.swal2-popup.auth-modal .swal2-actions {
  margin: 24px 0 0 !important;
  gap: 12px !important;
  width: 100%;
  justify-content: center;
}
.swal2-popup.auth-modal .swal2-confirm,
.swal2-popup.auth-modal .swal2-cancel {
  padding: 12px 28px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 28px !important;
  min-width: 130px;
  font-family: inherit !important;
}
.swal2-popup.auth-modal .swal2-confirm { background: var(--primary) !important; }
.swal2-popup.auth-modal .swal2-confirm:hover { background: var(--primary-dark) !important; }
.swal2-popup.auth-modal .swal2-cancel {
  background: var(--hover-tint) !important;
  color: var(--primary) !important;
}
.swal2-popup.auth-modal .swal2-cancel:hover { background: var(--hover-tint) !important; }
@media (max-width: 480px) {
  .swal2-popup.auth-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 32px 22px 24px !important;
    border-radius: 0 !important;
  }
  .swal2-popup.auth-modal .swal2-title { font-size: 22px !important; }
  .swal2-popup.auth-modal .swal2-confirm,
  .swal2-popup.auth-modal .swal2-cancel { min-width: 110px; }
}

/* Ссылки восстановления доступа в модалке входа */
.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 0;
  flex-wrap: wrap;
}
.auth-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 22px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  line-height: 1.2;
}
.auth-link:hover {
  background: var(--hover-tint);
  border-color: var(--primary);
}
.auth-link-sep {
  color: var(--text-light);
  opacity: 0.4;
  font-size: 14px;
  user-select: none;
  pointer-events: none;
}

/* Список найденных аккаунтов («Забыли логин?») */
.fl-matches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  padding: 2px;
}
.fl-match {
  padding: 12px 16px;
  background: var(--tint-bg);
  border: 1px solid var(--divider);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.fl-match:hover {
  border-color: var(--primary);
  background: var(--surface);
}
.fl-match-username {
  font-weight: 700;
  color: var(--primary);
  font-size: 15px;
  margin-bottom: 3px;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 0.2px;
}
.fl-match-meta {
  font-size: 12.5px;
  color: var(--text-light);
  word-break: break-word;
  line-height: 1.4;
}

/* Выбор способа доставки кода */
.fp-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-top: 4px;
}
.fp-method {
  position: relative;
  display: block;
  cursor: pointer;
  user-select: none;
}
.fp-method input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.fp-method-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--divider);
  border-radius: 14px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.1s;
  position: relative;
}
.fp-method:hover .fp-method-body {
  border-color: var(--primary);
  background: var(--tint-bg);
}
.fp-method:active .fp-method-body { transform: scale(0.995); }
.fp-method-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--hover-tint);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
}
.fp-method-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fp-method-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.fp-method-desc {
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.4;
}
.fp-method-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--divider);
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  flex-shrink: 0;
}
.fp-method input[type="radio"]:checked ~ .fp-method-body {
  border-color: var(--primary);
  background: linear-gradient(0deg, var(--hover-tint), var(--hover-tint)), var(--surface);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 12%, transparent);
}
.fp-method input[type="radio"]:checked ~ .fp-method-body .fp-method-icon {
  background: var(--primary);
  color: #fff;
}
.fp-method input[type="radio"]:checked ~ .fp-method-body .fp-method-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.fp-method input[type="radio"]:focus-visible ~ .fp-method-body {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
.fp-hint {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.4;
  margin: 4px 2px 0;
  font-style: italic;
}

/* Код из 6 цифр — крупный, центрированный */
.swal2-popup.auth-modal #fp-code {
  font-family: 'Courier New', monospace !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: 8px !important;
  text-align: center !important;
  padding-left: 30px !important;
  padding-right: 22px !important;
}
.fp-intro {
  text-align: left;
  font-size: 13px;
  color: var(--text-light);
  margin: 0 0 14px;
  line-height: 1.5;
}

/* ==========================================================================
   5. Модалка привязки MAX
   ========================================================================== */
.profile-section-divider {
  height: 1px;
  background: var(--divider);
  margin: 14px 0 10px;
}
.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.profile-max-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-max-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}
.profile-max-status i { flex-shrink: 0; margin-top: 2px; }
.profile-max-status--linked {
  background: var(--sem-success-bg);
  color: var(--sem-success-text);
}
.profile-max-status--empty {
  background: var(--tint-bg);
  color: var(--text-light);
}
.profile-max-status--linked i { color: var(--sem-success); }
.profile-max-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.profile-max-badge--on {
  background: var(--sem-success-bg);
  color: var(--sem-success-text);
}
.profile-max-badge--off {
  background: var(--tint-bg);
  color: var(--text-light);
  font-weight: 400;
}

.max-link-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 35, 0.6);
  z-index: var(--z-prompt-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
  animation: ip-fade 0.15s ease;
}
.max-link-modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 26px 20px;
  width: min(480px, 96vw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: ip-pop 0.18s ease;
}
.max-link-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.max-link-hint {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.max-link-hint--small {
  font-size: 12.5px;
  color: var(--text-light);
}
.max-link-code {
  font-family: monospace;
  font-size: 30px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 6px;
  text-align: center;
  padding: 16px 10px;
  background: var(--tint-bg);
  border: 1px dashed var(--primary);
  border-radius: 12px;
  user-select: all;
}
.max-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.max-link-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  padding: 8px 12px;
  background: var(--tint-bg);
  border-radius: 10px;
}
.max-link-status i { color: var(--primary); }

/* ==========================================================================
   6. Виджет чата — базовая версия (ученик)
   ========================================================================== */
.chat-container {
  max-width: 800px;
  margin: clamp(20px, 3vw, 40px) auto;
  padding: clamp(14px, 2vw, 20px);
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  box-sizing: border-box;
  transition: background-color 0.25s ease;
}
.chat-messages {
  height: clamp(320px, 45vh, 460px);
  overflow-y: auto;
  border: 1px solid var(--divider);
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 15px;
  background: var(--tint-bg);
}
.chat-message {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--hover-tint);
  border-radius: 8px;
  max-width: min(80%, 520px);
  word-wrap: break-word;
}
.chat-message.own { background: var(--hover-tint); margin-left: auto; }
.chat-username { font-weight: bold; color: var(--primary); margin-right: 10px; }
.chat-time { font-size: 12px; color: var(--text-light); float: right; }
.chat-content { margin-top: 4px; }
.chat-input { display: flex; gap: 10px; }
.chat-input-field {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--input-border);
  border-radius: 5px;
  font-family: inherit;
  font-size: var(--fs-md);
  background: var(--input-bg);
  color: var(--input-text);
}
.btn-chat-send {
  padding: 10px 20px;
  background: var(--primary);
  color: var(--surface);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.btn-chat-send:hover { background: var(--primary-dark); }
.chat-status { margin-top: 10px; font-size: var(--fs-sm); color: var(--text-light); }

/* ==========================================================================
   7. Плавающий виджет чата
   ========================================================================== */
.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(420px, calc(100vw - 40px));
  height: min(600px, calc(100vh - 100px));
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  z-index: var(--z-chat-widget);
  overflow: hidden;
  border: 1px solid var(--divider);
  animation: chat-widget-in 0.2s ease;
}
.chat-widget[hidden] { display: none; }
@keyframes chat-widget-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--primary);
  color: var(--surface);
  flex-shrink: 0;
  min-height: 56px;
}
.chat-widget-back {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s;
}
.chat-widget-back:hover { background: rgba(255, 255, 255, 0.28); }
.chat-widget-back[hidden] { display: none; }

.chat-widget-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.chat-widget-title > i { font-size: 14px; flex-shrink: 0; }
.chat-widget-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-widget-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-widget-close:hover { background: rgba(255, 255, 255, 0.28); }

.chat-widget-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-widget-view[hidden] { display: none; }

.chat-widget-list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-widget-list-body::-webkit-scrollbar { width: 6px; }
.chat-widget-list-body::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 3px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  border-bottom: 1px solid var(--divider);
  transition: background 0.15s;
  min-width: 0;
}
.contact-item:hover { background: var(--hover-tint); }
.contact-item:last-child { border-bottom: none; }

.contact-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
}
.contact-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--hover-tint);
}
.contact-avatar--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  font-family: 'Montserrat', sans-serif;
}
.contact-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-light);
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.contact-status--online { background: var(--sem-success); }
.contact-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.contact-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-last {
  font-size: 12.5px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-last--empty { font-style: italic; opacity: 0.6; }
.contact-last i { opacity: 0.7; margin-right: 2px; }
.contact-you { color: var(--primary); font-weight: 500; }
.contact-unread {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--primary);
  color: var(--surface);
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  flex-shrink: 0;
}
.chat-widget-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  font-size: 13.5px;
}

.chat-widget-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--tint-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.chat-widget-messages::-webkit-scrollbar { width: 6px; }
.chat-widget-messages::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 3px;
}

.chat-widget-message {
  max-width: 82%;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  word-wrap: break-word;
  align-self: flex-start;
  animation: chat-message-in 0.15s ease;
}
@keyframes chat-message-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-widget-message--own {
  align-self: flex-end;
  background: var(--primary);
  color: var(--surface);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 4px;
}
.chat-widget-message--own .chat-widget-message-author { color: rgba(255, 255, 255, 0.85); }
.chat-widget-message--own .chat-widget-message-time   { color: rgba(255, 255, 255, 0.7); }
.chat-widget-message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
  font-size: 11px;
}
.chat-widget-message-author {
  font-weight: 700;
  color: var(--primary);
}
.chat-widget-message-time {
  color: var(--text-light);
  font-size: 10.5px;
  flex-shrink: 0;
}
.chat-widget-message-body {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-widget-message-image {
  display: block;
  margin: 4px 0 0;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}
.chat-widget-message-image img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: cover;
}

.chat-widget-input {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--divider);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-widget-input input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: 22px;
  background: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-widget-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.chat-widget-input input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.chat-widget-attach,
.chat-widget-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.chat-widget-attach {
  background: var(--hover-tint);
  color: var(--primary);
}
.chat-widget-attach:hover { background: var(--primary); color: #fff; }
.chat-widget-input button:last-child {
  background: var(--primary);
  color: var(--surface);
}
.chat-widget-input button:last-child:hover:not(:disabled) { background: var(--primary-dark); }
.chat-widget-input button:last-child:active:not(:disabled) { transform: scale(0.95); }
.chat-widget-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-widget-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--divider);
  background: var(--tint-bg);
  flex-shrink: 0;
}
.chat-widget-attach-preview[hidden] { display: none; }
.chat-widget-attach-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--divider);
}
.chat-widget-attach-remove {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--icon-btn-danger-bg);
  color: var(--icon-btn-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.15s;
}
.chat-widget-attach-remove:hover { background: var(--icon-btn-danger-hover); }

.chat-widget-status {
  padding: 4px 16px 8px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  min-height: 16px;
  background: var(--surface);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .chat-widget {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: calc(100vh - 90px);
    border-radius: 14px;
  }
  .header-icon-btn { width: 40px; height: 40px; font-size: 15px; }
  .user-avatar-btn { width: 40px; height: 40px; }
  .user-avatar--header { width: 40px; height: 40px; font-size: 16px; }
  .user-menu { min-width: 220px; right: -8px; }
}

/* ==========================================================================
   8. Виджет чата — большое окно для учителя
   ========================================================================== */
.chat-widget--teacher {
  width: min(960px, calc(100vw - 40px));
  height: min(680px, calc(100vh - 60px));
  max-height: calc(100vh - 60px);
}
.chat-widget--teacher .chat-widget-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.chat-widget--teacher .chat-widget-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--tint-bg);
  border-right: 1px solid var(--divider);
}
.chat-widget--teacher .chat-widget-sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 20px;
  flex-shrink: 0;
}
.chat-widget--teacher .chat-widget-sidebar-search i {
  color: var(--text-light);
  font-size: 13px;
}
.chat-widget--teacher .chat-widget-sidebar-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  padding: 0;
}
.chat-widget--teacher .chat-widget-sidebar-sort {
  margin: 0 12px 8px;
  padding: 7px 12px;
  border: 1px solid var(--divider);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-widget--teacher .chat-widget-sidebar-sort:focus {
  border-color: var(--primary);
}
.chat-widget--teacher .chat-widget-sidebar-filter {
  margin: 0 12px 6px;
  flex-shrink: 0;
}
.chat-widget--teacher .chat-widget-sidebar-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.chat-sidebar-chip {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-sidebar-chip:hover {
  background: var(--hover-tint);
  border-color: var(--primary);
}
.chat-sidebar-chip.active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}
.chat-widget--teacher .chat-widget-list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 10px;
  scrollbar-width: thin;
}
.chat-widget--teacher .chat-widget-list-body::-webkit-scrollbar { width: 6px; }
.chat-widget--teacher .chat-widget-list-body::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 3px;
}
.chat-widget--teacher .chat-widget-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}
.chat-widget-main-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}
.chat-widget-main-head[hidden] { display: none; }
.chat-widget-main-head .chat-widget-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-widget-main-head .chat-widget-title i {
  color: var(--primary);
  font-size: 13px;
}
.chat-widget-main-head .chat-widget-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-widget-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-light);
  padding: 40px 20px;
  text-align: center;
}
.chat-widget-empty[hidden] { display: none; }
.chat-widget-empty i {
  font-size: 42px;
  color: var(--primary);
  opacity: 0.35;
}
.chat-widget-empty span {
  font-size: 14px;
  font-style: italic;
}
.chat-widget-empty--list {
  padding: 30px 16px;
  font-size: 13px;
  font-style: italic;
}
.chat-widget--teacher .chat-widget-messages {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
}
.chat-widget--teacher .chat-widget-messages[hidden] { display: none; }
.chat-widget--teacher .chat-widget-input[hidden] { display: none; }

.contact-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.contact-meta-tag {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--hover-tint);
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.contact-meta-tag--paid_active {
  background: var(--sem-success-bg);
  color: var(--sem-success-text);
}
.contact-meta-tag--completed {
  background: var(--sem-info-bg);
  color: var(--sem-info-text);
}

.chat-widget--teacher .contact-item.is-active {
  background: var(--hover-tint);
  border-left: 3px solid var(--primary);
  padding-left: 9px;
}
.chat-widget .contact-username { display: none; }

.chat-widget-profile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-widget-profile:hover { background: rgba(255, 255, 255, 0.28); }
.chat-widget-profile[hidden] { display: none; }

@media (max-width: 720px) {
  .chat-widget--teacher {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: calc(100vh - 90px);
    max-height: none;
    border-radius: 14px;
  }
  .chat-widget--teacher .chat-widget-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .chat-widget--teacher .chat-widget-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--divider);
    max-height: 45%;
  }
}

/* ==========================================================================
   9. Ученики — таблица и вкладка в кабинете учителя
   ========================================================================== */
.students-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.students-table thead {
  background: var(--primary);
  color: var(--surface);
}
.students-table th {
  padding: 15px;
  text-align: left;
  font-weight: 500;
}
.students-table td {
  padding: 15px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.students-table tr:last-child td { border-bottom: none; }
.students-table tr:hover { background: var(--hover-tint); }
.students-table td button + button { margin-left: 4px; }

@media (max-width: 800px) {
  .students-table thead { display: none; }
  .students-table,
  .students-table tbody,
  .students-table tr,
  .students-table td { display: block; width: 100%; }
  .students-table tr {
    border-bottom: 1px solid var(--divider);
    padding: 10px 12px;
  }
  .students-table td {
    border: none;
    padding: 4px 0;
  }
  .students-table td[style*="white-space"] {
    white-space: normal !important;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

.students-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.students-search {
  flex: 1 1 260px;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.students-search i {
  color: var(--text-light);
  font-size: 14px;
}
.students-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.students-sort {
  padding: 11px 18px;
  border-radius: 26px;
  border: 1px solid var(--divider);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  outline: none;
}
.students-sort:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.students-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.students-filter-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.students-filter-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.students-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.students-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.students-chip:hover {
  background: var(--hover-tint);
  border-color: var(--primary);
}
.students-chip.active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}
.students-count {
  font-size: 12.5px;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-left: 4px;
}
.student-group-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.student-group-input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}
.student-group-input:hover {
  border-color: var(--divider);
  background: var(--tint-bg);
}
.student-group-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.student-group-input:disabled {
  opacity: 0.6;
  cursor: wait;
}
.student-status-select {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.student-status-select:hover {
  border-color: var(--divider);
  background: var(--tint-bg);
}
.student-status-select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.student-status-select:disabled {
  opacity: 0.6;
  cursor: wait;
}
.student-status-select[data-status="paid_active"] { color: var(--sem-success-text); font-weight: 600; }
.student-status-select[data-status="completed"]   { color: var(--sem-info-text); }
.student-status-select[data-status="registered"]  { color: var(--text-light); }

@media (max-width: 900px) {
  .students-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .students-sort { width: 100%; }
  .students-filters { gap: 6px; }
  .students-filter-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ==========================================================================
   10. Личный кабинет ученика (dashboard.html)
   ========================================================================== */
.dashboard-welcome { margin-bottom: 20px; }
.dashboard-section-title { margin: 30px 0 16px; color: var(--primary); }
.dashboard-error { color: var(--sem-error-text); }
.dashboard-empty {
  text-align: center; padding: 40px;
  color: var(--text-light);
}
.dashboard-lessons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.dashboard-lesson {
  background: var(--surface);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background-color 0.25s ease;
}
.dashboard-lesson-main {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}
.dashboard-lesson-date {
  font-weight: 600;
  min-width: 140px;
  color: var(--text);
}
.dashboard-lesson-time {
  background: var(--hover-tint);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.dashboard-lesson-subject {
  font-weight: 500;
  color: var(--text);
}
.dashboard-lesson-topic {
  color: var(--text-light);
}
.dashboard-lesson-student {
  background: var(--sem-info-bg);
  color: var(--sem-info-text);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.dashboard-lesson-btn {
  padding: 8px 15px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .dashboard-lesson { padding: 14px 16px; }
  .dashboard-lesson-main { gap: 8px; }
  .dashboard-lesson-date { min-width: 0; }
  .dashboard-lesson-btn { width: 100%; justify-content: center; }
}

/* ==========================================================================
   11. Модалка удаления ученика
   ========================================================================== */
.swal2-popup.delete-student-modal {
  padding: 28px 22px 20px !important;
  width: min(500px, 94vw) !important;
}
.swal2-popup.delete-student-modal .swal2-html-container {
  padding: 0 8px !important;
  margin: 0 !important;
  overflow: visible !important;
}
.swal2-popup.delete-student-modal .swal2-title {
  margin-bottom: 10px !important;
}
.delete-account-username-chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--tint-bg);
  color: var(--text);
  border: 1px solid var(--divider);
  border-radius: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: all;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.delete-account-username-chip:hover {
  background: var(--hover-tint);
  border-color: var(--primary);
  color: var(--primary);
}
.swal2-popup.delete-student-modal .swal2-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin: 10px 0 0 !important;
  padding: 11px 16px !important;
  font-size: 14.5px !important;
  border-radius: 10px !important;
  border: 1px solid var(--input-border) !important;
  font-family: inherit !important;
}
.swal2-popup.delete-student-modal .swal2-input:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent) !important;
}

/* ==========================================================================
   12. Auth: регистрация, поля, вспомогательные классы
   ========================================================================== */
.auth-intro {
  text-align: left;
  font-size: 13px;
  color: var(--text-light);
  margin: 0 0 12px;
  line-height: 1.5;
}
.auth-hint {
  margin: 0 0 8px;
  text-align: left;
  font-size: 13px;
  color: var(--text-light);
}
.auth-warning {
  margin: 0 0 12px;
  padding: 10px;
  background: var(--sem-warning-bg);
  color: var(--sem-warning-text);
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}
.auth-field-block {
  text-align: left;
  margin-top: 6px;
}
.auth-field-label {
  font-size: 12px;
  color: var(--text-light);
  display: block;
  margin-bottom: 4px;
}

.profile-editor-row--relative {
  position: relative;
}

.profile-section-title--danger { color: var(--sem-error-text); }
.profile-danger-btn {
  border-color: var(--sem-error) !important;
  color: var(--sem-error-text) !important;
}
.profile-danger-btn:hover {
  background: var(--sem-error) !important;
  color: #fff !important;
}

.max-link-status-success { color: var(--sem-success); }

/* ==========================================================================
   13. Модалка привязки MAX — состояния
   ========================================================================== */
.profile-max-status i { color: var(--primary); }
.profile-max-status--linked i { color: var(--sem-success); }
.profile-max-status--empty i  { color: var(--text-light); }