/* Дизайн-система кабинета гостя и панели сотрудника: токены, базовые элементы, общие компоненты,
   оболочка кабинета гостя. Стили отдельных экранов — в css/<область>.css, админки — /admin/admin.css.
   Правила и названия классов — docs/DESIGN.md. Цвета только через токены: тёмная тема и цвет отеля
   (hotel.brand_color) меняют токены, а не стили компонентов. */

/* ---------- Токены ---------- */
:root {
  color-scheme: light;
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f1eee8;
  --surface-3: #e7e2d9;
  --text: #1b2124;
  --text-2: #3e474b;
  --muted: #6b7478;
  --line: #e8e3da;
  --line-strong: #d3ccbf;
  --accent: #0f7a70;
  --accent-hover: #0b665e;
  --accent-ink: #ffffff;
  --accent-soft: #e1f1ee;
  --accent-text: #0b5d55;
  --warm: #b97a2c;
  --warm-soft: #f8ecda;
  --ok: #157347;
  --ok-soft: #e2f3e9;
  --warn: #9a5800;
  --warn-soft: #fcefd9;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --info: #2457c0;
  --info-soft: #e6edfc;
  --inverse: #1f2629;
  --inverse-ink: #f4f6f6;
  --backdrop: rgb(12 16 18 / 46%);

  --shadow-sm: 0 1px 2px rgb(27 33 36 / 6%);
  --shadow: 0 1px 2px rgb(27 33 36 / 4%), 0 6px 20px rgb(27 33 36 / 6%);
  --shadow-lg: 0 18px 48px rgb(27 33 36 / 18%);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --page-w: 720px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1213; --surface: #161b1d; --surface-2: #1e2528; --surface-3: #283135; --text: #ecf0f1; --text-2: #c9d0d3;
    --muted: #96a2a7; --line: #263034; --line-strong: #36423f; --accent: #3cc2b2; --accent-hover: #5bd2c3;
    --accent-ink: #04211e; --accent-soft: #12332f; --accent-text: #86e3d6; --warm: #e2a95f; --warm-soft: #3a2c18;
    --ok: #62d394; --ok-soft: #12301f; --warn: #f3b45e; --warn-soft: #382811; --danger: #ff8b7c; --danger-soft: #3d1714;
    --info: #8fb5ff; --info-soft: #16243f; --inverse: #eef2f2; --inverse-ink: #161b1d; --backdrop: rgb(0 0 0 / 60%);
    --shadow-sm: 0 0 0 1px var(--line); --shadow: 0 0 0 1px var(--line); --shadow-lg: 0 18px 48px rgb(0 0 0 / 50%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1213; --surface: #161b1d; --surface-2: #1e2528; --surface-3: #283135; --text: #ecf0f1; --text-2: #c9d0d3;
  --muted: #96a2a7; --line: #263034; --line-strong: #36423f; --accent: #3cc2b2; --accent-hover: #5bd2c3;
  --accent-ink: #04211e; --accent-soft: #12332f; --accent-text: #86e3d6; --warm: #e2a95f; --warm-soft: #3a2c18;
  --ok: #62d394; --ok-soft: #12301f; --warn: #f3b45e; --warn-soft: #382811; --danger: #ff8b7c; --danger-soft: #3d1714;
  --info: #8fb5ff; --info-soft: #16243f; --inverse: #eef2f2; --inverse-ink: #161b1d; --backdrop: rgb(0 0 0 / 60%);
  --shadow-sm: 0 0 0 1px var(--line); --shadow: 0 0 0 1px var(--line); --shadow-lg: 0 18px 48px rgb(0 0 0 / 50%);
}

/* Цвет отеля (app.js ставит --accent из hotel.brand_color): мягкий фон и текст выводятся из него. */
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
    --accent-text: color-mix(in srgb, var(--accent) 78%, var(--text));
    --accent-hover: color-mix(in srgb, var(--accent) 86%, var(--text));
  }
}

/* Цвета служб: значок раздела, полоска карточки. */
[data-dept] { --dept: #64748b; }
[data-dept="dining"] { --dept: #dd7a2e; }
[data-dept="spa"] { --dept: #2f9b6c; }
[data-dept="medical"] { --dept: #d0453f; }
[data-dept="animation"] { --dept: #8458e6; }
[data-dept="sport"] { --dept: #2c7bd3; }
[data-dept="concierge"] { --dept: #b8862c; }
[data-dept="beach"] { --dept: #1a9fb3; }
[data-dept="housekeeping"] { --dept: #a064cc; }
[data-dept="maintenance"] { --dept: #6b7280; }

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* scrollbar-gutter: место под полосу прокрутки занято всегда — при переходе с длинного экрана на короткий страница
   не сдвигается вбок, когда полоса пропадает (панель и кабинет на компьютере). */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scrollbar-gutter: stable; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); }
h1, .h1 { font-size: 1.625rem; font-weight: 750; letter-spacing: -.02em; }
h2, .h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
h3, .h3 { font-size: 1.0625rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.lead { font-size: 1.0625rem; color: var(--text-2); }
.muted { color: var(--muted); }
.small, small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.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; }
.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ---------- Раскладка ---------- */
.page { max-width: var(--page-w); margin: 0 auto; padding: 16px 16px 28px; }
/* Переход между экранами (app.js → holdView): прежний экран приглушается, пока грузится новый. С задержкой — на
   быстрой связи экран сменяется сразу, без мигания. */
.page[aria-busy="true"] { opacity: .55; transition: opacity .2s ease .15s; }
@media (prefers-reduced-motion: reduce) { .page[aria-busy="true"] { transition: none; } }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 24px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-head h2 { margin: 0; }
.section-head a, .section-head .link-btn { font-size: .9375rem; font-weight: 600; }
.scroll-x {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px 8px; scroll-padding: 0 16px;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: 0 0 auto; scroll-snap-align: start; }

/* ---------- Карточки и списки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.card.flat { box-shadow: none; }
.card.tonal { background: var(--surface-2); border-color: transparent; box-shadow: none; }
a.card, .card.clickable { display: block; color: inherit; text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s; }
a.card:hover, .card.clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow); text-decoration: none; }
a.card:active, .card.clickable:active { transform: scale(.99); }
.card.hero {
  border: 0; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgb(255 255 255 / 18%) 0%, transparent 55%),
              linear-gradient(140deg, var(--accent) 0%, #1d4f6e 100%);
  box-shadow: var(--shadow);
}
.card.hero .muted, .card.hero a { color: rgb(255 255 255 / 82%); }
/* Тёмная тема: светлый акцент под белым текстом нечитаем — градиент темнее. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card.hero, :root:not([data-theme="light"]) .onb-art {
    background: radial-gradient(120% 140% at 100% 0%, rgb(255 255 255 / 10%) 0%, transparent 55%),
                linear-gradient(140deg, color-mix(in srgb, var(--accent) 50%, #0b1416) 0%, color-mix(in srgb, var(--accent) 16%, #0b1416) 100%);
  }
}
:root[data-theme="dark"] .card.hero, :root[data-theme="dark"] .onb-art {
  background: radial-gradient(120% 140% at 100% 0%, rgb(255 255 255 / 10%) 0%, transparent 55%),
              linear-gradient(140deg, color-mix(in srgb, var(--accent) 50%, #0b1416) 0%, color-mix(in srgb, var(--accent) 16%, #0b1416) 100%);
}
.card-title { font-weight: 650; font-size: 1.0625rem; margin: 0 0 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none; min-height: 56px; }
a.list-item:hover { text-decoration: none; }
a.list-item:hover .li-title { color: var(--accent-text); }
.li-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text);
}
[data-dept] > .li-icon, .li-icon[data-dept] { background: color-mix(in srgb, var(--dept) 14%, var(--surface)); color: var(--dept); }
.li-body { flex: 1 1 auto; min-width: 0; }
.li-title { display: block; font-weight: 600; }
.li-sub { display: block; color: var(--muted); font-size: .875rem; }
.li-end { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 550; }

.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; }
.thumb { width: 88px; height: 88px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface-2); }

/* ---------- Кнопки ---------- */
button, .btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border: 1px solid transparent; border-radius: 14px;
  font: inherit; font-weight: 650; font-size: .9375rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s var(--ease), box-shadow .15s;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:active, .btn:active { transform: scale(.98); }
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
button.secondary, .btn.secondary { background: var(--accent-soft); color: var(--accent-text); }
button.secondary:hover, .btn.secondary:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
button.outline, .btn.outline { background: transparent; color: var(--text); border-color: var(--line-strong); }
button.outline:hover, .btn.outline:hover { background: var(--surface-2); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent-text); padding: 0 10px; }
button.ghost:hover, .btn.ghost:hover { background: var(--accent-soft); }
button.danger, .btn.danger { background: var(--danger); color: #fff; }
button.danger:hover, .btn.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
button.danger-soft, .btn.danger-soft { background: var(--danger-soft); color: var(--danger); }
button.danger-soft:hover, .btn.danger-soft:hover { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); }
.btn.sm, button.sm { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: .875rem; }
.btn.lg, button.lg { min-height: 52px; padding: 0 22px; font-size: 1rem; border-radius: 16px; }
.btn.block, button.block { display: flex; width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 0; width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%;
  background: transparent; color: var(--text); position: relative; text-decoration: none;
}
.icon-btn > span { display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.tonal { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn.tonal:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.link-btn { min-height: 0; padding: 0; background: none; color: var(--accent-text); font-weight: 600; border-radius: 6px; }
.link-btn:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Чипы, бейджи, статусы ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  font-weight: 550; font-size: .875rem; white-space: nowrap; text-decoration: none;
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.active, .chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip.soft { border-color: transparent; background: var(--surface-2); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1;
}
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.badge.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2); font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); color: var(--accent-text); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.warm { background: var(--warm-soft); color: var(--warm); }
/* Статус заказа, заявки, записи: <span class="status" data-status="in_progress">готовится</span> */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--radius-pill);
  font-size: .8rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status[data-status="new"], .status[data-status="waiting"] { background: var(--info-soft); color: var(--info); }
.status[data-status="accepted"], .status[data-status="booked"], .status[data-status="open"] { background: var(--accent-soft); color: var(--accent-text); }
.status[data-status="in_progress"], .status[data-status="queued"], .status[data-status="pending"] { background: var(--warn-soft); color: var(--warn); }
.status[data-status="delivering"] { background: var(--warm-soft); color: var(--warm); }
.status[data-status="done"], .status[data-status="charged"], .status[data-status="paid"] { background: var(--ok-soft); color: var(--ok); }
.status[data-status="cancelled"], .status[data-status="closed"] { background: var(--surface-2); color: var(--muted); }
.status[data-status="no_show"], .status[data-status="rejected"], .status[data-status="failed"] { background: var(--danger-soft); color: var(--danger); }

/* ---------- Формы ---------- */
input, select, textarea {
  font: inherit; color: var(--text); width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a9397' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select[multiple] { background-image: none; padding-right: 14px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); box-shadow: none; flex: none; }
input[type="file"] { padding: 10px; }
input[type="color"] { padding: 4px; width: 64px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
/* iPhone приближает страницу, когда палец ставит курсор в поле со шрифтом мельче 16 px (поиск в чате, поля таблиц
   панели, ссылка приглашения), и страница остаётся увеличенной. На сенсорном экране поля — не мельче 16 px. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
}
label { cursor: pointer; }
.field { display: grid; gap: 6px; }
.field-label { font-size: .875rem; font-weight: 650; color: var(--text-2); }
.hint { font-size: .8125rem; color: var(--muted); }
.field-error { font-size: .8125rem; color: var(--danger); font-weight: 550; }
.form-error {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: var(--danger-soft); color: var(--danger); font-weight: 550;
}
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .9375rem; }
.check input { margin-top: 2px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* Сегменты: <div class="segmented"><label><input type="radio" name="x"><span>Текст</span></label>…</div>
   или кнопки с aria-pressed="true". */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.segmented > label, .segmented > button { flex: 1 1 0; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented > label > span, .segmented > button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 12px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .9375rem; text-align: center;
}
.segmented > button:hover, .segmented > label:hover > span { background: rgb(127 127 127 / 8%); }
.segmented input:checked + span, .segmented > button[aria-pressed="true"], .segmented > button.active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Карточки выбора: <label class="choice"><input type="radio"><span class="choice-body">…</span></label> */
.choice { display: block; position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px;
  border: 1.5px solid var(--line-strong); background: var(--surface); transition: border-color .15s, background-color .15s;
}
.choice-body strong { display: block; font-weight: 650; }
.choice-body small { display: block; color: var(--muted); }
.choice-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); color: var(--text-2); }
.choice input:checked + .choice-body { border-color: var(--accent); background: var(--accent-soft); }
.choice input:checked + .choice-body .choice-icon { background: var(--accent); color: var(--accent-ink); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input:disabled + .choice-body { opacity: .5; }

/* Переключатель: <label class="switch"><input type="checkbox" role="switch"><span class="switch-track"></span><span>Текст</span></label> */
.switch { display: inline-flex; align-items: center; gap: 12px; position: relative; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 46px; height: 28px; flex: none; border-radius: 14px; background: var(--line-strong); position: relative; transition: background-color .2s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform .2s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }

/* Количество: <div class="qty"><button class="icon-btn sm">−</button><span class="qty-value">2</span><button …>+</button></div> */
.qty { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text); }
.qty .icon-btn { width: 34px; height: 34px; color: var(--accent-text); }
.qty .icon-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.qty-value { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Звёзды (ui.js → starsInput): радиокнопки 5…1 в обратном порядке, подсвечиваются выбранная и меньшие. */
.stars-row { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { color: var(--line-strong); padding: 2px; border-radius: 8px; transition: color .1s, transform .1s; }
.stars label .icon { stroke-width: 1.5; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: #f2b11c; }
.stars label:hover .icon, .stars label:hover ~ label .icon, .stars input:checked ~ label .icon { fill: currentColor; }
.stars input:focus-visible + label { outline: 2px solid var(--accent); }
.stars label:active { transform: scale(.9); }

/* ---------- Шаги статуса (ui.js → progressSteps) ---------- */
.steps { display: flex; list-style: none; margin: 8px 0 0; padding: 0; }
.steps li { flex: 1 1 0; position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; }
.steps li::before {
  content: ""; position: absolute; top: 10px; right: 50%; width: 100%; height: 2px; background: var(--line-strong); z-index: 0;
}
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li.current::before { background: var(--accent); }
.step-dot {
  position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--accent-ink);
}
.steps li.done .step-dot { background: var(--accent); border-color: var(--accent); }
.steps li.current .step-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps li.current .step-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.step-label { font-size: .75rem; color: var(--muted); line-height: 1.2; }
.steps li.current .step-label { color: var(--text); font-weight: 650; }
.steps-failed li.current .step-dot { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.steps-failed li.current .step-dot::after { background: var(--danger); }

/* ---------- Плашки и раскрывающиеся блоки ---------- */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); }
.callout > .icon { margin-top: 1px; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout p { margin: 0; }
.callout-tip { background: var(--accent-soft); color: var(--text); }
.callout-tip > .icon { color: var(--accent-text); }
.callout-warn { background: var(--warn-soft); }
.callout-warn > .icon { color: var(--warn); }
.callout-danger { background: var(--danger-soft); }
.callout-danger > .icon { color: var(--danger); }
.callout-info { background: var(--info-soft); }
.callout-info > .icon { color: var(--info); }

.accordion details { border-bottom: 1px solid var(--line); }
.accordion details:last-child { border-bottom: 0; }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0;
  font-weight: 600; cursor: pointer; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .chev { color: var(--muted); transition: transform .2s var(--ease); }
.accordion details[open] summary .chev { transform: rotate(180deg); }
.accordion details > :not(summary) { margin: 0 0 14px; color: var(--text-2); }

/* ---------- Заглушки ---------- */
.skeleton { display: grid; gap: 12px; }
.sk {
  display: block; border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sk-shimmer 1.4s ease infinite;
}
.sk-title { height: 30px; width: 55%; }
.sk-hero { height: 150px; border-radius: var(--radius-lg); }
.sk-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sk-tile { height: 104px; border-radius: var(--radius-lg); }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.sk-circle { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 8px; }
.sk-line { height: 12px; width: 100%; }
.sk-line.short { width: 45%; }
.sk-card { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
@keyframes sk-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.empty-state { display: grid; justify-items: center; gap: 8px; padding: 36px 16px; text-align: center; }
.empty-icon { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.error-state .empty-icon { background: var(--danger-soft); color: var(--danger); }
.empty-title { font-size: 1.0625rem; font-weight: 650; }
.empty-text { color: var(--muted); max-width: 340px; margin: 0 0 8px; }

/* ---------- Тост ---------- */
.toast {
  position: fixed; z-index: 1000; left: 12px; right: 12px; margin: 0 auto; max-width: 480px;
  bottom: calc(16px + var(--safe-b));
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 16px;
  background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--shadow-lg); font-weight: 550; font-size: .9375rem;
  animation: toast-in .25s var(--ease); transition: bottom .2s var(--ease);
}
/* Тост при открытой шторке живёт внутри неё (ui.js → toast): над затемнением и сверху — не на кнопках шторки. */
:root dialog.sheet[open] > .toast { top: calc(12px + var(--safe-t)); bottom: auto; }
.toast-text { flex: 1 1 auto; }
.toast-success > .icon { color: #5fd39a; }
.toast-warning > .icon { color: #ffc46b; }
.toast-error > .icon { color: #ff8b7c; }
.toast-info > .icon { color: #8fd3ff; }
.toast-action { min-height: 36px; padding: 0 12px; background: transparent; color: #7fe3d5; border-radius: 10px; }
.toast-action:hover { background: rgb(255 255 255 / 10%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Шторки, окна, боковые панели (ui.js → openSheet) ---------- */
dialog.sheet {
  padding: 0; margin: 0; border: 0; background: transparent; color: var(--text);
  width: 100%; height: 100%; max-width: none; max-height: none;
}
dialog.sheet[open] { display: flex; }
dialog.sheet::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); animation: fade-in .2s; }
/* Свайп закрытия (gestures.js): фон бледнеет вслед за пальцем — ui.js ставит --sheet-drag на <dialog>. */
dialog.sheet::backdrop { opacity: calc(1 - var(--sheet-drag, 0)); }
.sheet-panel {
  position: relative; width: 100%; background: var(--surface); overflow-y: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 8px 20px; background: var(--surface);
}
.sheet-title { margin: 0; font-size: 1.1875rem; }
.sheet-body { padding: 4px 20px calc(20px + var(--safe-b)); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; position: relative; }
/* Ручку тянут пальцем — область касания шире самой полоски. */
.sheet-grip::after { content: ""; position: absolute; inset: -12px -60px -8px; }
.sheet-drawer .sheet-panel { touch-action: pan-y; } /* горизонтальный жест — свайп закрытия, вертикальный — прокрутка */
body.has-sheet { overflow: hidden; }

.sheet-sheet { align-items: flex-end; justify-content: center; }
.sheet-sheet .sheet-panel { max-width: 600px; max-height: 92dvh; border-radius: 24px 24px 0 0; animation: sheet-up .3s var(--ease); }
@media (min-width: 720px) {
  .sheet-sheet { align-items: center; padding: 24px; }
  .sheet-sheet .sheet-panel { border-radius: 24px; max-height: 86dvh; animation: pop-in .22s var(--ease); }
  .sheet-sheet .sheet-grip { display: none; }
}
.sheet-dialog { align-items: center; justify-content: center; padding: 16px; }
.sheet-dialog .sheet-panel { max-width: 440px; border-radius: 22px; animation: pop-in .2s var(--ease); }
.sheet-dialog .sheet-head { padding-top: 16px; }
.sheet-drawer { justify-content: flex-end; }
.sheet-drawer .sheet-panel { max-width: 580px; height: 100%; max-height: none; border-radius: 22px 0 0 22px; animation: drawer-in .28s var(--ease); }
.sheet-drawer .sheet-head { padding-top: 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
@media (max-width: 600px) { .sheet-drawer .sheet-panel { border-radius: 0; } }
.dialog-text { color: var(--text-2); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
@media (max-width: 480px) { .dialog-actions > * { flex: 1 1 0; } }
/* Липкая нижняя панель действий внутри шторки/панели. */
/* bottom: 0 — пока содержимое прокручивается, панель целиком видна у края шторки; отрицательные поля снизу лишь
   снимают нижний отступ шторки, когда прокрутка дошла до конца. */
.sheet-actions {
  position: sticky; bottom: 0; margin: 20px -20px calc(-20px - var(--safe-b));
  padding: 12px 20px calc(12px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Справка (ui.js → renderHelp) ---------- */
.help-article { display: grid; gap: 14px; color: var(--text-2); }
.help-article h3 { margin: 8px 0 -4px; color: var(--text); }
.help-article .lead { color: var(--text); }
.help-steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.help-steps li { counter-increment: step; position: relative; padding-left: 40px; min-height: 28px; }
.help-steps li::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: .875rem;
}
.terms { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 10px 16px; margin: 0; }
.terms dt { font-weight: 650; color: var(--text); }
.terms dd { margin: 0; }
@media (max-width: 480px) { .terms { grid-template-columns: 1fr; gap: 2px; } .terms dd { margin-bottom: 10px; } }
.help-related { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.help-related .field-label { width: 100%; }

/* ================================================================
   Оболочка кабинета гостя (index.html, app.js)
   ================================================================ */
body.guest { padding-bottom: calc(24px + var(--safe-b)); }
body.guest.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 16px + var(--safe-b)); }
body.guest.has-cartbar { padding-bottom: calc(var(--tabbar-h) + 88px + var(--safe-b)); }
/* Нижняя рамка кабинета: сколько снизу занимают нижнее меню и прилипшие к нему панели — плашка корзины, «Итого ·
   Оформить заказ», поле чата. Тост встаёт над рамкой, прокрутка к полю при фокусе её обходит. Состояния — классы на
   <html>: has-tabbar и has-cartbar ставит app.js (applyChrome, updateCart), has-checkoutbar и has-chatdock — по
   содержимому экрана (app.js → syncScreenChrome), высоту поля чата — --dock-h. */
html.guest { --chrome-b: var(--safe-b); scroll-padding-bottom: calc(var(--chrome-b) + 16px); }
html.guest.has-tabbar { --chrome-b: calc(var(--tabbar-h) + var(--safe-b)); }
html.guest.has-tabbar.has-cartbar { --chrome-b: calc(var(--tabbar-h) + 68px + var(--safe-b)); }
html.guest.has-tabbar.has-checkoutbar { --chrome-b: calc(var(--tabbar-h) + var(--checkout-h, 76px) + 8px + var(--safe-b)); }
html.guest.has-tabbar.has-chatdock { --chrome-b: calc(var(--tabbar-h) + var(--dock-h, 126px) + var(--safe-b)); }
/* Поле чата само прилипает над меню: его фокус не должен дополнительно прокручивать страницу.
   При оформлении нужен полный отступ — выросшая панель не закрывает последнее поле заказа. */
html.guest.has-tabbar.has-chatdock {
  scroll-padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
body.guest .toast { bottom: calc(var(--chrome-b) + 12px); }

.appbar {
  position: sticky; top: 0; z-index: 50; height: calc(var(--appbar-h) + var(--safe-t)); padding: var(--safe-t) 6px 0;
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); border-bottom: 1px solid transparent; transition: border-color .2s;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar-inner { max-width: calc(var(--page-w) + 12px); width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 4px; }
.appbar-start { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; }
.appbar-end { display: flex; align-items: center; gap: 2px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(140deg, var(--accent), #1d4f6e); color: #fff; font-size: .875rem; font-weight: 800;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.0625rem; }
.page-title { margin: 0; font-size: 1.0625rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; }
/* Внутренние экраны: крупный заголовок — в содержимом (h1), в верхней панели он появляется, когда h1 ушёл вверх. */
.appbar .page-title { opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s var(--ease); }
.appbar.scrolled .page-title { opacity: 1; transform: none; }
/* Заголовок экрана в содержимом: <header class="page-head"><h1>…</h1><p class="lead">…</p></header> */
.page-head { margin: 4px 0 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .lead { margin: 0; }
.icon-btn .badge { position: absolute; top: 3px; right: 1px; }

.tabbar {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 3px;
  color: var(--muted); font-size: .75rem; font-weight: 600; text-decoration: none;
}
.tab-icon { width: 60px; height: 30px; display: grid; place-items: center; border-radius: 15px; transition: background-color .2s; }
.tabbar a.active { color: var(--accent-text); }
.tabbar a.active .tab-icon { background: var(--accent-soft); }
.tabbar a.active .icon { stroke-width: 2.1; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 10px); }
@media (min-width: 760px) {
  .tabbar { left: 50%; right: auto; width: min(560px, 100% - 32px); transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); border: 1px solid var(--line); border-radius: 22px; height: var(--tabbar-h); padding: 0; box-shadow: var(--shadow); }
  /* Меню «парит» в 12 px от края — рамка выше на столько же; панели над ним — с зазором побольше. */
  html.guest.has-tabbar { --chrome-b: calc(var(--tabbar-h) + 12px + var(--safe-b)); }
  html.guest.has-tabbar.has-cartbar { --chrome-b: calc(var(--tabbar-h) + 80px + var(--safe-b)); }
  html.guest.has-tabbar.has-checkoutbar { --chrome-b: calc(var(--tabbar-h) + var(--checkout-h, 76px) + 20px + var(--safe-b)); }
  html.guest.has-tabbar.has-chatdock { --chrome-b: calc(var(--tabbar-h) + 24px + var(--dock-h, 126px) + var(--safe-b)); }
  html.guest.has-tabbar.has-chatdock {
    scroll-padding-bottom: calc(var(--tabbar-h) + 12px + var(--safe-b) + 16px);
  }
}

/* Плашка корзины над нижним меню: «3 позиции · 1 250 ₽ — Корзина →» */
.cartbar {
  position: fixed; z-index: 49; left: 12px; right: 12px; margin: 0 auto; max-width: calc(var(--page-w) - 24px);
  bottom: calc(var(--tabbar-h) + 10px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 10px 8px 16px; border-radius: 18px;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); text-decoration: none;
  animation: sheet-up .3s var(--ease);
}
.cartbar:hover { text-decoration: none; background: var(--accent-hover); }
.cartbar-info { flex: 1 1 auto; display: grid; line-height: 1.2; }
.cartbar-info strong { font-size: 1rem; }
.cartbar-info span { font-size: .8125rem; opacity: .85; }
.cartbar-go { display: inline-flex; align-items: center; gap: 4px; padding: 0 12px; min-height: 40px; border-radius: 12px; background: rgb(255 255 255 / 18%); font-weight: 700; }
@media (min-width: 760px) { .cartbar { bottom: calc(var(--tabbar-h) + 22px + var(--safe-b)); } }

/* Плитки разделов: <a class="tile" data-dept="spa"><span class="tile-icon">svg</span><strong>…</strong><span>…</span></a> */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  display: grid; align-content: start; gap: 4px; min-height: 120px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.tile:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow); }
.tile:active { transform: scale(.98); }
.tile-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--accent-soft); color: var(--accent-text);
}
.tile[data-dept] .tile-icon { background: color-mix(in srgb, var(--dept) 14%, var(--surface)); color: var(--dept); }
.tile strong { font-weight: 650; line-height: 1.25; }
.tile-sub { font-size: .8125rem; color: var(--muted); line-height: 1.3; }

/* Быстрые действия на главной: 4 круглые кнопки с подписями. */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a, .quick button {
  display: grid; justify-items: center; gap: 8px; min-height: 0; padding: 4px 0; background: none; border: 0;
  color: var(--text); font-size: .8125rem; font-weight: 600; text-align: center; line-height: 1.2; white-space: normal; text-decoration: none;
}
.quick a:hover, .quick button:hover { background: none; text-decoration: none; }
.quick-icon {
  width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent-text); box-shadow: var(--shadow-sm); transition: transform .15s var(--ease);
}
.quick a:active .quick-icon, .quick button:active .quick-icon { transform: scale(.94); }
.quick [data-dept] .quick-icon, .quick-icon[data-dept] { color: var(--dept); background: color-mix(in srgb, var(--dept) 10%, var(--surface)); border-color: transparent; }

/* Знакомство с кабинетом (app.js → maybeOnboard) */
.onboarding { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 8px 0 4px; }
.onboarding .lead { max-width: 380px; }
.onboarding .dialog-actions { width: 100%; }
.onb-art {
  width: 96px; height: 96px; border-radius: 30px; display: grid; place-items: center; margin-bottom: 8px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgb(255 255 255 / 22%) 0%, transparent 55%), linear-gradient(140deg, var(--accent), #1d4f6e);
  box-shadow: var(--shadow);
}
.onb-dots { display: flex; gap: 6px; margin: 8px 0 0; }
.onb-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--line-strong); transition: width .2s var(--ease), background-color .2s; }
.onb-dots span.on { width: 22px; background: var(--accent); }

/* Кабинет гостя — для пальца: чипы, счётчик и звёзды не меньше 44 px по касанию. */
body.guest .chip { min-height: var(--tap); }
body.guest .qty .icon-btn { width: 40px; height: 40px; }
body.guest .stars label { padding: 6px; }

/* ---------- Движение ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
