/* Виджет бронирования /embed/<pk> (2.1, ТЗ §14.1). Своя таблица, без кабинетных стилей: страница живёт в iframe на
   чужом сайте. Оформление арендатора — --ub-accent и --ub-radius из адреса (routes/embed.ts, белый список).
   Фон прозрачный: виджет ложится на фон сайта; тёмная тема — theme=dark|auto. Шрифт — системный (без загрузки) или
   font=onest|golos (файлы сервиса; браузер грузит шрифт, только если он выбран). */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/onest-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/onest-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2116, U+2212; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/static/fonts/golos-text-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(/static/fonts/golos-text-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2116, U+2212; }
:root {
  color-scheme: light;
  --ub-bg: #fff; --ub-text: #1b1f1d; --ub-muted: #5d655f; --ub-line: #d9ddd9; --ub-soft: #f3f5f2;
  --ub-busy: #9aa19c; --ub-err: #b3261e; --ub-err-soft: #fbeceb; --ub-warn-soft: #fbf3dc; --ub-ok-soft: #e8f3ec;
  --ub-on-accent: #fff;
  --ub-font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-font="onest"] { --ub-font: "Onest", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
:root[data-font="golos"] { --ub-font: "Golos Text", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --ub-bg: #1c211e; --ub-text: #eef1ee; --ub-muted: #a5ada7; --ub-line: #3a423d; --ub-soft: #252b27;
  --ub-busy: #6f7771; --ub-err: #ff8a80; --ub-err-soft: #3b2220; --ub-warn-soft: #3a3320; --ub-ok-soft: #1f3026;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --ub-bg: #1c211e; --ub-text: #eef1ee; --ub-muted: #a5ada7; --ub-line: #3a423d; --ub-soft: #252b27;
    --ub-busy: #6f7771; --ub-err: #ff8a80; --ub-err-soft: #3b2220; --ub-warn-soft: #3a3320; --ub-ok-soft: #1f3026;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { background: transparent; }
body { margin: 0; font: 16px/1.45 var(--ub-font); color: var(--ub-text); background: transparent; -webkit-text-size-adjust: 100%; }
.ub { max-width: 760px; margin: 0 auto; padding: 8px 2px 16px; counter-reset: ub-step; }
.ub h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; }
/* номера шагов: даты — 1, гости — 2… (видимые разделы по порядку; итог и сообщения без номера) */
.ub-sec:not(.ub-off):not(.ub-result) > h2::before { counter-increment: ub-step; content: counter(ub-step); flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--ub-accent) 14%, transparent); color: var(--ub-accent); font-size: 14px; font-weight: 700; }
.ub h3 { font-size: 16px; margin: 0 0 4px; }
.ub p { margin: 0 0 8px; }
.ub a { color: var(--ub-accent); }
.ub-loading, .ub-note { color: var(--ub-muted); }
.ub-sec { background: var(--ub-bg); border: 1px solid color-mix(in srgb, var(--ub-line) 75%, transparent); border-radius: calc(var(--ub-radius) * 1.5); padding: 18px 16px; margin: 0 0 12px; box-shadow: 0 1px 2px rgba(20, 24, 22, .04); }
.ub-sec[hidden] { display: none; }
.ub-hint { color: var(--ub-muted); font-size: 14px; }
.ub-msg { padding: 10px 12px; border-radius: calc(var(--ub-radius) - 4px); margin: 0 0 12px; background: var(--ub-soft); }
.ub-msg.err { background: var(--ub-err-soft); color: var(--ub-err); }
.ub-msg.warn { background: var(--ub-warn-soft); }
.ub-msg.ok { background: var(--ub-ok-soft); }
.ub-msg[hidden] { display: none; }
.ub-off a { font-weight: 600; }

/* кнопки и поля: касание не меньше 44 px */
/* сброс — без веса (:where): иначе .ub button перебивал цвет текста .ub-btn, и на кнопке был тёмный текст по акценту */
:where(.ub) button, :where(.ub) input, :where(.ub) select, :where(.ub) textarea { font: inherit; color: inherit; }
.ub-btn { min-height: 48px; padding: 10px 18px; border: 0; border-radius: var(--ub-radius); background: var(--ub-accent); color: var(--ub-on-accent); font-weight: 600; cursor: pointer; width: 100%; }
.ub-btn[disabled] { opacity: .55; cursor: default; }
.ub-btn + .ub-hint { margin-top: 10px; }
.ub-btn.line { background: transparent; color: var(--ub-accent); border: 1px solid var(--ub-accent); }
.ub :focus-visible { outline: 3px solid var(--ub-accent); outline-offset: 2px; }
.ub-field { display: block; margin: 0 0 12px; }
.ub-field > span { display: block; font-size: 14px; color: var(--ub-muted); margin: 0 0 4px; }
.ub-field input[type=text], .ub-field input[type=tel], .ub-field input[type=email], .ub-field input[type=date], .ub-field select, .ub-field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--ub-line); border-radius: calc(var(--ub-radius) - 4px); background: var(--ub-bg);
}
.ub-field textarea { min-height: 84px; resize: vertical; }
.ub-field.bad input, .ub-field.bad select, .ub-field.bad textarea { border-color: var(--ub-err); }
.ub-field .ub-ferr { display: none; color: var(--ub-err); font-size: 14px; margin-top: 4px; }
.ub-field.bad .ub-ferr { display: block; }
.ub-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ub-check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.ub-check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--ub-accent); }
.ub-check.bad { color: var(--ub-err); }
.ub-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .ub-grid { grid-template-columns: 1fr; } }

/* календарь */
.ub-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.ub-cal-nav { width: 44px; height: 44px; border: 1px solid var(--ub-line); border-radius: 50%; background: var(--ub-bg); cursor: pointer; font-size: 20px; line-height: 1; }
.ub-cal-nav[disabled] { opacity: .35; cursor: default; }
.ub-months { display: grid; gap: 16px; grid-template-columns: 1fr; }
.ub-months.two { grid-template-columns: 1fr 1fr; }
.ub-month h3 { text-align: center; text-transform: capitalize; margin: 0 0 6px; }
.ub-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ub-dow { text-align: center; font-size: 12px; color: var(--ub-muted); padding: 2px 0; }
.ub-day { min-height: 44px; padding: 2px 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.ub-day b { font-weight: 600; font-size: 15px; }
.ub-day small { font-size: 10px; color: var(--ub-muted); }
.ub-day.we b { color: var(--ub-accent); }
.ub-day[disabled] { cursor: default; color: var(--ub-busy); }
.ub-day[disabled] b { font-weight: 400; }
.ub-day.busy b { text-decoration: line-through; }
.ub-day.in { background: color-mix(in srgb, var(--ub-accent) 16%, transparent); border-radius: 0; }
.ub-day.s, .ub-day.e { background: var(--ub-accent); color: var(--ub-on-accent); }
.ub-day.s b, .ub-day.e b, .ub-day.s small, .ub-day.e small { color: var(--ub-on-accent); }
.ub-day.s { border-radius: 10px 0 0 10px; }
.ub-day.e { border-radius: 0 10px 10px 0; }
.ub-day.s.e { border-radius: 10px; }
.ub-day:not([disabled]):not(.s):not(.e):not(.in):hover { background: var(--ub-soft); }
.ub-pad { visibility: hidden; }
.ub-range { margin: 10px 0 0; font-weight: 600; }

/* счётчики гостей */
.ub-step { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--ub-line); }
.ub-step + .ub-hint { margin-top: 10px; }
.ub-step:last-child { border-bottom: 0; }
.ub-step small { display: block; color: var(--ub-muted); }
.ub-step div.ctl { display: flex; align-items: center; gap: 8px; }
.ub-step button { width: 44px; height: 44px; border: 1px solid var(--ub-line); border-radius: 50%; background: var(--ub-bg); font-size: 22px; line-height: 1; cursor: pointer; }
.ub-step button[disabled] { opacity: .35; cursor: default; }
.ub-step output { min-width: 28px; text-align: center; font-weight: 600; }

/* карточки выбора: размещение и тариф */
.ub-opts { display: grid; gap: 10px; }
.ub-opt { display: block; border: 2px solid var(--ub-line); border-radius: var(--ub-radius); background: var(--ub-bg); overflow: hidden; cursor: pointer; text-align: left; width: 100%; padding: 0; }
.ub-opt[aria-checked=true] { border-color: var(--ub-accent); }
.ub-opt[disabled] { opacity: .6; cursor: default; }
/* height: auto — иначе атрибут height (размер файла) перебивает рамку 16:9 и вертикальное фото вытягивается в полосу */
.ub-opt img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--ub-soft); }
.ub-opt .body { padding: 12px 14px; display: grid; gap: 4px; }
.ub-opt .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ub-opt .price { font-weight: 700; white-space: nowrap; }
.ub-opt ul { margin: 4px 0 0; padding-left: 18px; color: var(--ub-muted); font-size: 14px; }
.ub-opts.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .ub-opts.two { grid-template-columns: 1fr; } }
.ub-opts.two .ub-opt .body { padding: 16px; }

/* путь «по датам / по размещению» после выбора — переключатель в одну строку (embed.js renderHow) */
.ub-how.mini { padding: 6px; }
.ub-seg { display: flex; gap: 4px; }
.ub-seg button { flex: 1; min-height: 44px; padding: 8px 10px; border: 0; border-radius: var(--ub-radius); background: transparent; color: var(--ub-muted); font-weight: 600; cursor: pointer; }
.ub-seg button[aria-pressed=true] { background: color-mix(in srgb, var(--ub-accent) 14%, transparent); color: var(--ub-text); }
.ub-seg button:not([aria-pressed=true]):hover { background: var(--ub-soft); }
.ub-choice { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0 0; }
.ub-choice label { display: flex; align-items: center; gap: 6px; min-height: 36px; }

/* услуги */
.ub-extra { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--ub-line); }
.ub-extra:last-child { border-bottom: 0; }
.ub-extra .t { display: grid; }
.ub-extra .p { color: var(--ub-muted); font-size: 14px; }
.ub-extra.off { opacity: .55; }

/* итог */
.ub-lines { margin: 0; padding: 0; list-style: none; }
.ub-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--ub-line); }
.ub-lines li.deal { color: var(--ub-accent); }
.ub-lines li.info { color: var(--ub-muted); }
.ub-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 22px; font-weight: 700; margin: 10px 0 2px; }
.ub-total.pending { opacity: .55; }
.ub-result h2 { font-size: 22px; }
.ub-result .num { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.ub-result .ub-btn { display: block; text-align: center; text-decoration: none; margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) { .ub-day, .ub-opt { transition: background-color .12s, border-color .12s; } }

/* Страница виджета открыта сама по себе, не в iframe (ссылка «Забронировать» из бота, ссылка и QR-код): фон страницы,
   поля по краям и шапка с фото и названием объекта (embed.js, soloHead). В iframe на сайте всего этого нет. */
:root.ub-solo { --ub-page: #f5f4f0; }
:root.ub-solo[data-theme="dark"] { --ub-page: #121513; }
@media (prefers-color-scheme: dark) { :root.ub-solo[data-theme="auto"] { --ub-page: #121513; } }
:root.ub-solo, :root.ub-solo body { background: var(--ub-page); }
.ub-solo .ub { max-width: 640px; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.ub-head { margin: 0 0 14px; border-radius: calc(var(--ub-radius) * 1.5); overflow: hidden; background: var(--ub-bg); box-shadow: 0 1px 2px rgba(20, 24, 22, .05), 0 8px 24px rgba(20, 24, 22, .06); }
.ub-head img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; max-height: 260px; object-fit: cover; background: var(--ub-soft); }
.ub-head .in { padding: 14px 16px 16px; }
.ub-head h1 { font-size: 22px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; }
.ub-head p { margin: 0; color: var(--ub-muted); font-size: 14px; }
.ub-head .facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.ub-head .facts li { padding: 4px 10px; border-radius: 999px; background: var(--ub-soft); font-size: 13px; }
