/* ==========================================================================
   Стили сайта
   Дизайн-система: светлые холодные фоны, фиолетовый бренд для действий,
   коралловый акцент, шрифт Nunito, скругления 8/12/20, лёгкие тени.
   ========================================================================== */

/* ---- Шрифт Nunito (локальные файлы, лицензия OFL) --------------------- */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/nunito/nunito-cyrillic.fd4986b86093.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/nunito/nunito-latin-ext.ffdc8b0c86fb.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/nunito/nunito-latin.166202cc391c.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Токены --------------------------------------------------------------- */
:root {
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface-alt: #F1F0F8;
  --border: #E6E6EF;
  --neutral: #CFCFDE;

  --ink: #2A2840;
  --ink-secondary: #6B6A80;
  --ink-muted: #9A99AE;

  --brand: #6C63FF;
  --brand-strong: #5A52E6;
  --brand-soft: #EEEDFF;
  --brand-soft-hover: #E2E0FF;
  --accent: #FD6584;
  --accent-strong: #CC3456;
  --accent-soft: #FFEEF2;

  --success: #1E9E6A;
  --success-soft: #E4F5EC;
  --success-ink: #14714B;
  --warning: #F2A93B;
  --warning-soft: #FEF4E2;
  --warning-ink: #8A5A00;
  --error: #E5484D;
  --error-soft: #FDECEC;
  --error-ink: #B3261E;
  --rating: #FFB547;
  /* Премиум: золотая рамка и отметки. */
  --gold: #E2B33C;
  --gold-strong: #B7861B;
  --gold-soft: #FFF6DC;
  --gold-ink: #7A5A0E;

  --font-sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --shadow-card: 0 2px 8px rgba(42, 40, 64, 0.06);
  --shadow-hover: 0 8px 24px rgba(108, 99, 255, 0.14);

  --header-h: 72px;
  --container: 1320px;

  /* Иконки направлений: заливка и акцент (см. static/img/subjects.svg). */
  --icon-fill: #FFFFFF;
  --icon-accent: var(--accent);
  --star-off: var(--border);
}

/* ---- Основа ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 { margin: 0 0 var(--space-4); color: var(--ink); overflow-wrap: break-word; }
h1 { font-size: 36px; line-height: 44px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 28px; line-height: 36px; font-weight: 700; }
h3 { font-size: 20px; line-height: 28px; font-weight: 700; }
h4 { font-size: 16px; line-height: 24px; font-weight: 700; }
p { margin: 0 0 var(--space-4); }
ul, ol { margin: 0 0 var(--space-4); padding-left: 22px; }

a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

img, svg { max-width: 100%; }
img { height: auto; }

button { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(108, 99, 255, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 8px 16px; border-radius: var(--radius-md);
  background: var(--brand-strong); color: #fff; font-weight: 700;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

.muted { color: var(--ink-secondary); }
.small { font-size: 14px; line-height: 20px; }
.caption { font-size: 12px; line-height: 16px; font-weight: 600; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.hidden { display: none !important; }

/* ---- Сетка ---------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.page { padding-block: var(--space-8) var(--space-16); }
.section { padding-block: var(--space-12); }
.section-alt { background: var(--surface-alt); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}
.section-head h2 { margin-bottom: var(--space-2); }
.section-head p { margin: 0; color: var(--ink-secondary); max-width: 720px; }

.page-head { margin-bottom: var(--space-8); }
.page-head h1 { margin-bottom: var(--space-2); }
.page-head .lead { margin: 0; max-width: none; }

.lead { font-size: 18px; line-height: 28px; color: var(--ink-secondary); }

.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- Шапка ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: none;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: 40px; flex: none; }
.brand span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Название сайта задаётся в админке и может быть длинным: в шапке оно
   сжимается с многоточием, а меню и кнопки сохраняют ширину. */
.site-header .brand { flex: 0 1 auto; min-width: 0; }

.main-nav { display: flex; align-items: center; gap: 4px; flex: none; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--ink-secondary);
  font-weight: 700;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { color: var(--ink); background: var(--surface-alt); text-decoration: none; }
.nav-link.active { color: var(--brand-strong); background: var(--brand-soft); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); flex: none; }

.header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  color: var(--ink-secondary);
}
.header-icon-btn:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.header-icon-btn .icon { width: 22px; height: 22px; }

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
}
.header-icon-btn .count-badge { position: absolute; top: 2px; right: 0; border: 2px solid var(--surface); height: 22px; }
.count-badge-soft { background: var(--brand-soft); color: var(--brand-strong); }

/* Уведомления: значок в шапке (красная метка - есть непрочитанные) и список под ним */
.notify-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--error);
}
.notify-panel { width: 380px; padding: 0; overflow: hidden; }
.notify-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--border); }
.notify-title { font-weight: 800; }
.notify-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--brand-strong);
  cursor: pointer;
}
.notify-icon-btn:hover { background: var(--brand-soft); }
.notify-icon-btn[disabled] { background: transparent; color: var(--neutral); cursor: default; }
.notify-list { max-height: min(440px, calc(100vh - var(--header-h) - 140px)); overflow-y: auto; overscroll-behavior: contain; }
.notify-item { display: flex; align-items: flex-start; gap: 8px; padding: 12px 10px 12px 18px; border-bottom: 1px solid var(--border); }
.notify-item:last-child { border-bottom: 0; }
.notify-item.unread { background: #F8F7FF; }
.notify-item-body { position: relative; flex: 1; min-width: 0; }
.notify-item.unread .notify-item-body::before { content: ""; position: absolute; top: 7px; left: -11px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.notify-text { margin: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.notify-item:not(.unread) .notify-text { color: var(--ink-secondary); }
/* Уведомление о событии - ссылка на его страницу (открытие отмечает прочитанным). */
a.notify-link { display: block; color: var(--ink); }
a.notify-link:hover { color: var(--brand-strong); text-decoration: none; }
.notify-item:not(.unread) a.notify-link { color: var(--ink-secondary); }
.notify-item:not(.unread) a.notify-link:hover { color: var(--brand-strong); }
.notify-time { display: block; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.notify-item form { margin: -6px 0 0; }
.notify-state, .notify-empty { margin: 0; padding: 28px 18px; text-align: center; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.notify-empty .icon { display: block; width: 32px; height: 32px; margin: 0 auto 8px; color: var(--brand-soft-hover); }
.notify-all { display: block; padding: 11px 18px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; line-height: 20px; font-weight: 700; }
.notify-all:hover { background: var(--brand-soft); text-decoration: none; }
/* Страница "Уведомления" в кабинете: строки списка - во всю ширину карточки. */
.card.notify-page { padding: 0; overflow: hidden; }
.notify-page .notify-item { padding: 16px 16px 16px 30px; }
.notify-page .notify-item-body::before { left: -15px; top: 9px; }
.notify-page .notify-text { font-size: 16px; line-height: 24px; }

/* Выпадающее меню (Вход, меню пользователя) */
.dropdown { position: relative; }
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
  cursor: pointer;
}
.dropdown-toggle:hover { background: var(--brand-soft-hover); }
.dropdown-toggle .chevron { transition: transform .2s; }
.dropdown.open .dropdown-toggle .chevron { transform: rotate(180deg); }
.dropdown-toggle.user-toggle { background: transparent; padding: 4px 10px 4px 4px; color: var(--ink); }
.dropdown-toggle.user-toggle:hover { background: var(--surface-alt); }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 280px;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-title { padding: 8px 12px 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-alt); text-decoration: none; }
.dropdown-item small { display: block; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ink-secondary); }
.dropdown-item .count-badge { margin-left: auto; }
.dropdown-item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--radius-md);
  background: var(--brand-soft); color: var(--brand-strong);
}
.dropdown-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.dropdown-foot { padding: 8px 12px 6px; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.dropdown-item.danger { color: var(--error-ink); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  margin-left: auto;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--ink);
  cursor: pointer;
}
.mobile-menu { display: none; }

/* ---- Аватары ---------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 15px;
  overflow: hidden;
  object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

/* ---- Кнопки ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); color: #fff; }
.btn-secondary { background: var(--brand-soft); color: var(--brand-strong); }
.btn-secondary:hover { background: var(--brand-soft-hover); color: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--brand-strong); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-outline { background: var(--surface); border-color: var(--neutral); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-strong); }
.btn-danger { background: var(--error-soft); color: var(--error-ink); }
.btn-danger:hover { background: #FBDCDC; }
.btn-success { background: var(--success-soft); color: var(--success-ink); }
.btn-success:hover { background: #D3EFE0; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; line-height: 20px; border-radius: 10px; }
/* Мелкий белый текст на брендовом фоне контрастнее на более тёмном оттенке. */
.btn-primary.btn-sm { background: var(--brand-strong); }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 18px; line-height: 28px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; }

.link-button {
  padding: 0; border: 0; background: none;
  color: var(--brand-strong); font-weight: 700; cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* ---- Карточки, бейджи ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}
.card + .card { margin-top: var(--space-6); }
.grid > .card, .review-cards > .card, .tutor-grid > .card, .role-cards > .card, .service-grid > .card { margin-top: 0; }
.card-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.card-title h2, .card-title h3 { margin: 0; }
.card-flat { box-shadow: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-error { background: var(--error-soft); color: var(--error-ink); }
.badge-neutral { background: var(--surface-alt); color: var(--ink-secondary); }

.pill-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
a.pill:hover { background: var(--brand-soft-hover); text-decoration: none; }
.pill-muted { background: var(--surface-alt); color: var(--ink-secondary); }

/* ---- Звёзды рейтинга ---------------------------------------------------------- */
.stars { display: inline-flex; gap: 2px; color: var(--rating); vertical-align: middle; }
.stars .icon { width: 18px; height: 18px; }
.stars .star-off { color: var(--star-off); }
.stars-lg .icon { width: 24px; height: 24px; }
.stars-sm .icon { width: 14px; height: 14px; }
.rating-line { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rating-value { font-weight: 800; }
.rating-count { color: var(--ink-secondary); font-size: 14px; }

/* ---- Формы ------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-6); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field { margin-bottom: 20px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--ink);
}
.field-label .req { color: var(--accent-strong); }
.field-help { margin: 6px 0 0; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.field-help ul { margin: 4px 0 0; padding-left: 18px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], input[type="date"],
input[type="datetime-local"], input[type="time"],
select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border: 1px solid var(--neutral);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:hover, select:hover, textarea:hover { border-color: #B9B8CE; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 120px; resize: vertical; }
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6A80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
  cursor: pointer;
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--error); }
.errorlist {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: var(--error-ink);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.errorlist.nonfield { margin: 0 0 var(--space-4); }

input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  border: 1.5px solid var(--neutral);
  border-radius: 7px;
  background: var(--surface) center / 16px no-repeat;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
input[type="radio"]:checked { border: 6px solid var(--brand); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }

.check-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; cursor: pointer; }
.check-row label, .check-row span { cursor: pointer; }
.check-row .field-help { margin-top: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Дата рождения: три списка в ряд. */
.date-select { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }

input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--neutral);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-secondary);
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
}

.photo-field { display: flex; align-items: center; gap: var(--space-6); }
.photo-field .photo-preview {
  width: 120px; height: 120px; flex: none;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800;
  overflow: hidden;
}
.photo-field .photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-field .photo-controls { flex: 1; min-width: 0; }
.clearable-file { display: flex; flex-direction: column; gap: 8px; }
.clearable-file .current { font-size: 14px; color: var(--ink-secondary); }
.clearable-file .clear { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }
.input-icon input { padding-left: 46px; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }
.form-note { font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
/* Обычный виджет SmartCaptcha ("Я не робот") высотой 100px: место резервируется
   заранее, чтобы форма не сдвигалась при загрузке. Невидимой капче места не нужно. */
.smartcaptcha-widget { min-height: 100px; margin-bottom: 20px; }
.form-section + .form-section { margin-top: var(--space-8); padding-top: var(--space-8); border-top: 1px solid var(--border); }
.form-section h3 { margin-bottom: var(--space-2); }
.form-section > .muted { margin-bottom: var(--space-6); }

/* Выбор направлений "пилюлями". */
.chips-picker { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-alt); }
.chips-picker-search { padding: 12px 12px 0; }
.chips-picker-search input { min-height: 40px; padding-block: 7px; background: var(--surface); }
.chips-picker-body { max-height: 380px; overflow-y: auto; padding: 4px 16px 16px; }
.chips-group-title {
  margin: 14px 0 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-secondary);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--neutral);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip span .icon { width: 14px; height: 14px; display: none; }
.chip:hover span { border-color: var(--brand); }
.chip input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.chip input:checked + span .icon { display: inline-block; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.chips-picker-count { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--ink-secondary); background: var(--surface); border-radius: 0 0 var(--radius-md) var(--radius-md); }

/* Оценка звёздами в форме отзыва. */
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { color: var(--neutral); cursor: pointer; transition: color .1s, transform .1s; }
.stars-input label .icon { width: 40px; height: 40px; }
.stars-input label:hover, .stars-input label:hover ~ label,
.stars-input input:checked ~ label { color: var(--rating); }
.stars-input label:hover { transform: scale(1.08); }
.stars-input input:focus-visible + label { outline: 3px solid rgba(108, 99, 255, .45); border-radius: 8px; }
.stars-caption { margin-left: 12px; font-weight: 700; color: var(--ink-secondary); }

/* ---- Уведомления ----------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--ink);
}
.alert > .icon { margin-top: 2px; }
.alert p:last-child { margin-bottom: 0; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 800; margin-bottom: 2px; }
.alert-success { background: var(--success-soft); }
.alert-success > .icon { color: var(--success); }
.alert-warning { background: var(--warning-soft); }
.alert-warning > .icon { color: #C98314; }
.alert-error { background: var(--error-soft); }
.alert-error > .icon { color: var(--error); }
.alert-info { background: var(--brand-soft); }
.alert-info > .icon { color: var(--brand-strong); }
.alert-neutral > .icon { color: var(--ink-secondary); }
.alert-close {
  display: inline-flex; padding: 2px; border: 0; background: none;
  color: var(--ink-secondary); cursor: pointer; border-radius: 6px;
}
.alert-close:hover { color: var(--ink); }

.messages { display: grid; gap: 12px; margin: var(--space-6) 0 0; padding: 0; list-style: none; }

/* ---- Хлебные крошки ----------------------------------------------------------- */
.breadcrumbs { margin-bottom: var(--space-4); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 20px; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-secondary); }
.breadcrumbs li .icon { width: 14px; height: 14px; color: var(--ink-muted); }
.breadcrumbs a { color: var(--ink-secondary); }
.breadcrumbs a:hover { color: var(--brand-strong); }
.breadcrumbs li[aria-current] { color: var(--ink); font-weight: 700; }

/* ---- Пагинация ---------------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: var(--space-8); }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 700;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand-strong); text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .gap { border: 0; background: none; min-width: 20px; padding: 0; color: var(--ink-muted); }

/* ---- Пустые состояния -------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--ink-secondary);
}
.empty-art { width: 160px; height: 120px; margin-bottom: var(--space-2); }
.empty h3 { margin: 0; color: var(--ink); }
.empty p { max-width: 460px; margin: 0; }
.empty .btn { margin-top: var(--space-3); }

/* ---- Главная ------------------------------------------------------------------ */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-12) var(--space-16);
  background:
    radial-gradient(900px 420px at 88% 10%, rgba(108, 99, 255, 0.13), transparent 60%),
    radial-gradient(600px 380px at 0% 100%, rgba(253, 101, 132, 0.08), transparent 60%),
    var(--bg);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; gap: var(--space-12); }
.hero h1 { font-size: 48px; line-height: 56px; margin-bottom: var(--space-4); }
.hero-sub { font-size: 18px; line-height: 28px; color: var(--ink-secondary); margin-bottom: var(--space-8); max-width: 600px; }
.hero-search {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
}
.hero-search .input-icon { flex: 1; }
.hero-search input { border-color: transparent; min-height: 52px; }
.hero-search input:focus { box-shadow: none; border-color: transparent; }
.hero-search select { width: 230px; flex: none; border-color: transparent; background-color: var(--surface-alt); min-height: 52px; }
.hero-search .btn { min-height: 52px; padding-inline: 28px; }
.hero-popular { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: var(--space-4); font-size: 14px; }
.hero-popular > span { color: var(--ink-secondary); font-weight: 700; margin-right: 4px; }
.hero-popular .pill { background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.hero-popular .pill:hover { border-color: var(--brand); color: var(--brand-strong); }
.hero-stats { display: flex; flex-wrap: wrap; gap: var(--space-8); margin-top: var(--space-8); }
.hero-stat strong { display: block; font-size: 28px; line-height: 36px; font-weight: 800; color: var(--ink); }
.hero-stat span { font-size: 14px; color: var(--ink-secondary); }
.hero-art { position: relative; }
.hero-art svg { display: block; width: 100%; height: auto; }

.subject-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-4); }
.subject-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  text-align: center;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.subject-tile:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--brand-soft-hover); }
.subject-tile-name { font-weight: 800; line-height: 20px; }
.subject-tile-count { font-size: 13px; line-height: 18px; color: var(--ink-secondary); }

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--brand);
}
.icon-tile .subject-icon { width: 44px; height: 44px; }
.icon-tile-sm { width: 48px; height: 48px; border-radius: 14px; }
.icon-tile-sm .subject-icon { width: 34px; height: 34px; }
.subject-icon { width: 48px; height: 48px; color: var(--brand); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); counter-reset: step; }
.step { position: relative; padding: var(--space-8) var(--space-6) var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.step-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin-bottom: var(--space-4);
  border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong);
}
.step-icon .icon { width: 28px; height: 28px; }
.step::after {
  counter-increment: step;
  content: counter(step);
  position: absolute; top: 20px; right: 24px;
  font-size: 44px; line-height: 44px; font-weight: 800;
  color: var(--surface-alt);
}
.step h3 { margin-bottom: var(--space-2); }
.step p { margin: 0; color: var(--ink-secondary); }

.cta-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-12);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(253, 101, 132, 0.18), transparent 70%),
    linear-gradient(135deg, #EEEDFF 0%, #F7F7FB 100%);
  border: 1px solid var(--brand-soft-hover);
}
.cta-banner h2 { margin-bottom: var(--space-2); }
.cta-banner p { margin: 0; max-width: 680px; color: var(--ink-secondary); font-size: 18px; line-height: 28px; }

.review-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.review-card { display: flex; flex-direction: column; gap: 12px; }
.review-card .quote-icon { width: 28px; height: 28px; color: var(--brand-soft-hover); }
.review-card-text { flex: 1; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.review-card-foot { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; line-height: 20px; }

/* ---- Карточки репетиторов ---------------------------------------------------------- */
.tutor-list { display: grid; gap: var(--space-4); }
.tutor-card {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) 210px;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s, border-color .2s;
}
.tutor-card:hover { box-shadow: var(--shadow-hover); border-color: var(--brand-soft-hover); }
.tutor-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 136px; height: 160px;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 40px;
  font-weight: 800;
  overflow: hidden;
}
.tutor-photo:hover { text-decoration: none; }
.tutor-photo img { width: 100%; height: 100%; object-fit: cover; }
.tutor-card-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tutor-card-name { margin: 0; font-size: 20px; line-height: 28px; }
.tutor-card-name a { color: var(--ink); }
.tutor-card-name a:hover { color: var(--brand-strong); }
.tutor-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.tutor-meta li { display: inline-flex; align-items: center; gap: 6px; }
.tutor-meta .icon { width: 18px; height: 18px; color: var(--brand); }
.tutor-card-about { margin: 0; color: var(--ink-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tutor-card-aside { display: flex; flex-direction: column; gap: 10px; align-items: stretch; justify-content: flex-start; padding-left: var(--space-6); border-left: 1px solid var(--border); }
.price { display: flex; flex-direction: column; }
.price strong { font-size: 24px; line-height: 32px; font-weight: 800; }
.price span { font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.price-none { font-weight: 700; color: var(--ink-secondary); }

.tutor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
/* Две колонки в узкой колонке страницы (похожие репетиторы); на телефоне - одна. */
.tutor-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tutor-mini {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  transition: box-shadow .2s, transform .2s;
}
.tutor-mini:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.tutor-mini-head { display: flex; align-items: center; gap: 16px; }
.tutor-mini-head .tutor-photo { width: 72px; height: 72px; font-size: 24px; border-radius: var(--radius-md); }
.tutor-mini-name { font-weight: 800; font-size: 18px; line-height: 24px; }
.tutor-mini p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Каталог: фильтры и сортировка -------------------------------------------------- */
.catalog { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--space-8); align-items: start; }
.filters { position: sticky; top: calc(var(--header-h) + 24px); }
.filters .card { padding: var(--space-6); }
.filters h2 { font-size: 20px; line-height: 28px; margin-bottom: var(--space-4); }
.filters .field { margin-bottom: 16px; }
.filters-toggle { display: none; }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.results-count { font-weight: 700; color: var(--ink-secondary); }
.results-count strong { color: var(--ink); }
.sort-control { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.sort-control label { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink-secondary); white-space: nowrap; }
.sort-control select { min-height: 40px; padding-block: 7px; width: auto; min-width: 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.active-filters a { display: inline-flex; align-items: center; gap: 6px; }
.active-filters .icon { width: 14px; height: 14px; }
.catalog-search { margin-bottom: var(--space-4); }
.catalog-search form { display: flex; gap: 8px; }
.catalog-search .input-icon { flex: 1; }

/* ---- Страница репетитора ------------------------------------------------------------ */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-8); align-items: start; }
.profile-hero { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-6); }
.profile-hero .tutor-photo { width: 200px; height: 240px; font-size: 64px; }
.profile-hero h1 { font-size: 32px; line-height: 40px; margin-bottom: var(--space-2); }
.profile-hero .pill-list { margin: var(--space-4) 0; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: var(--space-4) 0 0; padding: 0; list-style: none; }
.facts li { display: flex; align-items: flex-start; gap: 12px; }
.facts .fact-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--surface-alt); color: var(--brand-strong); }
.facts .fact-label { display: block; font-size: 13px; line-height: 18px; color: var(--ink-secondary); }
.facts .fact-value { display: block; font-weight: 700; }
.profile-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
/* Колонка сужается до 320px: длинная подпись кнопки ("Задать вопрос репетитору")
   переносится, а не раздвигает карточку. */
.profile-aside .btn { white-space: normal; text-align: center; }
.profile-aside .price strong { font-size: 32px; line-height: 40px; }
.profile-aside .card + .card { margin-top: 0; }
.aside-note { display: flex; gap: 10px; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.aside-note .icon { color: var(--brand); margin-top: 1px; }
.page-card { max-width: 880px; margin: 0 auto; padding: 40px; }
.prose { color: var(--ink); overflow-wrap: anywhere; }
.prose p:last-child, .prose ul:last-child { margin-bottom: 0; }
.prose h2 { font-size: 24px; line-height: 32px; margin-top: var(--space-8); }
.prose h3 { margin-top: var(--space-6); }
.text-block { white-space: pre-line; overflow-wrap: anywhere; }

.rating-summary { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-8); align-items: center; margin-bottom: var(--space-6); }
.rating-big { text-align: center; }
.rating-big strong { display: block; font-size: 48px; line-height: 56px; font-weight: 800; }
.rating-big .stars { display: flex; justify-content: center; margin: 4px 0; }
.rating-big-count { display: block; font-size: 14px; color: var(--ink-secondary); }
.rating-bars { display: grid; gap: 8px; }
.rating-bar { display: grid; grid-template-columns: 70px minmax(0, 1fr) 36px; align-items: center; gap: 12px; font-size: 14px; line-height: 20px; }
.rating-bar-track { display: block; height: 8px; border-radius: var(--radius-full); background: var(--surface-alt); overflow: hidden; }
.rating-bar-fill { display: block; height: 100%; border-radius: var(--radius-full); background: var(--rating); }
.rating-bar .num { text-align: right; color: var(--ink-secondary); }

.review-list { display: grid; gap: 0; }
.review-item { padding: var(--space-6) 0; border-top: 1px solid var(--border); }
.review-item:first-child { border-top: 0; padding-top: 0; }
.review-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.review-author { font-weight: 800; }
.review-date { font-size: 14px; color: var(--ink-secondary); }
.review-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

.owner-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-6); }

/* ---- Направления: таблица ------------------------------------------------------------- */
.subjects-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.subjects-toolbar .input-icon { width: min(420px, 100%); }
.subjects-summary { display: flex; gap: var(--space-6); color: var(--ink-secondary); font-weight: 700; }
.subjects-summary strong { color: var(--ink); }
.subjects-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.subjects-table thead th {
  padding: 14px 24px;
  background: var(--surface-alt);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-secondary);
  text-align: left;
}
.subjects-table thead th.num { text-align: right; }
.subjects-table .group-row th {
  padding: 22px 24px 10px;
  text-align: left;
  font-size: 18px;
  line-height: 24px;
  font-weight: 800;
  border-top: 1px solid var(--border);
}
.subjects-table .group-row .group-count { margin-left: 8px; }
.subjects-table tbody:first-of-type .group-row th { border-top: 0; }
.subjects-table td { padding: 12px 24px; border-top: 1px solid var(--border); vertical-align: middle; }
.subjects-table .group-row + tr td { border-top: 0; }
.subject-row { position: relative; transition: background-color .15s; }
.subject-row:hover { background: #FAFAFE; }
.subject-cell { display: flex; align-items: center; gap: 16px; }
.subject-cell-text { display: flex; flex-direction: column; min-width: 0; }
.subject-name { font-weight: 800; color: var(--ink); }
.subject-count-inline { display: none; font-size: 13px; line-height: 18px; font-weight: 700; color: var(--ink-secondary); }
.subject-name::after { content: ""; position: absolute; inset: 0; }
.subject-row:hover .subject-name { color: var(--brand-strong); text-decoration: none; }
.subject-desc { color: var(--ink-secondary); font-size: 14px; line-height: 20px; }
.subject-count { text-align: right; white-space: nowrap; }
.subject-count .count { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.subject-count .count.zero { color: var(--ink-muted); font-weight: 700; }
.subject-count .icon { color: var(--brand); }

/* ---- Авторизация ------------------------------------------------------------------ */
.auth { max-width: 520px; margin: var(--space-8) auto 0; }
.auth-wide { max-width: 760px; }
.auth .card { padding: var(--space-8); }
.auth-head { text-align: center; margin-bottom: var(--space-6); }
.auth-head .role-badge { margin: 0 auto var(--space-4); }
.auth-head h1 { font-size: 30px; line-height: 38px; margin-bottom: var(--space-2); }
.auth-head p { margin: 0; color: var(--ink-secondary); }
.role-badge {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand-strong);
}
.role-badge .icon { width: 32px; height: 32px; }
.role-badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.auth-links { display: grid; gap: 8px; margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--border); text-align: center; font-size: 15px; }
.auth-switch { margin-top: var(--space-4); text-align: center; font-size: 15px; color: var(--ink-secondary); }

.role-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); max-width: 860px; margin: 0 auto; }
.role-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: var(--space-8);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  color: var(--ink);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.role-card:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--brand-soft-hover); }
.role-card h2 { margin: 8px 0 0; font-size: 24px; line-height: 32px; }
.role-card p { margin: 0; color: var(--ink-secondary); }
.role-card .more { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--brand-strong); font-weight: 800; }

/* ---- Личный кабинет -------------------------------------------------------------- */
.cabinet { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: var(--space-8); align-items: start; }
.cabinet-nav { position: sticky; top: calc(var(--header-h) + 24px); padding: var(--space-4); }
.cabinet-user { display: flex; align-items: center; gap: 12px; padding: 8px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.cabinet-user-name { font-weight: 800; line-height: 20px; overflow-wrap: anywhere; }
.cabinet-user-role { font-size: 13px; line-height: 18px; color: var(--ink-secondary); }
.cabinet-nav ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.cabinet-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--ink-secondary);
  font-weight: 700;
}
.cabinet-nav a:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.cabinet-nav a.active { background: var(--brand-soft); color: var(--brand-strong); }
.cabinet-nav a .count-badge { margin-left: auto; }
.cabinet-nav .nav-sep { height: 1px; margin: 8px 4px; background: var(--border); }
.cabinet-content { min-width: 0; }
.cabinet-content > .page-head { margin-bottom: var(--space-6); }

.status-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); align-items: center; }
.status-card h2 { font-size: 22px; line-height: 30px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-card p { margin: 0; color: var(--ink-secondary); }
.status-card .actions-row { justify-content: flex-end; }
.moderation-note { margin-top: var(--space-4); }

.progress { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 10px; border-radius: var(--radius-full); background: var(--surface-alt); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--brand), #8F88FF); }
.progress-value { font-weight: 800; min-width: 44px; text-align: right; }
.missing-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }

.visibility-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); }
.visibility-toggle h3 { margin-bottom: 4px; }
.visibility-toggle p { margin: 0; color: var(--ink-secondary); font-size: 15px; }

.list-plain { margin: 0; padding: 0; list-style: none; }
.kv { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.kv dt { color: var(--ink-secondary); }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.profile-hero .kv { grid-template-columns: 120px minmax(0, 1fr); }

.my-review { display: grid; gap: 12px; }
.my-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.my-review-tutor { display: flex; align-items: center; gap: 12px; font-weight: 800; color: var(--ink); }

/* ---- Лента с горизонтальной прокруткой ---------------------------------------------------
   Меню кабинета и вкладки занятия на узком экране не помещаются в строку. Если
   за краем ленты есть пункты, у этого края затенение и кнопка-стрелка (их
   включает main.js классами can-prev / can-next). */
.scroll-strip { position: relative; min-width: 0; }
.scroll-strip::before,
.scroll-strip::after {
  content: ""; position: absolute; top: 0; bottom: 0; z-index: 1; width: 56px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.scroll-strip::before { left: 0; background: linear-gradient(to right, var(--surface) 35%, rgba(255, 255, 255, 0)); }
.scroll-strip::after { right: 0; background: linear-gradient(to left, var(--surface) 35%, rgba(255, 255, 255, 0)); }
.scroll-strip.can-prev::before, .scroll-strip.can-next::after { opacity: 1; }
.scroll-strip-btn {
  position: absolute; top: 50%; z-index: 2;
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-top: -16px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--surface); color: var(--brand-strong);
  box-shadow: 0 2px 8px rgba(42, 40, 64, .14);
  cursor: pointer;
}
.scroll-strip-btn:hover { background: var(--brand-soft); }
.scroll-strip-prev { left: 0; }
.scroll-strip-next { right: 0; }
.scroll-strip.can-prev .scroll-strip-prev, .scroll-strip.can-next .scroll-strip-next { display: inline-flex; }
[data-scroll-body] { scrollbar-width: thin; scrollbar-color: var(--neutral) transparent; }
@supports selector(::-webkit-scrollbar) {
  [data-scroll-body] { scrollbar-width: auto; scrollbar-color: auto; }
  [data-scroll-body]::-webkit-scrollbar { height: 4px; }
  [data-scroll-body]::-webkit-scrollbar-track { background: transparent; }
  [data-scroll-body]::-webkit-scrollbar-button { display: none; }
  [data-scroll-body]::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--neutral); }
}
/* Вкладки занятия - в рамке: затенение и стрелки внутри неё. */
.lesson-tabs-strip { margin-bottom: var(--space-6); }
.lesson-tabs-strip::before, .lesson-tabs-strip::after { top: 1px; bottom: 1px; }
.lesson-tabs-strip::before { left: 1px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.lesson-tabs-strip::after { right: 1px; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.lesson-tabs-strip .scroll-strip-prev { left: 6px; }
.lesson-tabs-strip .scroll-strip-next { right: 6px; }

/* ---- Модерация ------------------------------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-6); padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-md);
  color: var(--ink-secondary); font-weight: 700;
}
.tabs a:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.tabs a.active { background: var(--brand-soft); color: var(--brand-strong); }
.mod-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: var(--space-4); }
.mod-toolbar form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.mod-toolbar input[type="search"] { max-width: 340px; min-height: 40px; padding-block: 7px; }
.mod-toolbar select { width: auto; min-height: 40px; padding-block: 7px; }
.mod-table { width: 100%; border-collapse: collapse; }
.mod-table th { padding: 10px 12px; font-size: 12px; line-height: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-secondary); text-align: left; border-bottom: 1px solid var(--border); }
.mod-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.mod-table tr:last-child td { border-bottom: 0; }
.mod-person { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.mod-person .tutor-photo { width: 48px; height: 48px; font-size: 16px; border-radius: 12px; }
.mod-person-name { font-weight: 800; color: var(--ink); }
/* Длинный email и узкое окно: столбцы таблицы сужаются, кнопки действий
   встают друг под друга, а не выходят за край карточки. */
.mod-person > div { min-width: 0; overflow-wrap: anywhere; }
.mod-actions .btn { white-space: nowrap; }
.mod-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--border); }
.mod-review { display: grid; gap: 12px; }
.mod-review + .mod-review { margin-top: var(--space-4); }
.mod-review-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mod-review-form input[type="text"] { flex: 1; min-width: 220px; min-height: 40px; padding-block: 7px; }
.mod-decision { display: grid; gap: var(--space-4); }
.decision-options { display: grid; gap: 8px; }
.decision-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; font-weight: 700; }
.decision-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* Жалобы в кабинете администратора: текст сообщения в списке и переписка вокруг него. */
.complaint-cell { min-width: 240px; }
.complaint-actions { display: grid; gap: 6px; }
.complaint-actions .btn { width: 100%; }
.complaint-excerpt { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--ink-secondary); white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.complaint-thread { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.complaint-msg { padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-alt); }
.complaint-msg.reported { background: var(--error-soft); box-shadow: inset 3px 0 0 var(--error); }
.complaint-msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; }

/* ---- Чат ---------------------------------------------------------------------- */
.chat {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - var(--header-h) - 150px);
  min-height: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.chat-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.chat-list-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 18px; }
.chat-list-body { flex: 1; overflow-y: auto; }
.conversation {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.conversation:hover { background: #FAFAFE; text-decoration: none; }
.conversation.active { background: var(--brand-soft); }
.conversation-body { flex: 1; min-width: 0; }
.conversation-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.conversation-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-time { flex: none; font-size: 12px; color: var(--ink-muted); }
.conversation-last { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.conversation-last .last-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.conversation.unread .conversation-last { color: var(--ink); font-weight: 700; }

.chat-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.thread-head-body { flex: 1; min-width: 0; }
.thread-head-name { font-weight: 800; color: var(--ink); }
.thread-head-sub { font-size: 13px; line-height: 18px; color: var(--ink-secondary); }
.thread-back { display: none; }
.thread-messages { flex: 1; overflow-y: auto; overflow-anchor: none; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(180deg, #FBFBFE 0%, var(--surface) 100%); }
.thread-empty { margin: auto; text-align: center; color: var(--ink-secondary); max-width: 360px; }
.date-divider { align-self: center; margin: 14px 0 8px; padding: 2px 12px; border-radius: var(--radius-full); background: var(--surface-alt); color: var(--ink-secondary); font-size: 12px; line-height: 20px; font-weight: 700; }
.bubble {
  position: relative;
  max-width: min(560px, 78%);
  padding: 10px 14px 6px;
  border-radius: 18px 18px 18px 6px;
  background: var(--surface-alt);
  color: var(--ink);
  align-self: flex-start;
  overflow-wrap: anywhere;
}
/* Кнопки у сообщения: "Ответить" и (у сообщения собеседника) "Пожаловаться".
   Справа от сообщения собеседника и слева от своего, появляются при наведении.
   Зазор до сообщения - часть блока кнопок, поэтому по пути к ним они не гаснут. */
.bubble-actions {
  position: absolute;
  top: 50%;
  left: 100%;
  display: flex;
  align-items: center;
  padding-left: 4px;
  transform: translateY(-50%);
}
.bubble.mine .bubble-actions { left: auto; right: 100%; padding: 0 4px 0 0; }
.bubble-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.bubble-action .icon { width: 16px; height: 16px; }
.bubble:hover .bubble-action, .bubble-action:focus-visible { opacity: 1; }
.bubble-action:hover { color: var(--brand-strong); text-decoration: none; }
a.bubble-report:hover { color: var(--error-ink); }
.bubble-report.reported { opacity: 1; color: var(--error); cursor: default; }
/* "Ответить" работает только с JavaScript - кнопку показывает main.js. */
.bubble-reply { display: none; }
.chat-js .bubble-reply { display: inline-flex; }
/* На сенсорных экранах наведения нет - кнопки видны всегда, но приглушённо. */
@media (hover: none) {
  .bubble-action { opacity: .6; }
}
/* Цитата сообщения, на которое ответили. */
.bubble-quote {
  display: block;
  margin: 0 0 6px;
  padding: 4px 10px;
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: rgba(108, 99, 255, .08);
  color: inherit;
  font-size: 13px;
  line-height: 18px;
}
.bubble-quote:hover { background: rgba(108, 99, 255, .14); text-decoration: none; }
.bubble.mine .bubble-quote { border-left-color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .14); }
.bubble.mine .bubble-quote:hover { background: rgba(255, 255, 255, .22); }
.bubble-quote-author { display: block; font-weight: 800; color: var(--brand-strong); }
.bubble.mine .bubble-quote-author { color: #fff; }
.bubble-quote-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
/* Подсветка сообщения, к которому перешли по цитате. */
.bubble.flash { animation: bubble-flash 1.6s ease-out; }
@keyframes bubble-flash {
  0%, 30% { box-shadow: 0 0 0 4px rgba(108, 99, 255, .35); }
  100% { box-shadow: 0 0 0 4px rgba(108, 99, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .bubble.flash { animation: none; box-shadow: 0 0 0 3px rgba(108, 99, 255, .35); }
}
.thread-more { align-self: center; flex: none; }
.thread-more.loading { pointer-events: none; opacity: .6; }
.bubble.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--brand-strong); color: #fff; }
.bubble-text { white-space: pre-line; }
.bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; line-height: 16px; opacity: .75; }
.bubble-meta .icon { width: 16px; height: 16px; }
.bubble.mine .bubble-meta .read { color: #fff; }
.bubble.pending { opacity: .6; }
.composer { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.composer textarea { flex: 1 1 0; min-width: 0; min-height: 48px; max-height: 180px; resize: none; padding-block: 11px; }
.composer .btn { flex: none; }
/* Подписи кнопок видны только на телефоне, где кнопки - под полем ввода. */
.composer-btn-label { display: none; }
.composer-emoji { color: var(--ink-secondary); }
.composer-emoji[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-strong); }
/* Ответ на сообщение - над полем ввода. */
.composer-reply { display: flex; align-items: center; gap: 10px; flex: 1 0 100%; min-width: 0; margin-top: -4px; }
.composer-reply-icon { display: inline-flex; flex: none; color: var(--brand-strong); }
.composer-reply-body { flex: 1; min-width: 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--brand); font-size: 13px; line-height: 18px; }
.composer-reply-author { font-weight: 800; color: var(--brand-strong); }
.composer-reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-secondary); }
.composer .composer-reply-cancel { width: 36px; min-height: 36px; color: var(--ink-secondary); }
/* Панель смайликов - над полем ввода. */
.emoji-panel {
  position: absolute;
  left: 20px;
  bottom: calc(100% - 6px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 40px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(42, 40, 64, .16);
  overflow: hidden;
}
.emoji-tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.emoji-tab { flex: none; padding: 6px 8px 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-secondary); font: inherit; font-size: 13px; line-height: 18px; font-weight: 700; cursor: pointer; }
.emoji-tab:hover { color: var(--ink); }
.emoji-tab[aria-selected="true"] { color: var(--brand-strong); border-bottom-color: var(--brand-strong); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; height: 216px; padding: 8px; overflow-y: auto; align-content: start; }
.emoji-btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 22px; line-height: 1; cursor: pointer; }
.emoji-btn:hover, .emoji-btn:focus-visible { background: var(--surface-alt); }
.emoji-empty { grid-column: 1 / -1; margin: auto; padding: 24px 8px; color: var(--ink-muted); font-size: 13px; text-align: center; }
.composer-note { padding: 0 20px 10px; font-size: 12px; color: var(--ink-muted); background: var(--surface); }
/* Тонкая полоса прокрутки в переписке, списке диалогов, панели смайликов и
   списке уведомлений под значком в шапке.
   Chrome, Edge и Safari - через ::-webkit-scrollbar (рисуем сами), Firefox -
   через scrollbar-width. */
.thread-messages, .chat-list-body, .composer textarea, .emoji-grid, .notify-list { scrollbar-width: thin; scrollbar-color: var(--neutral) transparent; }
@supports selector(::-webkit-scrollbar) {
  .thread-messages, .chat-list-body, .composer textarea, .emoji-grid, .notify-list { scrollbar-width: auto; scrollbar-color: auto; }
  .thread-messages::-webkit-scrollbar,
  .chat-list-body::-webkit-scrollbar,
  .composer textarea::-webkit-scrollbar,
  .emoji-grid::-webkit-scrollbar,
  .notify-list::-webkit-scrollbar { width: 8px; height: 8px; }
  .thread-messages::-webkit-scrollbar-track,
  .chat-list-body::-webkit-scrollbar-track,
  .composer textarea::-webkit-scrollbar-track,
  .emoji-grid::-webkit-scrollbar-track,
  .notify-list::-webkit-scrollbar-track { background: transparent; }
  .thread-messages::-webkit-scrollbar-button,
  .chat-list-body::-webkit-scrollbar-button,
  .composer textarea::-webkit-scrollbar-button,
  .emoji-grid::-webkit-scrollbar-button,
  .notify-list::-webkit-scrollbar-button { display: none; }
  .thread-messages::-webkit-scrollbar-thumb,
  .chat-list-body::-webkit-scrollbar-thumb,
  .composer textarea::-webkit-scrollbar-thumb,
  .emoji-grid::-webkit-scrollbar-thumb,
  .notify-list::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: var(--neutral) padding-box; }
  .thread-messages::-webkit-scrollbar-thumb:hover,
  .chat-list-body::-webkit-scrollbar-thumb:hover,
  .composer textarea::-webkit-scrollbar-thumb:hover,
  .emoji-grid::-webkit-scrollbar-thumb:hover,
  .notify-list::-webkit-scrollbar-thumb:hover { background-color: var(--ink-muted); }
}
.chat-placeholder { margin: auto; display: grid; justify-items: center; gap: 12px; padding: 32px; text-align: center; color: var(--ink-secondary); }

/* ---- Окно (dialog) и жалоба на сообщение ------------------------------------------------ */
.modal {
  width: min(520px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(42, 40, 64, 0.24);
  overflow-y: auto;
}
.modal::backdrop { background: rgba(42, 40, 64, 0.45); }
.modal-body { padding: var(--space-6); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.modal-head h2 { margin: 0; font-size: 22px; line-height: 30px; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin: -3px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-secondary);
  cursor: pointer;
}
.modal-close:hover { background: var(--surface-alt); color: var(--ink); }
.modal .form-actions { margin-top: var(--space-4); }

/* ---- Переход на сторонний сайт: страница /away/ и окно ------------------------ */
.away-card { max-width: 560px; margin: var(--space-12) auto; text-align: center; }
.away-card h1 { font-size: 28px; line-height: 36px; margin-bottom: var(--space-3); }
.away-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: var(--space-4); border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong); }
.away-icon .icon { width: 28px; height: 28px; }
.away-url { margin: 0 0 var(--space-4); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; text-align: left; }
.away-note { margin-bottom: var(--space-4); color: var(--ink-secondary); font-size: 14px; line-height: 20px; }
.away-card .away-note { margin-bottom: 0; }
.away-actions { justify-content: center; margin-top: var(--space-6); }
/* Ссылка в сообщении переписки. */
.bubble-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.bubble-text a:hover { text-decoration-thickness: 2px; }

.report-quote {
  margin: 0 0 var(--space-4);
  padding: 10px 14px;
  border-left: 3px solid var(--neutral);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-alt);
  color: var(--ink-secondary);
}
/* Строки обрезает внутренний абзац: у блока с отступами обрезанная строка
   проглядывала бы в нижнем отступе. */
.report-quote-text {
  display: -webkit-box;
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-quote-full .report-quote-text { display: block; }
.report-author { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-3); }
.report-author-name { font-weight: 800; }
.report-reasons { min-width: 0; margin-inline: 0; padding: 0; border: 0; }
.report-reasons legend { padding: 0; }
.report-reasons .decision-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-error { margin: 0; color: var(--error-ink); font-size: 14px; line-height: 20px; font-weight: 700; }
.report-done { display: grid; justify-items: center; gap: var(--space-3); padding-block: var(--space-8); text-align: center; }
.report-done p { max-width: 380px; margin: 0 0 var(--space-2); font-weight: 700; }
.report-done-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 18px; background: var(--success-soft); color: var(--success); }
.report-done-icon .icon { width: 28px; height: 28px; }

/* ---- Заявки учеников ------------------------------------------------------------- */
.page-head-split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-8); }
.page-head-split > div:first-child { flex: 1 1 480px; min-width: 0; }
.order-cta-mini { display: flex; align-items: center; gap: 16px; max-width: 460px; padding: 14px 16px; border: 1px solid var(--brand-soft-hover); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-card); }
.order-cta-mini-text { font-size: 14px; line-height: 20px; color: var(--ink-secondary); font-weight: 700; }
.order-cta-mini .btn { flex: none; }

.range-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.range-sep { color: var(--ink-muted); font-weight: 700; }

.order-list { display: grid; gap: var(--space-4); }
.order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s, border-color .2s;
}
.order-card:hover { box-shadow: var(--shadow-hover); border-color: var(--brand-soft-hover); }
.order-card-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.order-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.order-card-date { font-size: 13px; line-height: 18px; color: var(--ink-muted); font-weight: 600; }
.order-card-title { margin: 0; font-size: 20px; line-height: 28px; overflow-wrap: anywhere; }
.order-card-title a { color: var(--ink); }
.order-card-title a:hover { color: var(--brand-strong); }
.order-card-text { margin: 0; color: var(--ink-secondary); white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.order-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.order-meta li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.order-meta .icon { width: 18px; height: 18px; color: var(--brand); }
.order-meta-proposals { font-weight: 700; }
.order-card-aside { display: flex; flex-direction: column; gap: 10px; padding-left: var(--space-6); border-left: 1px solid var(--border); }
.order-card-aside .badge { align-self: flex-start; }
.order-card-aside .price strong { font-size: 22px; line-height: 30px; }

.order-head h1 { font-size: 32px; line-height: 40px; margin: var(--space-3) 0 var(--space-2); overflow-wrap: anywhere; }
.order-student { display: flex; align-items: center; gap: 12px; }
.order-student-name { font-weight: 800; }

.respond-title { font-size: 28px; line-height: 36px; }
.order-summary { display: grid; gap: 10px; padding: var(--space-4) var(--space-6); border-radius: var(--radius-md); background: var(--surface-alt); }
.order-summary-title { font-size: 18px; line-height: 26px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.order-summary .price strong { font-size: 20px; line-height: 28px; }
.proposal-view { padding-top: var(--space-6); border-top: 1px solid var(--border); }

.tips-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.tips-list li { display: flex; gap: 10px; }
.tips-list .icon { color: var(--success); margin-top: 2px; }

.my-order { display: grid; gap: 12px; }
.my-order-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.my-order-title { font-size: 18px; line-height: 26px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
a.my-order-title:hover { color: var(--brand-strong); }
.my-order-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.my-order-proposals { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-secondary); }
.my-order-proposals > .icon { color: var(--brand); }

.how-steps { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.how-steps li { display: flex; gap: 16px; align-items: flex-start; }
.how-steps strong { display: block; color: var(--ink); }
.how-steps span:last-child { color: var(--ink-secondary); }
.how-step-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); }

.proposal-list { display: grid; gap: var(--space-4); }
.proposal { display: grid; gap: 12px; padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.proposal-chosen { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.proposal-declined { opacity: .6; }
.proposal-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.proposal-head .tutor-photo { width: 64px; height: 64px; font-size: 22px; border-radius: var(--radius-md); }
.proposal-tutor { display: grid; gap: 6px; min-width: 0; }
.proposal-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.proposal-name { font-size: 18px; line-height: 24px; font-weight: 800; color: var(--ink); }
a.proposal-name:hover { color: var(--brand-strong); }
.proposal-price { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.proposal-price strong { font-size: 22px; line-height: 30px; font-weight: 800; }
.proposal-price span { font-size: 14px; color: var(--ink-secondary); }
.proposal-message { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.proposal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.order-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); align-items: start; }
.order-form-layout > .card { margin-top: 0; }
.order-form-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: var(--space-4); }
.order-form-aside .card + .card { margin-top: 0; }
.order-form-aside h3 { font-size: 18px; line-height: 26px; }

.decision-danger:has(input:checked) { border-color: var(--error); background: var(--error-soft); }

.home-orders { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-8); padding: var(--space-8) var(--space-12); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.home-orders h2 { margin-bottom: var(--space-2); }
.home-orders p { margin: 0; max-width: 720px; color: var(--ink-secondary); font-size: 18px; line-height: 28px; }
.home-orders-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin-bottom: var(--space-4); border-radius: 20px; background: var(--accent-soft); color: var(--accent-strong); }
.home-orders-icon .icon { width: 32px; height: 32px; }
.catalog-order-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: var(--space-6); padding: var(--space-6); border: 1px dashed var(--brand-soft-hover); border-radius: var(--radius-lg); background: var(--surface); }
.catalog-order-cta p { margin: 0; color: var(--ink-secondary); }
.catalog-order-cta strong { display: block; color: var(--ink); font-size: 18px; line-height: 26px; }

/* ---- Услуги репетиторов --------------------------------------------------------------- */
.service-tutor { display: flex; align-items: center; gap: 12px; min-width: 0; }
.service-tutor .tutor-photo { width: 44px; height: 44px; flex: none; font-size: 16px; border-radius: 12px; }
.service-tutor-text { display: grid; gap: 2px; min-width: 0; }
.service-tutor-name { font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.service-tutor-name:hover { color: var(--brand-strong); }
.service-tutor .rating-line { gap: 6px 10px; }
.service-about { color: var(--ink-secondary); white-space: pre-line; overflow-wrap: anywhere; }
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.service-mini { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.service-mini-title { margin: 0; font-size: 18px; line-height: 26px; overflow-wrap: anywhere; }
.service-mini-title a { color: var(--ink); }
.service-mini-title a:hover { color: var(--brand-strong); }
.service-mini-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.service-mini-foot .price strong { font-size: 20px; line-height: 28px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; }
.service-order { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
h2 + .service-order { border-top: 0; padding-top: 0; }
.service-order-body { display: grid; min-width: 0; }
.service-order-name { font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.service-order-name:hover { color: var(--brand-strong); }

/* ---- Занятия ------------------------------------------------------------------------ */
.lesson-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4) var(--space-6); align-items: center; }
.lesson-card + .lesson-card { margin-top: var(--space-4); }
.lesson-card .tutor-photo { width: 56px; height: 56px; font-size: 20px; border-radius: var(--radius-md); }
.lesson-card-body { display: grid; gap: 8px; min-width: 0; }

.lesson-head { display: grid; gap: var(--space-3); margin-bottom: var(--space-6); justify-items: start; }
.lesson-head-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.lesson-head-main .tutor-photo { width: 64px; height: 64px; font-size: 22px; border-radius: var(--radius-md); flex: none; }
.lesson-head-text { min-width: 0; }
.lesson-head h1 { font-size: 28px; line-height: 36px; margin: 0 0 4px; overflow-wrap: anywhere; }
.lesson-head-meta { gap: 8px 12px; }
.lesson-tabs { overflow-x: auto; flex-wrap: nowrap; margin-bottom: 0; }
.lesson-tabs a { white-space: nowrap; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-6); align-items: start; }
.lesson-main { min-width: 0; }
.lesson-main > .card + .card { margin-top: var(--space-6); }
.lesson-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
/* Колонка узкая: длинная подпись ("Оставить отзыв о репетиторе") переносится,
   а не раздвигает карточки за край страницы. */
.lesson-aside .btn { white-space: normal; text-align: center; }
.lesson-aside .card + .card { margin-top: 0; }
.lesson-aside .card { padding: var(--space-4) var(--space-6) var(--space-6); }
.lesson-aside h3 { font-size: 16px; line-height: 24px; margin-bottom: var(--space-3); }
.next-meeting { display: flex; align-items: center; gap: 12px; }
.next-meeting-date { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 56px; flex: none; border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); font-size: 12px; line-height: 14px; font-weight: 700; text-transform: lowercase; }
.next-meeting-date strong { font-size: 22px; line-height: 24px; font-weight: 800; }
.next-meeting-time { font-weight: 800; }
.lesson-facts { display: grid; gap: 2px; margin: 0; font-size: 14px; line-height: 20px; }
.lesson-facts dt { color: var(--ink-secondary); margin-top: 8px; }
.lesson-facts dt:first-child { margin-top: 0; }
.lesson-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.chat.chat-single { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--header-h) - 280px); min-height: 480px; }

.meeting { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding: var(--space-4) 0; border-top: 1px solid var(--border); }
.card-title + .meeting, h2 + .meeting { border-top: 0; padding-top: 0; }
.meeting-cancelled { opacity: .65; }
.meeting-date { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 64px; border-radius: 16px; background: var(--surface-alt); color: var(--ink); font-size: 13px; line-height: 16px; font-weight: 700; text-transform: lowercase; }
.meeting-date strong { font-size: 24px; line-height: 28px; font-weight: 800; }
.meeting-body { display: grid; gap: 6px; min-width: 0; }
.meeting-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.meeting-time { font-weight: 800; }
/* Длинная отметка ("Прошёл - отметьте, состоялся ли урок") переносится. */
.meeting-top .badge { white-space: normal; }
.meeting-place { overflow-wrap: anywhere; }
.meeting-topic { margin: 0; }
.meeting-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.meeting-cancel summary { list-style: none; }
.meeting-cancel summary::-webkit-details-marker { display: none; }
.meeting-cancel-toggle { color: var(--error-ink); }
.btn-ghost.meeting-cancel-toggle:hover { background: var(--error-soft); }
.meeting-cancel:not([open]) .meeting-cancel-form { display: none; }
.meeting-cancel[open] { flex-basis: 100%; }
.meeting-cancel[open] .meeting-cancel-toggle { display: none; }
.meeting-cancel-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meeting-cancel-form input[type="text"] { width: 280px; min-height: 36px; padding-block: 5px; font-size: 14px; }

.assignment-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 4px; border-top: 1px solid var(--border); color: var(--ink); }
h2 + .assignment-row { border-top: 0; }
.assignment-row:hover { text-decoration: none; background: #FAFAFE; }
.assignment-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-alt); color: var(--brand-strong); }
.assignment-body { display: grid; min-width: 0; }
.assignment-title { font-weight: 800; overflow-wrap: anywhere; }

.material { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--border); }
h2 + .material { border-top: 0; padding-top: 0; }
.material-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.material-ext { font-size: 11px; line-height: 14px; font-weight: 800; letter-spacing: .02em; }
.material-body { min-width: 0; }
.material-title { font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.material-title:hover { color: var(--brand-strong); }
.material-url { overflow-wrap: anywhere; }
.schedule-note, .materials-note { margin: var(--space-4) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* Файлы ответа на домашнее задание. */
.file-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.text-block + .file-list { margin-top: var(--space-4); }
.file-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 12px 8px 8px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.file-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-strong); }
.file-body { display: grid; min-width: 0; }
.file-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.file-name:hover { color: var(--brand-strong); }
.file-remove { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--ink-secondary); cursor: pointer; }
.file-remove:has(input:checked) { color: var(--error-ink); }
.file-item:has(.file-remove input:checked) .file-name { text-decoration: line-through; color: var(--ink-secondary); }
.answer-files { min-width: 0; margin-inline: 0; padding: 0; border: 0; }
.answer-files legend { padding: 0; }

.error-icon { width: 96px; height: 96px; color: var(--brand-soft-hover); }

/* ---- Контакты и предложения по сайту ------------------------------------------------------ */
.contacts-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-6); align-items: start; }
.contacts-layout-single { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
.contacts-layout > .card { margin-top: 0; }
.contacts-form { padding: var(--space-8); }
/* Иконка слева от заголовка и описания; на телефоне описание - во всю ширину под ними. */
.contacts-form-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px var(--space-4); margin-bottom: var(--space-6); }
.contacts-form-head h2 { margin: 0; font-size: 24px; line-height: 32px; }
.contacts-form-head p { margin: 0; color: var(--ink-secondary); }
.contacts-form-icon {
  display: inline-flex; align-items: center; justify-content: center;
  grid-row: span 2; align-self: start;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent-strong);
}
.contacts-form-icon .icon { width: 30px; height: 30px; }
.contacts-topics { min-width: 0; margin-inline: 0; padding: 0; border: 0; }
.contacts-topics legend { padding: 0; }
.contacts-topics.has-error .chip input:not(:checked) + span { border-color: var(--error); }
.contacts-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: var(--space-4); }
.contacts-aside > .card { margin-top: 0; }
.contacts-aside-title { margin-bottom: var(--space-4); font-size: 18px; line-height: 26px; }
.contact-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.contact-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--brand-soft); color: var(--brand-strong);
}
.contact-text { display: grid; min-width: 0; }
.contact-label { font-size: 13px; line-height: 18px; color: var(--ink-secondary); }
.contact-text a { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.contact-text a:hover { color: var(--brand-strong); }

/* ---- Премиум и отклики ------------------------------------------------------------------- */
/* Карточка анкеты с премиумом: золотая рамка (на 1px толще - отступ меньше на 1px,
   чтобы содержимое не сдвигалось относительно соседних карточек). */
.tutor-card-premium { border: 2px solid var(--gold); padding: calc(var(--space-6) - 1px); }
.tutor-card-premium:hover { border-color: var(--gold); box-shadow: 0 8px 24px rgba(226, 179, 60, 0.24); }
.tutor-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.badge-premium { background: var(--gold-soft); color: var(--gold-ink); }
.badge-premium .icon { color: var(--gold-strong); }
a.badge-premium:hover { background: #FFEDB8; text-decoration: none; }
.catalog-note { display: flex; align-items: flex-start; gap: 8px; margin: var(--space-4) 0 0; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.catalog-note .icon { margin-top: 2px; color: var(--gold-strong); }

/* Демо-анкеты (пока нет опубликованных репетиторов): метка на фото, бейдж, пояснения. */
.tutor-photo { position: relative; }
.demo-mark {
  position: absolute;
  left: 6px; bottom: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(42, 40, 64, .78);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  pointer-events: none;
}
.profile-hero .demo-mark { left: 10px; bottom: 10px; padding: 3px 10px; font-size: 13px; line-height: 18px; }
.badge-demo { background: var(--surface); color: var(--ink-secondary); box-shadow: inset 0 0 0 1px var(--neutral); }
.badge-demo .icon { color: var(--brand); }
.tutor-mini-head .badge-demo { margin-top: 2px; }
.tutor-card-demo { border-style: dashed; border-color: var(--neutral); }
.demo-note { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); text-align: center; }
.catalog-note-demo .icon { color: var(--brand); }

/* Остаток откликов: раздел заявок, отклик, "Мои отклики". */
.allowance { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.allowance-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.allowance-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.allowance-body strong { color: var(--ink); }
.allowance-body span { font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.allowance > .btn { flex: none; }
.allowance-premium { border-color: var(--gold); background: #FFFCF3; }
.allowance-premium .allowance-icon { background: var(--gold-soft); color: var(--gold-strong); }
.allowance-empty { border-color: #F3D9A8; background: var(--warning-soft); }
.allowance-empty .allowance-icon { background: #FCE5BC; color: var(--warning-ink); }

/* Страница "Премиум для репетиторов". */
.premium-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--space-8);
  align-items: center;
  margin-bottom: var(--space-8);
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--brand-soft-hover);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(226, 179, 60, 0.18), transparent 70%),
    linear-gradient(135deg, #EEEDFF 0%, #F7F7FB 100%);
}
.premium-hero h1 { margin-bottom: var(--space-3); }
.premium-hero .lead { margin-bottom: var(--space-6); }
.premium-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--space-3); padding: 4px 12px; border-radius: var(--radius-full); background: var(--gold-soft); color: var(--gold-ink); font-size: 14px; line-height: 20px; font-weight: 800; }
.premium-kicker .icon { width: 18px; height: 18px; color: var(--gold-strong); }
.premium-active { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-4); font-weight: 700; color: var(--success-ink); }
.premium-active .icon { color: var(--success); }
.premium-art { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.premium-benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); margin-bottom: var(--space-12); }
.benefit { padding: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.benefit h2 { margin: var(--space-4) 0 var(--space-2); font-size: 20px; line-height: 28px; }
.benefit p { margin: 0; color: var(--ink-secondary); }
.benefit-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong); }
.benefit-icon .icon { width: 26px; height: 26px; }
.benefit-icon-gold { background: var(--gold-soft); color: var(--gold-strong); }
/* Тарифы: группы "Премиум" и "Пакеты откликов" рядом, в каждой - карточки по две в ряд. */
.tariffs-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); align-items: start; margin-bottom: var(--space-12); }
.tariff-group h2 { margin-bottom: var(--space-2); }
.tariff-group-note { margin: 0 0 var(--space-6); color: var(--ink-secondary); }
.tariff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.tariff { position: relative; display: flex; flex-direction: column; gap: 12px; padding: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.tariff-featured { border: 2px solid var(--brand); padding: calc(var(--space-6) - 1px); box-shadow: var(--shadow-hover); }
.tariff-flag { position: absolute; top: -12px; right: 20px; padding: 2px 10px; border-radius: var(--radius-full); background: var(--brand-strong); color: #fff; font-size: 12px; line-height: 20px; font-weight: 800; }
.tariff-head { display: flex; align-items: center; gap: 12px; }
.tariff-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--gold-soft); color: var(--gold-strong); }
.tariff-icon-pack { background: var(--brand-soft); color: var(--brand-strong); }
.tariff-title { margin: 0; font-size: 18px; line-height: 26px; }
.tariff-price strong { display: block; font-size: 32px; line-height: 40px; font-weight: 800; }
.tariff-price span { font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.tariff-text { flex: 1; margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-secondary); }
.tariff-action { margin-top: auto; }
.premium-faq { max-width: 880px; margin-bottom: var(--space-8); }
.premium-faq details { border-bottom: 1px solid var(--border); }
.premium-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; font-weight: 800; cursor: pointer; list-style: none; }
.premium-faq summary::-webkit-details-marker { display: none; }
.premium-faq summary::after { content: ""; flex: none; width: 10px; height: 10px; margin-right: 6px; border-right: 2px solid var(--ink-secondary); border-bottom: 2px solid var(--ink-secondary); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.premium-faq details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.premium-faq details p { margin: 0 0 16px; color: var(--ink-secondary); }
.legal-line { margin: var(--space-6) 0 0; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }

/* Кабинет репетитора: премиум, автопродление, отклики, платежи. */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--space-3); font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink-secondary); }
.back-link:hover { color: var(--brand-strong); }
.premium-status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4) var(--space-6); align-items: center; }
.premium-status h2 { margin-bottom: 6px; font-size: 22px; line-height: 30px; }
.premium-status-body > p { margin: 0; color: var(--ink-secondary); }
.premium-status-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--surface-alt); color: var(--ink-muted); }
.premium-status-active { border: 2px solid var(--gold); padding: calc(var(--space-6) - 1px); background: linear-gradient(135deg, #FFFCF3 0%, var(--surface) 60%); }
.premium-status-active .premium-status-icon { background: var(--gold-soft); color: var(--gold-strong); }
.autorenew-card { display: grid; gap: var(--space-4); }
.autorenew-head { display: flex; align-items: flex-start; gap: 14px; }
.autorenew-head h3 { margin-bottom: 4px; }
.autorenew-head p { margin: 0; color: var(--ink-secondary); }
.autorenew-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.autorenew-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.quota { display: grid; gap: 6px; align-content: start; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-alt); }
.quota-label { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ink-secondary); }
.quota-value { font-size: 28px; line-height: 36px; font-weight: 800; }
.quota-value small { font-size: 16px; font-weight: 700; color: var(--ink-secondary); }
.quota-note { font-size: 13px; line-height: 18px; color: var(--ink-secondary); }
.quota .progress-track { flex: none; height: 8px; background: #E1DFF0; }
.cabinet-subtitle { margin: 0 0 var(--space-2); font-size: 22px; line-height: 30px; }
/* В кабинете колонка уже - группы тарифов одна под другой. */
.tariffs-section-cabinet { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); margin: var(--space-8) 0; }
.tariffs-section-cabinet .tariff-group-note { margin-bottom: var(--space-4); font-size: 15px; line-height: 22px; }
.table-scroll { overflow-x: auto; }
.payments-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 22px; }
.payments-table th { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; line-height: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-secondary); }
.payments-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.payments-table tr:last-child td { border-bottom: 0; }
.payments-table .num { text-align: right; }

/* Оформление оплаты. */
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-6); align-items: start; }
.checkout-layout > .card { margin-top: 0; }
.checkout-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: var(--space-4); }
.checkout-aside .card + .card { margin-top: 0; }
.checkout-summary { display: grid; gap: var(--space-4); }
.checkout-summary-head { display: flex; align-items: center; gap: 12px; }
.checkout-summary-title { font-weight: 800; }
.checkout-summary-price { font-size: 26px; line-height: 34px; font-weight: 800; }
.checkout-points { display: grid; gap: var(--space-4); margin: 0 0 var(--space-6); padding: 0 0 var(--space-6); border-bottom: 1px solid var(--border); list-style: none; }
.checkout-points li { display: flex; align-items: flex-start; gap: 14px; }
.checkout-points p { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--ink-secondary); }
.checkout-point-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.consent-box { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.consent-box .check-row { margin-bottom: 6px; }
.consent-box .field-help { margin-left: 34px; }

/* Итог оплаты, переход к платёжной системе, тестовая оплата. */
.payment-result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.payment-result h2 { margin-bottom: 6px; font-size: 24px; line-height: 32px; }
.payment-result-body > p { margin: 0 0 8px; color: var(--ink-secondary); }
.payment-result-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface-alt); color: var(--ink-secondary); }
.payment-result-succeeded .payment-result-icon { background: var(--success-soft); color: var(--success); }
.payment-result-pending .payment-result-icon { background: var(--warning-soft); color: #C98314; }
.payment-result-canceled .payment-result-icon { background: var(--error-soft); color: var(--error); }
.redirect-card { text-align: center; }
.redirect-card .role-badge { margin: 0 auto var(--space-4); }
.redirect-card h1 { font-size: 28px; line-height: 36px; margin-bottom: var(--space-2); }
.test-pay-head { display: flex; align-items: center; gap: 16px; margin-bottom: var(--space-4); }
.test-pay-head h1 { margin: 6px 0 0; font-size: 26px; line-height: 34px; }
.test-pay .kv { margin-bottom: var(--space-2); }

/* Согласия в форме регистрации. */
.consents { margin: 4px 0 var(--space-6); }
.consents .field { margin-bottom: 10px; }
.consents .check-row { margin-bottom: 0; font-size: 15px; line-height: 22px; }

/* ---- Подвал ---------------------------------------------------------------------- */
.site-footer { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: var(--space-8); padding-block: var(--space-12) var(--space-8); }
.footer-brand { min-width: 0; }
.footer-brand .brand { max-width: 100%; }
.footer-brand p { margin-top: var(--space-4); color: var(--ink-secondary); max-width: 360px; }
.footer-col h3 { font-size: 14px; line-height: 20px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: var(--space-4); }
.footer-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.footer-col a { color: var(--ink); font-weight: 600; }
.footer-col a:hover { color: var(--brand-strong); }
.footer-contact { display: flex; align-items: center; gap: 10px; }
.footer-contact .icon { color: var(--brand); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: var(--space-6); border-top: 1px solid var(--border); font-size: 14px; color: var(--ink-secondary); }
.footer-legal { flex-basis: 100%; margin: 0; overflow-wrap: anywhere; }

/* ---- Страница ошибки ---------------------------------------------------------------- */
.error-page { max-width: 640px; margin: var(--space-12) auto; text-align: center; }
.error-code { font-size: 96px; line-height: 1; font-weight: 800; color: var(--brand-soft-hover); margin-bottom: var(--space-4); }

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (max-width: 1200px) {
  /* Шапка плотнее: меню из пяти пунктов и кнопки справа помещаются в одну строку
     до самого переключения на мобильное меню. */
  .header-inner { gap: var(--space-4); }
  .nav-link { padding-inline: 10px; }
  .subject-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tutor-card { grid-template-columns: 120px minmax(0, 1fr) 190px; }
  .tutor-photo { width: 120px; height: 144px; }
  .profile-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  /* В кабинете рядом ещё меню кабинета: две колонки страницы проверки здесь
     не помещаются - решение уходит под содержимое. */
  .cabinet .profile-layout { grid-template-columns: minmax(0, 1fr); }
  .cabinet .profile-aside { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  :root { --header-h: 64px; }
  .header-inner { gap: var(--space-2); }
  .main-nav { display: none; }
  /* Из действий шапки на узком экране остаётся только значок уведомлений,
     остальное - в мобильном меню. Список уведомлений - у правого края экрана. */
  .header-actions > :not(.notify) { display: none; }
  .nav-toggle { display: inline-flex; margin-left: 0; }
  .notify { position: static; }
  .notify-panel { top: calc(100% + 4px); right: 12px; width: min(380px, calc(100% - 24px)); min-width: 0; }
  .mobile-menu {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    z-index: 49;
    display: block;
    padding: 16px 24px 32px;
    background: var(--surface);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .15s, transform .15s, visibility .15s;
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .mobile-menu { opacity: 1; visibility: visible; transform: none; }
  .mobile-menu .nav-link { display: flex; padding: 14px 16px; font-size: 18px; border-radius: var(--radius-md); }
  .mobile-menu .dropdown-title { padding-left: 16px; margin-top: 16px; }
  .mobile-menu .dropdown-item { padding: 12px 16px; }

  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 560px; margin: 0 auto; }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filters-toggle { display: inline-flex; }
  .filters .card { display: none; margin-top: var(--space-4); }
  .filters.open .card { display: block; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-aside { position: static; order: -1; }
  /* Подсказки к форме (страница отклика) - после формы, а не над ней. */
  .profile-aside.aside-after { order: 0; }
  .cabinet { grid-template-columns: 1fr; }
  /* min-width: 0 - иначе лента пунктов растягивает сетку кабинета вместо прокрутки. */
  .cabinet-nav { position: static; min-width: 0; }
  .cabinet-nav ul { display: flex; overflow-x: auto; gap: 6px; }
  .cabinet-nav a { white-space: nowrap; }
  .cabinet-nav .nav-sep { display: none; }
  .grid-3, .steps, .review-cards, .tutor-grid, .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat { grid-template-columns: 280px minmax(0, 1fr); }
  .chat.chat-single { grid-template-columns: minmax(0, 1fr); }
  .order-form-layout, .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  /* Карточка заявки на узком экране: цена и кнопка - над описанием, сведения
     об ученике - под ним. */
  .order-aside { display: contents; }
  .order-aside > .card { margin-top: 0; }
  .order-aside-cta { order: -1; }
  .order-form-aside, .lesson-aside { position: static; }
  .lesson-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Контакты: на узком экране - над формой предложений. */
  .contacts-layout { grid-template-columns: minmax(0, 1fr); }
  .contacts-aside { position: static; order: -1; }
  /* Премиум: иллюстрация под текстом, итог заказа - над формой оплаты. */
  .premium-hero { grid-template-columns: minmax(0, 1fr); padding: var(--space-8); }
  .premium-hero-art { max-width: 420px; width: 100%; margin: 0 auto; }
  .premium-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tariffs-section { grid-template-columns: minmax(0, 1fr); }
  .checkout-layout { grid-template-columns: minmax(0, 1fr); }
  .checkout-aside { position: static; order: -1; }
}

@media (max-width: 768px) {
  h1 { font-size: 30px; line-height: 38px; }
  h2 { font-size: 24px; line-height: 32px; }
  .container { padding-inline: 16px; }
  .page { padding-block: var(--space-6) var(--space-12); }
  .section { padding-block: var(--space-8); }
  .section-head { flex-direction: column; align-items: flex-start; }
  .hero { padding-block: var(--space-8) var(--space-12); }
  .hero h1 { font-size: 34px; line-height: 42px; }
  .hero-search { flex-direction: column; }
  .hero-search select { width: 100%; }
  .subject-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4, .steps, .review-cards, .tutor-grid, .role-cards, .service-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .cta-banner { grid-template-columns: 1fr; padding: var(--space-8); }
  .tutor-card { grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-4); padding: var(--space-4); }
  .tutor-card-premium { padding: calc(var(--space-4) - 1px); }
  .tutor-card .tutor-photo { width: 88px; height: 104px; font-size: 28px; }
  .tutor-card-aside { grid-column: 1 / -1; padding: var(--space-4) 0 0; border-left: 0; border-top: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tutor-card-aside .price { margin-right: auto; }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-hero .tutor-photo { width: 160px; height: 192px; }
  .facts { grid-template-columns: 1fr; }
  .rating-summary { grid-template-columns: 1fr; gap: var(--space-4); }
  .status-card { grid-template-columns: 1fr; }
  .status-card .actions-row { justify-content: flex-start; }
  .visibility-toggle { flex-direction: column; align-items: flex-start; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
  .kv dd { margin-bottom: 8px; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .auth .card { padding: var(--space-6); }
  .page-card { padding: var(--space-6); }
  .contacts-form { padding: var(--space-6); }
  .contacts-form-head h2 { font-size: 20px; line-height: 28px; }
  .contacts-form-icon { grid-row: auto; align-self: center; width: 48px; height: 48px; border-radius: 14px; }
  .contacts-form-icon .icon { width: 26px; height: 26px; }
  .contacts-form-head p { grid-column: 1 / -1; margin-top: var(--space-2); }
  .subjects-table thead { display: none; }
  .subjects-table td { padding: 12px 16px; }
  .subjects-table .col-desc { display: none; }
  .subjects-table .subject-count { display: none; }
  .subject-count-inline { display: block; }
  .subjects-table .group-row th { padding-inline: 16px; }
  .mod-table thead { display: none; }
  .mod-table, .mod-table tbody, .mod-table tr, .mod-table td { display: block; width: 100%; }
  .mod-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .mod-table td { border: 0; padding: 4px 0; }

  .order-card { grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-4); }
  .order-card-aside { padding: var(--space-4) 0 0; border-left: 0; border-top: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .order-card-aside .price { margin-right: auto; }
  .order-card-aside .btn-block { width: auto; }
  .order-cta-mini { max-width: none; width: 100%; flex-wrap: wrap; }
  .order-head h1 { font-size: 26px; line-height: 34px; }
  .home-orders { grid-template-columns: 1fr; padding: var(--space-8); }
  .proposal { padding: var(--space-4); }
  .proposal-head { grid-template-columns: auto minmax(0, 1fr); }
  .proposal-price { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 6px; text-align: left; }
  .lesson-card { grid-template-columns: auto minmax(0, 1fr); }
  .lesson-card-open { grid-column: 1 / -1; justify-self: start; }
  .lesson-aside { grid-template-columns: 1fr; }
  .lesson-head h1 { font-size: 24px; line-height: 32px; }
  .meeting { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .meeting-date { height: 56px; }
  .meeting-cancel-form input[type="text"] { width: 100%; }
  .chat.chat-single { height: calc(100vh - var(--header-h) - 200px); min-height: 420px; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - var(--header-h) - 120px); }
  .chat.has-thread .chat-list { display: none; }
  .chat:not(.has-thread) .chat-thread { display: none; }
  .thread-back { display: inline-flex; }
  /* Кнопки "Занятие" и "Оставить отзыв" - второй строкой: рядом с именем
     на узком экране им места нет. */
  .thread-head { flex-wrap: wrap; padding-inline: 16px; }
  .thread-head-body { flex-basis: calc(100% - 120px); }
  .thread-head > .btn-sm { flex: 1 1 auto; }
  .bubble { max-width: calc(100% - 36px); }
  .bubble:not(.mine) { max-width: calc(100% - 68px); }
  .emoji-panel { left: 8px; width: calc(100% - 16px); }
  .composer { gap: 8px; padding-inline: 12px; }
  .composer .composer-emoji { width: 36px; }
  .composer-note { padding-inline: 12px; }
  .emoji-tabs { gap: 0; padding-inline: 2px; }
  .emoji-tab { padding-inline: 6px; }

  .premium-hero { padding: var(--space-6); }
  .premium-benefits { grid-template-columns: 1fr; margin-bottom: var(--space-8); }
  .premium-status { grid-template-columns: auto minmax(0, 1fr); }
  .premium-status > .btn { grid-column: 1 / -1; justify-self: start; }
  .premium-status-icon { width: 48px; height: 48px; border-radius: 14px; }
  .quota-grid { grid-template-columns: 1fr; }
  .allowance { flex-wrap: wrap; }
  .allowance > .btn { margin-left: 54px; }
  .payment-result { grid-template-columns: 1fr; gap: var(--space-4); }
  .payment-result-icon { width: 56px; height: 56px; border-radius: 16px; }
  .consent-box .field-help { margin-left: 0; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 30px; line-height: 38px; }
  .hero-stats { gap: var(--space-6); }
  .subject-tiles { gap: 10px; }
  .subject-tile { padding: 16px 8px; }
  .date-select { grid-template-columns: 1fr 1fr; }
  .date-select select:first-child { grid-column: 1 / -1; }
  .report-reasons .decision-options { grid-template-columns: 1fr; }
  .tariff-grid { grid-template-columns: 1fr; }
  .modal-body { padding: var(--space-4); }
  .modal .form-actions .btn { flex: 1 1 100%; }
  .btn-lg { width: 100%; }
  /* Длинная подпись кнопки формы ("Принять отклик и начать занятия") переносится,
     а не вылезает за край экрана. */
  .form-actions .btn { max-width: 100%; white-space: normal; text-align: center; }
  /* Сортировка: подпись только для экранных чтецов, видна стрелка - место
     отдано списку вариантов. */
  .sort-label-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .sort-control { flex: 1 1 auto; }
  .sort-control select { flex: 1 1 auto; }
  /* Переписка: поле ввода во всю ширину, кнопки - под ним, поровну. */
  .composer-reply { order: -2; }
  .composer textarea { flex: 1 0 100%; order: -1; }
  .composer > .btn { flex: 1 1 0; min-width: 0; width: auto; gap: 6px; padding-inline: 8px; font-size: 15px; }
  .composer > .composer-emoji:not([aria-expanded="true"]) { background: var(--surface-alt); }
  .composer-btn-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* "Урок состоялся" и "Не состоялся" - одинаковые кнопки во всю ширину. */
  .meeting-actions-mark > * { flex: 1 1 100%; }
  .meeting-actions-mark .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
