/*
 * New School · Launch polish v1
 * Финальный слой после аудита фронтенда (docs/launch/frontend-audit.md).
 * Подключается последним в кабинете и на публичных страницах; правила точечные
 * и не меняют дизайн-язык — только читаемость, доступность и мобильную эргономику.
 */

/* ---------- Доступность: общие утилиты и фокус ---------- */
.sr-only { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }
:where(a, button, summary, [tabindex]:not([tabindex="-1"]), input[type="checkbox"], input[type="radio"]):focus-visible {
  outline: 3px solid #5b57f4;
  outline-offset: 2px;
}
:where(.sidebar, .utility-rail, .student-profile-hero, .public-footer, .portal-login-story) :where(a, button):focus-visible { outline-color: #83e5f5; }
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible { outline: 3px solid rgba(91, 87, 244, .35); outline-offset: 1px; }
.skip-link:focus { z-index: 1000; }

/* Декоративные макеты на главной не притворяются кнопками. */
.product-demo button, .phone-lesson-card button, .phone-appbar button, .session-heading button { cursor: default; }

/* ---------- Календарь ученика и родителя ---------- */
.calendar-day > header > .calendar-day-number { align-items: center; border-radius: 50%; display: flex; font-size: 12px; font-weight: 900; height: 24px; justify-content: center; width: 24px; }
.calendar-day.is-today > header > .calendar-day-number { background: var(--portal-indigo, #5b57f4); color: #fff; }
span.lesson-chip { cursor: default; }
a.lesson-chip { transition: transform .15s ease, box-shadow .15s ease; }
a.lesson-chip:hover { box-shadow: 0 6px 16px rgba(23, 25, 44, .12); transform: translateY(-1px); }
.calendar-legend--family .dot--green { background: #38bea4; }
.calendar-legend--family .dot--gold { background: var(--portal-coral, #ff7c91); }
.calendar-legend--family .legend-check { color: #38bea4; font-size: 12px; font-weight: 900; }
.calendar-day.is-outside { color: #8a8f9e; }

/* ---------- Файловые поля (ui-controls.js) ---------- */
.file-drop-native { height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px; }
.file-drop { align-items: center; background: #f6f7fc; border: 1.5px dashed #c9cce0; border-radius: 16px; color: #17192c; cursor: pointer; display: grid; gap: 14px; grid-template-columns: 42px minmax(0, 1fr) auto; min-height: 72px; padding: 12px 14px; transition: border-color .18s ease, background .18s ease; }
.file-drop > i { align-items: center; background: #ecebff; border-radius: 12px; color: #5b57f4; display: flex; font-size: 18px; font-style: normal; font-weight: 900; height: 42px; justify-content: center; width: 42px; }
.file-drop > span { display: grid; gap: 3px; min-width: 0; }
.file-drop strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-drop small { color: #666a7a; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-drop > b { background: #fff; border: 1px solid #dfe1ec; border-radius: 10px; font-size: 12px; font-weight: 800; padding: 8px 12px; }
.file-drop:hover, .file-drop.is-dragover { background: #f0efff; border-color: #5b57f4; }
.file-drop.has-files { background: #effbf8; border-color: #38bea4; border-style: solid; }
.file-drop.has-files > i { background: #d8f5ee; color: #1f8f78; }
.file-drop-native:focus-visible + .file-drop { outline: 3px solid rgba(91, 87, 244, .4); outline-offset: 2px; }
@media (max-width: 520px) { .file-drop { grid-template-columns: 38px minmax(0, 1fr); } .file-drop > b { display: none; } }

/* ---------- Контраст ---------- */
.pwa-control .eyebrow { color: #e4e3ff; }
.public-eyebrow--light, .portal-login-copy .public-eyebrow { color: #a9a6ff; }
.student-profile-hero .eyebrow, .management-head .eyebrow { color: #aeb0ff; }
.month-day-free { color: #8a8f9e; }

/* ---------- Чат: контекстные действия без обрезки ---------- */
.context-quick-actions a > span, .context-quick-actions button > span { display: grid; gap: 2px; min-width: 0; }
.context-quick-actions small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Мобильная эргономика кабинета ---------- */
@media (max-width: 760px) {
  /* «Пульс» — компактная кнопка в углу, а не вкладка поверх контента. */
  .utility-rail-tab { border-radius: 18px; bottom: max(16px, env(safe-area-inset-bottom)); gap: 6px; grid-auto-flow: column; min-height: 44px; padding: 0 14px; right: 14px; top: auto !important; transform: none !important; }
  .utility-rail-tab > span { writing-mode: horizontal-tb; }
  body.has-utility-rail .main { padding-bottom: 84px; }
  /* Счётчики в две колонки: меньше прокрутки до календаря и заданий. */
  .portal-kpis, .profile-metrics { display: grid !important; gap: 10px !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .portal-kpis > *, .profile-metrics > * { min-height: 0 !important; padding: 14px !important; }
  .portal-kpis > * strong, .profile-metrics > * strong { font-size: clamp(18px, 7vw, 30px) !important; line-height: 1.05; overflow-wrap: anywhere; }
  .portal-kpis > *:last-child:nth-child(odd), .profile-metrics > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .profile-metrics .metric-name { font-size: 17px !important; letter-spacing: -.02em; }
  .month-day-free { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  a.lesson-chip, .file-drop { transition: none; }
}

/* ---------- Чат: три колонки помещаются рядом с «Центром дня» ---------- */
@media (min-width: 1121px) {
  .messenger-app:not(.messenger-app--empty) { grid-template-columns: minmax(200px, 252px) minmax(320px, 1fr) minmax(220px, 270px); }
}
.messenger-context { min-width: 0; overflow-x: hidden; }
.context-schedule > header { gap: 8px; }
.context-schedule > header a { white-space: nowrap; }
.composer-input > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utility-analytics span { font-size: 10px; hyphens: auto; letter-spacing: 0; overflow-wrap: normal; text-transform: none; }

/* ---------- Финансы: декоративные круги не перекрывают подписи ---------- */
.finance-highlight > :not(svg) { position: relative; z-index: 1; }

/* ---------- Горизонтальные вкладки показывают, что их можно прокрутить ---------- */
@media (max-width: 1180px) {
  .management-tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 28px; }
}

/* ---------- Публичные страницы: служебные подписи читаемы ---------- */
.public-eyebrow { font-size: 11px; }
.public-pill, .public-program-card:has(.public-program-visual) .public-pill { font-size: 11px; }
.public-program-card .public-program-content li { font-size: 12px; }

/* ---------- Публичная шапка: CTA справа, без дубля «Личный кабинет» ---------- */
@media (min-width: 761px) {
  .public-header { align-items: center; display: flex; }
  .public-header-cta { margin-left: auto !important; }
  .public-nav .public-cabinet-link { display: none; }
}

/* ---------- Тёмные публичные сцены: индиго-подписи заменены светлым акцентом ---------- */
.public-inner-hero .public-eyebrow, .public-inner-hero a:not(.public-button), .course-detail-hero .public-eyebrow, .course-detail-hero a:not(.public-button), .subject-detail-hero .public-eyebrow { color: #b4b1ff; }

/* ---------- Админ-ярлыки: без подчёркивания в тёмных карточках ---------- */
.management-academic-shortcuts a { text-decoration: none; }
.management-academic-shortcuts a:hover strong, .management-academic-shortcuts a:focus-visible strong { text-decoration: underline; text-underline-offset: 3px; }
