/* Вход, заявки в службы, чат, профиль и анкета кабинета гостя (views/service.js).
   Классы экранов: .login-*, .req-*, .chat-*, .prof-*, .survey-*; корневой класс экрана ставится на его контейнер
   (.login-page, .req-page, .chat-view, .prof-page, .survey-page). Общие компоненты (.card, .list-item, .status,
   .field, .segmented, .switch, .stars, .callout…) — в app.css, здесь только их место на этих экранах.
   Цвета — только токены: тёмная тема и цвет отеля работают сами. Касаемые элементы — не меньше 44 px. */

/* ---------- Общее для экранов этого модуля ---------- */
:is(.login-page, .req-page, .prof-page, .survey-page) [data-error]:empty { display: none; }
:is(.login-page, .req-page, .prof-page, .survey-page) .form-error > .icon { margin-top: 1px; }
:is(.login-page, .req-page, .prof-page, .survey-page) .form-error :is(a, .link-btn) {
  color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
/* Кнопка на время запроса: выключена, но не бледная — с вращающимся кольцом. */
:is(.login-page, .req-page, .chat-view, .prof-page, .survey-page) button[aria-busy="true"] { opacity: .85; cursor: progress; }
:is(.login-page, .req-page, .chat-view, .prof-page, .survey-page) button[aria-busy="true"]::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: login-spin .7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }
/* Контейнеры, которым фокус передаётся программно (успех, благодарность), — без рамки фокуса. */
:is(.req-done, .prof-thanks, .survey-done h1):focus { outline: none; }

/* ================================================================
   Вход
   ================================================================ */
.login-page { max-width: 420px; margin: 0 auto; }
/* Название и знак отеля уже крупно в шапке экрана — в верхней панели не повторяем. */
body.guest:has(.login-page) #brand { visibility: hidden; }
/* Шапка: знак отеля кольцом, название антиквой, тонкая черта акцентом, строка о кабинете. */
.login-head { display: grid; justify-items: center; gap: 0; margin: 28px 0 30px; text-align: center; }
.login-head h1 {
  max-width: 100%; margin: 22px 0 0; font-size: clamp(1.75rem, 9vw, 2.625rem); line-height: 1.08; overflow-wrap: break-word;
}
.login-head .lead { max-width: 320px; margin-top: 18px; font-size: .9375rem; line-height: 1.55; }
.login-mark {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--accent); color: var(--accent-text); font-family: var(--font-display); font-size: 1.875rem;
}
.login-mark:has(img) { border: 0; }
.login-mark img { width: 100%; height: 100%; object-fit: cover; }
.login-rule { width: 40px; height: 1px; margin-top: 22px; background: var(--accent); }

/* На 320 px «По номеру группы» с иконкой не помещается в половину ширины — подпись переносится. */
.login-modes > button { min-height: var(--tap); min-width: 0; padding: 0 8px; white-space: normal; line-height: 1.15; }
/* Три способа (есть «По почте»): на 320 px «телефону» рядом с иконкой не помещается в треть ширины — иконка над
   подписью; иконки — на одной высоте, подпись в две строки или в одну. */
.login-modes-3 > button { flex-direction: column; justify-content: flex-start; gap: 4px; padding: 8px 4px; }
/* Форма без карточки: поля — линией снизу, как в анкете на бумаге. Линия — --line-field: другой границы у поля
   нет, и она видна не ниже 3:1 к фону в обеих темах (--line-strong давал 1.6:1 и 1.8:1). */
.card.login-form { margin-top: 4px; padding: 26px 0 0; border: 0; background: none; }
.login-form input:not(.login-code) {
  min-height: 52px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line-field); border-radius: 0;
  background: transparent; font-size: 1.1875rem;
}
.login-form input:not(.login-code):focus { border-color: var(--text); box-shadow: 0 1px 0 0 var(--text); }
.login-form input[aria-invalid="true"] { border-color: var(--danger); }
.login-form [type="submit"] { margin-top: 8px; }

/* «Где найти номер группы» */
.login-where summary {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); cursor: pointer; list-style: none;
  color: var(--text); font-weight: 400; font-size: .9375rem; border-radius: var(--radius-xs);
}
.login-where summary .icon:first-child { color: var(--accent-text); }
.login-where summary::-webkit-details-marker { display: none; }
.login-where summary span { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.login-where summary:hover span { text-decoration-color: currentColor; }
.login-chev { color: var(--muted); transition: transform .2s var(--ease); }
.login-where[open] .login-chev { transform: rotate(180deg); }
.login-where-body {
  margin: 0 0 4px; padding: 14px 16px; border-radius: var(--radius-xs); background: var(--surface-2);
  color: var(--text-2); font-size: .9375rem; display: grid; gap: 6px;
}
.login-where-body p { margin: 0; }

/* Вход кодом (телефон, почта): шаг с кодом */
.login-sent { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-xs); background: var(--accent-soft); }
.login-sent-icon {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent-text);
}
.login-sent-body { display: grid; gap: 2px; min-width: 0; }
.login-sent-body strong { color: var(--text); line-height: 1.35; }
.login-sent-sub { color: var(--text-2); font-size: .875rem; overflow-wrap: anywhere; }
.login-sent-sub .link-btn { font-size: .875rem; min-height: var(--tap); margin: -12px 0; }
.login-form .login-code {
  font-size: 1.5rem; letter-spacing: .32em; text-align: center; font-variant-numeric: tabular-nums;
  padding-left: calc(14px + .32em);
}
.login-form .login-code::placeholder { letter-spacing: .32em; }
.login-resend { display: flex; justify-content: center; margin-top: -4px; }
.login-resend .link-btn { min-height: var(--tap); padding: 0 8px; }
.login-resend .link-btn:disabled { opacity: 1; color: var(--muted); font-weight: 550; text-decoration: none; cursor: default; }
/* «Войти как»: адрес почты указан у нескольких гостей — строка на гостя (имя и даты). */
.login-choices { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.login-choice {
  width: 100%; padding: 12px 0; border: 0; border-radius: 0; background: transparent; color: var(--text);
  font-weight: 400; text-align: left; white-space: normal; justify-content: flex-start;
}
.login-choice:hover { background: transparent; }
.login-choice:hover .li-title { color: var(--accent-text); }
.login-choice .li-title { overflow-wrap: anywhere; }
.login-choice-chev { flex: none; color: var(--muted); }

.login-tip { margin-top: 12px; font-size: .9375rem; }

/* Подвал: звонок на ресепшн между тонкими чертами и справка */
.login-foot { display: grid; gap: 8px; margin-top: 32px; }
.login-call {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.login-call:hover { text-decoration: none; }
.login-call:hover .num { color: var(--accent-text); }
.login-call-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--accent-text);
}
.login-call-body { flex: 1 1 auto; min-width: 0; display: grid; line-height: 1.35; }
.login-call-body strong { font-weight: 500; }
.login-call-body > span { color: var(--muted); font-size: .875rem; }
.login-call-body .num { font-family: var(--font-display); font-size: 1.0625rem; color: var(--text); transition: color .15s; }
.login-call-chev { color: var(--muted); }
.login-foot-text { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text-2); }
.login-help {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  color: var(--muted); font-weight: 400; font-size: .875rem;
}
.login-help:hover { color: var(--text); }

/* ================================================================
   Заявка в службу
   ================================================================ */
.req-form { margin-bottom: 4px; }
.req-optional { font-weight: 500; color: var(--muted); }

/* Плитки типов: радиокнопки в виде карточек с иконкой в цвете службы */
.req-types legend { margin-bottom: 8px; }
.req-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 340px) { .req-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.req-type { position: relative; display: block; }
.req-type input { position: absolute; opacity: 0; pointer-events: none; }
.req-type-body {
  position: relative; height: 100%; min-height: 108px; display: grid; justify-items: center; align-content: start; gap: 4px;
  padding: 14px 6px 12px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); background: var(--surface);
  box-shadow: none; text-align: center; cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .1s var(--ease);
}
.req-type:hover .req-type-body { border-color: var(--line-strong); }
.req-type:active .req-type-body { transform: scale(.98); }
.req-type-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 4px;
  border: 1px solid var(--line-strong); color: var(--accent-text);
}
.req-type[data-dept] .req-type-icon { background: transparent; color: var(--accent-text); }
.req-type-title { font-weight: 500; font-size: .9375rem; line-height: 1.2; color: var(--text); }
.req-type-sub { font-size: .75rem; line-height: 1.25; color: var(--muted); }
.req-type-check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; display: none; place-items: center;
  background: var(--text); color: var(--bg);
}
.req-type-check .icon { stroke-width: 2.4; }
.req-type input:checked + .req-type-body { border-color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--text); }
.req-type input:checked + .req-type-body .req-type-check { display: grid; }
.req-type input:checked + .req-type-body .req-type-title { color: var(--text); }
.req-type input:focus-visible + .req-type-body { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.req-type input:disabled + .req-type-body { opacity: .5; cursor: not-allowed; box-shadow: none; background: var(--surface-2); }
.req-type:has(input:disabled):active .req-type-body { transform: none; }
.req-types.is-invalid .req-type-body { border-color: var(--danger); }
@media (min-width: 560px) {
  .req-type-body {
    min-height: 76px; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; align-content: center;
    justify-items: start; column-gap: 12px; row-gap: 2px; padding: 14px 32px 14px 14px; text-align: left;
  }
  .req-type-icon { grid-row: 1 / span 2; margin: 0; }
  .req-type-title { align-self: end; }
  .req-type-sub { align-self: start; }
}

/* Срочный вызов врача */
.req-urgent-body { display: grid; gap: 6px; justify-items: start; }
.req-urgent-body strong { color: var(--danger); font-size: 1.0625rem; }
.req-call { margin-top: 4px; }

/* Фото: предпросмотр, удаление, добавление */
.req-photos { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.req-photo { position: relative; width: 88px; height: 88px; flex: none; }
.req-photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-xs); background: var(--surface-2); }
.req-photo-del {
  position: absolute; top: -12px; right: -12px; width: var(--tap); height: var(--tap); min-height: 0; padding: 0;
  border-radius: 50%; background: transparent; color: inherit;
}
.req-photo-del:hover { background: transparent; }
.req-photo-del-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--shadow-sm); transition: background-color .15s;
}
.req-photo-del:hover .req-photo-del-dot { background: var(--danger); color: var(--surface); }
.req-photo-add {
  position: relative; width: 88px; height: 88px; flex: none; display: grid; place-items: center; align-content: center; gap: 4px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-xs); background: var(--surface);
  color: var(--accent-text); font-size: .75rem; font-weight: 500; text-align: center; line-height: 1.2;
  transition: border-color .15s, background-color .15s;
}
.req-photo-add:hover { border-color: var(--accent); background: var(--accent-soft); }
/* Рамки фокуса экрана — --focus-ring (theme.css), а не --accent: тёмный или светлый цвет отеля на фоне не виден. */
.req-photo-add:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Заявка принята */
.req-done { display: grid; justify-items: center; gap: 8px; padding: 28px 20px 24px; text-align: center; }
.req-done h2 { margin: 4px 0 0; }
.req-done > p { color: var(--text-2); max-width: 440px; }
.req-done .callout { text-align: left; }
.req-done-icon {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--ok); color: var(--ok);
}
.req-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
@media (max-width: 420px) { .req-done-actions > * { flex: 1 1 0; } }

/* Мои заявки */
.req-mine { margin-top: 32px; }
.req-list { padding: 4px 16px; }
.req-item { align-items: flex-start; }
.req-item .li-end { padding-top: 2px; }
.req-item-text { display: block; margin: 2px 0; color: var(--text-2); font-size: .9375rem; line-height: 1.4; }
.req-empty { padding: 0; }

/* ================================================================
   Чат
   ================================================================ */
/* Экран занимает высоту окна: переписка растягивается, поле ввода прижато к нижнему меню
   (отрицательный отступ снимает нижние поля страницы — поле стоит вплотную к меню). */
.chat-view {
  display: flex; flex-direction: column; margin-bottom: -44px;
  min-height: calc(100vh - var(--appbar-h) - var(--safe-t) - var(--tabbar-h) - var(--safe-b) - 16px);
  min-height: calc(100dvh - var(--appbar-h) - var(--safe-t) - var(--tabbar-h) - var(--safe-b) - 16px);
}
.chat-head { margin-bottom: 8px; }
.chat-head .lead { font-size: .9375rem; }
.chat-log { flex: 1 1 auto; display: flex; flex-direction: column; padding: 4px 0 12px; }
.chat-log > .empty-state { margin: auto 0; }

.chat-day { align-self: center; position: sticky; top: calc(var(--appbar-h) + var(--safe-t) + 6px); z-index: 1; margin: 16px 0 6px; }
.chat-day span {
  display: inline-block; padding: 4px 12px; border-radius: var(--radius-xs); background: var(--bg);
  color: var(--muted); font-size: .6875rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
}

.chat-msg { display: flex; flex-direction: column; max-width: min(82%, 520px); margin-top: 3px; }
.chat-msg.is-first { margin-top: 12px; }
.chat-msg-guest { align-self: flex-end; align-items: flex-end; }
.chat-msg-hotel { align-self: flex-start; align-items: flex-start; }
.chat-author {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 4px; max-width: 100%;
  font-size: .75rem; font-weight: 500; color: var(--accent-text); overflow-wrap: anywhere;
}
.chat-author .icon { flex: none; }
/* Подпись ответа «Анна · Ресепшн»: имя — цветом отеля, служба — приглушённо. */
.chat-author-dept { color: var(--muted); font-weight: 400; }
.chat-msg-bot .chat-author { color: var(--muted); }
/* Пузыри почти прямоугольные: гость — тушью, отель — бумагой с тонкой рамкой. */
.chat-bubble {
  padding: 10px 14px; border-radius: 10px; font-size: .9375rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg-guest .chat-bubble { background: var(--text); color: var(--bg); border-bottom-right-radius: 2px; }
.chat-msg-hotel .chat-bubble { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.chat-msg-bot .chat-bubble { background: var(--surface-2); border-color: transparent; }
.chat-msg-guest:not(.is-first) .chat-bubble { border-top-right-radius: 4px; }
.chat-msg-hotel:not(.is-first) .chat-bubble { border-top-left-radius: 4px; }
.chat-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.chat-meta { margin: 3px 10px 0; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-msg.is-pending .chat-bubble { opacity: .65; }

.chat-typing { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px 4px; color: var(--muted); font-size: .8125rem; font-weight: 600; }
.chat-dots { display: inline-flex; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.chat-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-blink 1.2s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: .15s; }
.chat-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-blink { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

/* Нижняя панель: быстрые вопросы и поле ввода, прилипает над нижним меню */
.chat-dock {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 3;
  margin: 0 -16px; padding: 6px 16px 12px; background: var(--bg);
}
.chat-dock::before {
  content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.chat-quick { padding-bottom: 8px; }
.chat-quick .chip { min-height: var(--tap); cursor: pointer; }
.chat-composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 4px 4px 4px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line-field); box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat-composer:focus-within { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.chat-field { flex: 1 1 auto; min-width: 0; display: flex; cursor: text; }
.chat-composer textarea {
  min-height: var(--tap); max-height: 160px; padding: 11px 0; border: 0; border-radius: 0; background: transparent;
  resize: none; line-height: 1.4; overflow-y: auto;
}
.chat-composer textarea:hover, .chat-composer textarea:focus { border: 0; box-shadow: none; }
.chat-send { flex: none; border-radius: var(--radius-xs); background: var(--text); color: var(--bg); }
.chat-send:hover { background: color-mix(in srgb, var(--text) 84%, var(--bg)); }
.chat-send:disabled, .chat-send:disabled:hover { opacity: 1; background: var(--surface-2); color: var(--muted); }
.chat-new {
  position: absolute; left: 50%; top: -56px; transform: translateX(-50%); min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
.chat-new:hover { background: var(--surface-2); }
.chat-new:active { transform: translateX(-50%) scale(.98); }

@media (min-width: 760px) {
  /* Нижнее меню здесь «парит» в 12 px от края — поле ввода встаёт над ним с зазором. */
  .chat-view {
    margin-bottom: -20px;
    min-height: calc(100vh - var(--appbar-h) - var(--safe-t) - var(--tabbar-h) - 40px);
    min-height: calc(100dvh - var(--appbar-h) - var(--safe-t) - var(--tabbar-h) - 40px);
  }
  .chat-dock { bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); }
  .chat-msg { max-width: min(72%, 520px); }
}

/* ================================================================
   Профиль
   ================================================================ */
.prof-head { display: flex; align-items: center; gap: 16px; }
.prof-head-body { min-width: 0; }
.prof-head h1 { margin: 0 0 2px; overflow-wrap: anywhere; }
.prof-head .lead { font-size: .9375rem; color: var(--muted); }

.prof-group { margin-top: 24px; }
.prof-group-title {
  margin: 0 4px 10px; font-family: var(--font); font-size: .6875rem; font-weight: 500; letter-spacing: .22em;
  line-height: 1.5; text-transform: uppercase; color: var(--muted);
}
.prof-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.prof-group-head .prof-group-title { margin-bottom: 0; }
.prof-group-link {
  display: inline-flex; align-items: center; min-height: var(--tap); margin: -10px 0; padding: 0 4px;
  font-size: .875rem; font-weight: 600;
}

/* Проживание */
.prof-stay-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.prof-room-wrap { min-width: 0; display: grid; }
.prof-label { font-size: .6875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.prof-room { margin-top: 4px; font-family: var(--font-display); font-size: 3.5rem; font-weight: 400; line-height: 1; color: var(--text); }
.prof-room-none { font-size: 1.0625rem; font-weight: 500; margin: 2px 0; }
.prof-room-type { color: var(--text-2); font-size: .9375rem; }
.prof-dates { padding-top: 14px; border-top: 1px solid var(--line); }
.prof-stay-hint { margin: 12px 0 0; }

/* Счёт */
.prof-lines { list-style: none; margin: 0; padding: 0; }
.prof-lines li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prof-lines li:first-child { padding-top: 0; }
.prof-line-body { min-width: 0; display: grid; }
.prof-line-title { font-weight: 550; overflow-wrap: anywhere; }
.prof-line-date { font-size: .8125rem; color: var(--muted); }
.prof-line-sum { flex: none; font-weight: 600; white-space: nowrap; }
.prof-line-sum.is-payment { color: var(--ok); }
.prof-lines-empty { margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
/* «Карт пока нет» — последнее в блоке бонусов: черта под ним ни от чего не отделяет. */
.prof-lines-empty:last-child { padding-bottom: 0; border-bottom: 0; }
.prof-more { min-height: var(--tap); }
/* Итог: не помещается в строку с подписью («13 845,67 балла · 120 000 ₽» на 320–375 px) — переносится под неё и
   прижат вправо, а не вылезает за карточку. */
.prof-total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 14px 0 10px; font-weight: 500; }
.prof-total strong { flex: 1 1 auto; min-width: 0; font-family: var(--font-display); font-size: 1.625rem; font-weight: 400; text-align: right; }
.prof-paid { display: inline-flex; align-items: center; gap: 10px; }
/* Прежний счёт, пока 1С отвечает медленно: «Обновлено в 14:05» — тихо, под итогом. */
.prof-folio-updated { margin: 0 0 6px; }

/* Бонусы и сертификаты: карты с остатком, подсказка про корзину, история операций */
.prof-group-title[tabindex="-1"]:focus { outline: none; }
/* С главной профиль прокручивается к «Бонусам и сертификатам»: заголовок — под липкой верхней панелью, а не за ней. */
.prof-group-title[tabindex="-1"] { scroll-margin-top: calc(var(--appbar-h) + var(--safe-t) + 12px); }
.prof-loyalty .callout .sm { min-height: var(--tap); }
.prof-cards { list-style: none; margin: 0; padding: 0; }
.prof-card { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.prof-card:first-child { padding-top: 0; }
.prof-card + .prof-card { border-top: 1px solid var(--line); }
.prof-card-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--accent-text);
}
.prof-card-icon.is-cert { color: var(--warm); }
/* Текст карты и её остаток — в одной обёртке: когда остаток не помещается рядом (баллы шире рублей: «1 500 баллов»
   на 320 px оставляли тексту 50 px, и подпись наезжала на число), он переносится под текст, как SplitRow в
   приложении. Рядом — прижат вправо, под текстом — влево. */
.prof-card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.prof-card-body { flex: 1 1 8.5rem; min-width: 0; display: grid; gap: 1px; }
.prof-card-title { font-weight: 600; overflow-wrap: anywhere; }
.prof-card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .8125rem; color: var(--muted); }
/* Остаток карты: бонусная — баллами («на 750 ₽» под ними — когда балл стоит не рубль), сертификат — рублями. */
.prof-card-value { flex: none; display: grid; justify-items: end; gap: 1px; }
.prof-card-sum { flex: none; font-family: var(--font-display); font-size: 1.375rem; font-weight: 400; color: var(--text); white-space: nowrap; }
.prof-card-rub { font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.prof-card-why { font-size: .8125rem; color: var(--text-2); }
/* Заблокирована или срок истёк: сумма есть в 1С, но платить ею нельзя и в «Всего» она не входит. */
.prof-card.is-off .prof-card-icon { color: var(--muted); }
.prof-card.is-off .prof-card-title,
.prof-card.is-off .prof-card-sum { color: var(--muted); }
.prof-loyalty .prof-total { border-top: 1px solid var(--line); margin-top: 10px; }
.prof-loyalty-tip {
  display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: .875rem;
}
.prof-loyalty-tip .icon { margin-top: 1px; color: var(--accent-text); }
.prof-sub-title { margin: 18px 0 8px; font-size: .9375rem; font-weight: 600; color: var(--text-2); }
.prof-history li:last-child { border-bottom: 0; }
.prof-loyalty-note { margin: 10px 0 0; }
/* Скидки из 1С (карта или карточка гостя) — для сведения; «Отель учтёт скидку сам». */
.prof-card-icon.is-discount { color: var(--info); }
.prof-card-why.is-info { color: var(--muted); }
.prof-discounts + .prof-cards { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }

/* Уровень программы лояльности (по проживаниям из 1С): название, что даёт, прогресс, вся лестница. */
.lv-card { display: grid; gap: 8px; margin-bottom: 12px; }
.lv-kicker {
  display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text);
  font-size: .6875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
}
.lv-name { font-family: var(--font-display); font-size: 1.875rem; font-weight: 400; line-height: 1.15; }
.lv-benefits { margin: 0; color: var(--text-2); }
.lv-bar { height: 2px; margin-top: 6px; border-radius: 0; background: var(--line-strong); overflow: hidden; }
/* Заполнение полос прогресса — текстом акцента, как отметки дней на главной: тёмный цвет отеля на угле не пропадает. */
.lv-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent-text); transition: width .4s ease; }
@media (prefers-reduced-motion: reduce) { .lv-bar > span { transition: none; } }
.lv-next { margin: 0; color: var(--text-2); font-size: .9375rem; }
.lv-all { margin-top: 4px; }
.lv-all > summary {
  display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; color: var(--accent-text); font-weight: 600;
}
.lv-ladder { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 10px; }
.lv-ladder li { display: flex; align-items: flex-start; gap: 10px; }
.lv-step {
  width: 18px; height: 18px; flex: none; display: grid; place-items: center; margin-top: 3px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--accent-ink);
}
.lv-ladder li.is-reached .lv-step { border-color: var(--accent); background: var(--accent); }
.lv-step-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; font-size: .9375rem; }
.lv-step-body .muted { font-size: .8125rem; }
.lv-step-benefit { font-size: .875rem; color: var(--text-2); }

/* Контакты: e-mail и язык сообщений */
.prof-contacts select { max-width: 320px; }
.prof-phone { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.prof-phone .icon { margin-top: 2px; flex: none; }
/* Почта для входа: адреса, подтверждение адреса профиля кодом из письма */
.prof-login-email { margin-top: 12px; overflow-wrap: anywhere; }
.prof-login-email > *, .prof-login-email .stack-sm > * { min-width: 0; }
/* «Подтвердить почту для входа» на 320 px в строку не помещается — переносится, а не раздвигает карточку. */
.prof-login-email button.block { white-space: normal; text-align: center; }
.prof-login-email .prof-why { margin: 0; }
.prof-login-list { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 4px; }
.prof-login-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.prof-login-list .icon { flex: none; color: var(--accent-text); }
.prof-login-hint { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.prof-login-hint .icon { margin-top: 2px; flex: none; }
.prof-confirm-code { font-size: 1.25rem; letter-spacing: .24em; text-align: center; font-variant-numeric: tabular-nums; }
.prof-confirm-more { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; }
.prof-confirm-more .link-btn { min-height: var(--tap); }
.prof-confirm-more .link-btn:disabled { opacity: 1; color: var(--muted); font-weight: 550; text-decoration: none; cursor: default; }

/* Уведомления */
.prof-why { color: var(--text-2); font-size: .9375rem; margin-bottom: 4px; }
.prof-notify .callout { margin: 8px 0 4px; }
.prof-folio .callout .sm { min-height: var(--tap); }
.prof-channel .li-end .sm { min-height: var(--tap); padding: 0 14px; }
.prof-on { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 600; }
.prof-notify-hint { margin: 4px 0 8px; }

/* Пригласить близких: «Поделиться», приложения, кто уже подключился по ссылке группы. */
.prof-invite-actions { display: grid; gap: 10px; margin: 12px 0 4px; }
.prof-invite-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.prof-invite-apps > * { min-width: 0; padding: 0 10px; }
.prof-invite-title { margin: 20px 0 4px; }
.prof-invite-list { margin: 0; padding: 0; list-style: none; }
.prof-invite-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 10px 0;
}
.prof-invite-list li + li { border-top: 1px solid var(--line); }
.prof-invite-name { font-weight: 500; overflow-wrap: anywhere; }
.prof-invite-meta { color: var(--muted); font-size: .875rem; }
.prof-invite-list li.is-off .prof-invite-name { color: var(--text-2); font-weight: 400; }
/* Шторка «Как отключить»: шаги в мессенджере */
.prof-unlink p { margin: 0; color: var(--text-2); }
.prof-unlink-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.prof-switch-row { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.prof-switch { display: flex; flex-direction: row-reverse; justify-content: space-between; gap: 16px; width: 100%; min-height: var(--tap); }
.prof-switch-text { display: grid; gap: 2px; min-width: 0; }
.prof-switch-title { font-weight: 600; }
.prof-switch-sub { font-size: .8125rem; color: var(--muted); }

/* Отзыв */
.prof-stars, .survey-stars { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 12px; }
:is(.prof-stars, .survey-stars) .stars label { padding: 6px; }
.prof-stars-caption, .survey-caption { min-height: 1.5em; padding-bottom: 12px; color: var(--text-2); font-weight: 500; font-size: .9375rem; }
.prof-thanks { display: flex; align-items: flex-start; gap: 14px; }
.prof-thanks-icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent-text);
}
.prof-thanks strong { font-size: 1.0625rem; }
.prof-thanks p { margin: 2px 0 4px; color: var(--text-2); }
.prof-thanks .link-btn { min-height: var(--tap); }

/* Помощь и выход */
.prof-list { padding: 4px 16px; }
.prof-logout { display: grid; gap: 8px; margin-top: 28px; text-align: center; }
.prof-logout button { color: var(--danger); }
.prof-logout button:hover { background: var(--danger-soft); border-color: transparent; }

/* ================================================================
   Анкета
   ================================================================ */
.survey-progress {
  position: sticky; top: calc(var(--appbar-h) + var(--safe-t)); z-index: 4;
  margin: -8px -16px 12px; padding: 8px 16px 12px; background: var(--bg);
}
.survey-progress-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.survey-bar { height: 2px; border-radius: 0; background: var(--line-strong); overflow: hidden; }
.survey-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-text); transition: width .3s var(--ease); }

.survey-q { display: grid; gap: 10px; transition: border-color .2s, box-shadow .2s; }
.survey-q-num { font-size: .6875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-text); }
/* legend звёзд — .field-label (ui.js → starsInput): капитель подписей поля здесь не нужна, это сам вопрос. */
.survey-q-title, .survey-q .stars legend {
  display: block; margin-bottom: 8px; font-family: var(--font-display); font-size: 1.3125rem; font-weight: 400;
  line-height: 1.3; letter-spacing: 0; text-transform: none; color: var(--text);
}
.survey-q.is-answered { border-color: var(--line-strong); }
.survey-q.is-missing { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.survey-yesno { max-width: 300px; }
.survey-yesno > label > span { min-height: var(--tap); }

.survey-done { display: grid; justify-items: center; gap: 8px; padding: 40px 8px 24px; text-align: center; }
.survey-done h1 { margin: 8px 0 0; }
.survey-done .lead { max-width: 380px; }
.survey-done-icon {
  width: 80px; height: 80px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent-text);
}
.survey-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
@media (max-width: 420px) { .survey-done-actions { width: 100%; } .survey-done-actions > * { flex: 1 1 100%; } }
