/* ==========================================================================
   POLISH — дизайн-слой поверх base/main/cabinet/…  (подключается последним)
   Палитра сохранена. Принципы: контраст ≥ 4.5:1, видимый фокус, цель ≥ 44px,
   SVG вместо эмодзи, состояния загрузки/пусто с действием, reduced-motion.
   ========================================================================== */
:root {
  --text-mute: #8A8A97;               /* было #7C7C88: на surface-2 выходило ≈4.5:1 */
  --accent-ink: #08080A;
  --shadow-card: 0 1px 0 rgba(255,255,255,.035) inset, 0 24px 60px -28px rgba(0,0,0,.85);
  color-scheme: dark;
}

html { scroll-padding-top: 88px; scrollbar-color: var(--border-strong) var(--bg); }
body { text-rendering: optimizeLegibility; }
h1, h2, h3, .section-head__title, .hero__title, .cta-band__title { text-wrap: balance; }
p, .section-head__lead, .hero__sub { text-wrap: pretty; }

/* ---------- кнопки ---------- */
.btn { min-height: 44px; }
.btn--sm { min-height: 36px; }
.btn--icon { min-width: 40px; min-height: 40px; }
.btn--icon .icon { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn--primary {
  background: linear-gradient(180deg, #70F1F1, #4EE8E8);
  box-shadow: 0 0 0 1px rgba(78,232,232,.35), 0 8px 24px -12px var(--accent-glow);
}
.btn--primary:hover { background: linear-gradient(180deg, #84F4F4, #5DEDED); }
.btn .icon { width: 16px; height: 16px; }

/* ---------- навигация ---------- */
.nav__links a { position: relative; padding: 8px 0; }
.nav__links a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav__links a:hover::after, .nav__links a.is-current::after { transform: scaleX(1); }

/* ---------- HERO ---------- */
.hero__layout {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: 56px; align-items: center;
}
.hero__badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px; margin-bottom: 24px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: rgba(14,14,17,.6);
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
}
.hero__badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: heroPulse 2.4s infinite; }
@keyframes heroPulse {
  0% { box-shadow: 0 0 0 0 rgba(78,232,232,.45); }
  70% { box-shadow: 0 0 0 10px rgba(78,232,232,0); }
  100% { box-shadow: 0 0 0 0 rgba(78,232,232,0); }
}
.hero__trust { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 30px; color: var(--text-dim); font-size: 14px; }
.hero__trust li { display: inline-flex; align-items: center; gap: 8px; }
.hero__trust .icon { color: var(--accent); stroke-width: 2; }
.hero__title { max-width: 17ch; }

.hero-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 40px 80px -34px rgba(0,0,0,.95), 0 0 70px -28px var(--accent-glow);
}
.hero-card__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.hero-card__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-mute); }
.hero-card__live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.hero-card__live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: heroPulse 2.4s infinite; }
.hero-card__who { display: flex; align-items: center; gap: 14px; }
.hero-card__avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  font-family: var(--font-display); font-size: 16px; color: var(--accent);
}
.hero-card__meta { min-width: 0; flex: 1; }
.hero-card__name { font-size: 15px; font-weight: 600; }
.hero-card__subj { font-size: 12.5px; color: var(--text-dim); }
.hero-card__price { font-family: var(--font-mono); font-size: 15px; font-weight: 500; white-space: nowrap; }
.hero-card__price span { font-size: 11px; color: var(--text-mute); font-family: var(--font-body); }
.hero-card__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 20px 0 16px; }
.hc-day { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hc-day__h { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); text-align: center; padding-bottom: 2px; }
.hc-cell {
  height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
}
.hc-cell--free { background: var(--accent-dim); border-color: rgba(78,232,232,.45); color: var(--accent); }
.hc-cell--busy { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.35); color: #F4A3A3; }
.hc-cell--off { background: var(--surface-2); color: var(--text-mute); }
.hero-card__legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 12px; color: var(--text-dim); }
.hero-card__legend > span { display: inline-flex; align-items: center; gap: 7px; }
.hc-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.hc-dot--free { background: var(--accent); }
.hc-dot--busy { background: var(--red); }
.hero-card__cta { margin-left: auto; color: var(--accent); font-weight: 600; }

@media (min-width: 769px) {
  .hero { padding: 168px 0 72px; }
  .hero__title { font-size: clamp(34px, 4.6vw, 64px); line-height: 1.06; }
}
@media (max-width: 1024px) {
  .hero__layout { grid-template-columns: 1fr; gap: 44px; }
  .hero-card { max-width: 520px; }
}
@media (max-width: 480px) {
  .hero-card { padding: 16px; }
  .hero-card__price span { display: none; }
  .hc-cell { height: 34px; font-size: 10.5px; }
  .hero-card__cta { margin-left: 0; width: 100%; }
}

/* ---------- Шаги подбора ---------- */
.podbor__card { background: linear-gradient(180deg, var(--surface-1), #0B0B0E); box-shadow: var(--shadow-card); }
.podbor__step.is-active { animation: stepIn .38s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.chip { min-height: 44px; padding: 10px 18px; cursor: pointer; }
/* активный чип отмечен не только цветом, но и галочкой */
.chip.is-active::before {
  content: ''; width: 5px; height: 9px; margin-right: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-1px);
}
.podbor__hint { display: flex; align-items: center; gap: 8px; }

/* ---------- Карточки ---------- */
.how__card, .for-teachers__feature, .teacher-card { position: relative; overflow: hidden; }
.how__card::before, .teacher-card::before, .for-teachers__feature::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); transition: opacity .3s var(--ease);
}
.for-teachers__feature::before { background: linear-gradient(90deg, transparent, var(--magenta), transparent); }
.how__card:hover::before, .teacher-card:hover::before, .for-teachers__feature:hover::before { opacity: .9; }
.teacher-card__cta .icon { width: 16px; height: 16px; }
.teacher-card:focus-visible { outline-offset: 3px; border-radius: var(--radius-lg); }

/* ---------- Цифры ---------- */
.stats { padding: 64px 0; border-top: 1px solid var(--border); position: relative; z-index: 2; }
.stats__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.stats__item { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--surface-1), transparent); }
.stats__num { font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.03em; line-height: 1.1; color: var(--accent); margin-bottom: 10px; }
.stats__label { color: var(--text-dim); font-size: 14px; line-height: 1.45; }

/* ---------- FAQ ---------- */
.faq { padding: 100px 0; border-top: 1px solid var(--border); position: relative; z-index: 2; }
.faq__list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq__item { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .25s var(--ease); }
.faq__item:hover, .faq__item[open] { border-color: var(--border-strong); }
.faq__item summary {
  position: relative; list-style: none; cursor: pointer; min-height: 44px;
  padding: 20px 60px 20px 22px; font-weight: 600; font-size: 16px; border-radius: var(--radius-lg);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: ''; position: absolute; right: 24px; top: 50%; width: 10px; height: 10px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: translateY(-70%) rotate(45deg); transition: transform .3s var(--ease);
}
.faq__item[open] summary::after { transform: translateY(-25%) rotate(-135deg); }
.faq__item p { padding: 0 22px 22px; color: var(--text-dim); font-size: 15px; max-width: 62ch; }

/* ---------- Финальный призыв ---------- */
.cta-band { padding: 20px 0 100px; position: relative; z-index: 2; }
.cta-band__inner {
  text-align: center; padding: 64px 28px; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  background: radial-gradient(620px circle at 50% 0%, var(--accent-dim), transparent 70%), var(--surface-1);
}
.cta-band__title { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -.02em; line-height: 1.12; margin-bottom: 14px; }
.cta-band__text { color: var(--text-dim); max-width: 46ch; margin: 0 auto 28px; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Иконки в пустых состояниях, статусах, кнопках ---------- */
.empty-state__icon .icon, .cabinet__empty-icon .icon { width: 26px; height: 26px; stroke-width: 1.5; }
.booking-card__status { padding: 6px 12px 6px 10px; }
.booking-card__status .icon { width: 14px; height: 14px; stroke-width: 2; }
.booking-card__action { min-height: 40px; }
.notif-item__del .icon { width: 12px; height: 12px; stroke-width: 2; }
.preview-banner__icon .icon { width: 18px; height: 18px; }
.pay__success-icon .icon { width: 30px; height: 30px; stroke-width: 2; }
.teacher-tab { min-height: 44px; }

/* ---------- Загрузка: спиннер вместо голого «Загружаем…» ---------- */
.cabinet__loading, .week-board__loading, .tp-schedule__loading, .preview-schedule__loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.cabinet__loading::before, .week-board__loading::before, .tp-schedule__loading::before, .preview-schedule__loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Формы: ошибка рядом с полем ---------- */
.field input:user-invalid, .field select:user-invalid, .field textarea:user-invalid { border-color: rgba(248,113,113,.65); }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: .55; cursor: not-allowed; }
.auth-form__error:not(:empty) {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3);
}
.auth-card { background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); box-shadow: 0 40px 80px -40px rgba(0,0,0,.9); }
.role-card-big { min-height: 88px; }

/* ---------- Юридические страницы ---------- */
.legal__content h2 { border-top: 1px solid var(--border); padding-top: 28px; }
.legal__content h2:first-child { border-top: 0; padding-top: 8px; }

/* ---------- Подвал ---------- */
.footer__col a { min-height: 32px; }

/* ---------- Адаптив новых блоков ---------- */
@media (max-width: 680px) {
  .stats { padding: 40px 0; }
  .stats__grid { grid-template-columns: 1fr; gap: 12px; }
  .stats__item { padding: 22px; }
  .faq { padding: 64px 0; }
  .faq__item summary { padding: 18px 52px 18px 18px; font-size: 15px; }
  .faq__item p { padding: 0 18px 18px; }
  .cta-band { padding: 8px 0 64px; }
  .cta-band__inner { padding: 44px 20px; }
  .cta-band__actions .btn { width: 100%; }
}

/* ---------- Восстановление пароля ---------- */
.auth-form__forgot { align-self: flex-end; font-size: 13px; color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; min-height: 32px; display: inline-flex; align-items: center; }
.auth-form__forgot:hover { color: var(--accent); }
.auth-form__ok:not([hidden]) {
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--accent-dim); border: 1px solid rgba(78,232,232,.35);
}
[data-invalid]:not([hidden]) { padding: 12px; border-radius: var(--radius-sm); background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); }
[data-invalid] a { color: var(--accent); text-decoration: underline; }
