/* Мобильная вёрстка первична: ссылку открывают с телефона во встроенном
   браузере Telegram. */
:root {
  --bg: #fbfaf8;
  --card: #ffffff;
  --ink: #1a1a19;
  --muted: #6b6a66;
  --line: #e3e0da;
  --accent: #2f6f4f;
  --accent-ink: #ffffff;
  --danger: #a2392b;
  --bad-bg: #fdf3f1;
  --ok-bg: #eef6f1;
  --mine: #2f5aa8;
  --mine-bg: #eef2fb;
  --mine-ink: #ffffff;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --card: #1e2024;
    --ink: #e9e7e3;
    --muted: #9a978f;
    --line: #32353b;
    --accent: #6fbf90;
    --accent-ink: #12251a;
    --danger: #e08476;
    --bad-bg: #2c2020;
    --ok-bg: #1d2a22;
    --mine: #8fb4f0;
    --mine-bg: #1c2331;
    --mine-ink: #131b28;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.narrow { max-width: 520px; }

h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 20px 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.dim { opacity: 0.5; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.calendar-topbar {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px; margin-bottom: 18px;
}
.calendar-topbar > :first-child { justify-self: start; }
.calendar-topbar h1 { margin: 0; text-align: center; }
@media (max-width: 600px) {
  .calendar-topbar { grid-template-columns: auto 1fr; }
  .calendar-topbar h1 { justify-self: end; font-size: 26px; }
  .calendar-topbar > :last-child { display: none; }
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.primary-link-card {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
}
.primary-link-card h2 { font-size: 21px; }
.booking-link-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card);
}
.booking-type + .booking-type { margin-top: 10px; }
.booking-link-copy { flex: 1 1 auto; min-width: 0; }
.booking-link-copy .fieldname { margin-bottom: 2px; font-size: 13px; }
/* Ссылка здесь — главный предмет карточки, а не сноска в тексте: подчёркивание
   и «ссылочный» цвет делали её мельче, чем она есть. */
.booking-link-url {
  display: block; overflow-wrap: anywhere; text-decoration: none;
  color: var(--ink); font-weight: 600; font-size: 17px; line-height: 1.35;
}
.booking-link-url:hover { color: var(--accent); text-decoration: underline; }
.copy-booking { flex: 0 0 auto; }
.booking-settings {
  margin: -1px 8px 0;
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--card);
}
.booking-settings > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; color: var(--ink); font-weight: 600;
  list-style: none;
}
.booking-settings > summary::-webkit-details-marker { display: none; }
.booking-settings > summary:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.booking-settings[open] > summary { border-bottom: 1px solid var(--line); }
/* Стрелка вместо системного маркера: без неё строка читалась как заголовок,
   на который незачем нажимать. */
.booking-settings-name::before {
  content: "›"; display: inline-block; width: 14px;
  color: var(--muted); font-weight: 400;
  transition: transform 120ms ease-out;
}
.booking-settings[open] .booking-settings-name::before { transform: rotate(90deg); }
.booking-settings .badge { margin-left: auto; }
@media (prefers-reduced-motion: reduce) {
  .booking-settings-name::before { transition: none; }
}
.booking-settings > form { padding: 14px 12px 16px; }
@media (max-width: 520px) {
  .booking-link-row { align-items: stretch; flex-direction: column; }
  .copy-booking { width: 100%; }
  .booking-settings > summary { align-items: flex-start; flex-direction: column; }
}

.flash { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); }
.flash.error { background: var(--bad-bg); color: var(--danger); }
.empty { color: var(--muted); padding: 14px 0; }
.err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.hint { display: block; color: var(--muted); font-size: 12px; }
.badge {
  background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted);
  border-radius: 20px; padding: 3px 10px; font-size: 13px; white-space: nowrap;
}

label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: auto; margin: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }

/* Высоту задаём строкой, а не только min-height: иначе кнопка с мелким
   шрифтом («Отменить», 14px) оказывалась на два пикселя ниже соседей. */
button {
  font: inherit; font-weight: 500; line-height: 24px; cursor: pointer;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  min-height: 44px; /* палец, а не курсор */
}
/* Заливка делает кнопку крупнее на вид при той же геометрии, поэтому светлые
   кнопки — не прозрачные дыры, а такие же плашки, только тише. */
button.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
button.ghost:hover { border-color: var(--muted); }
button.danger { color: var(--danger); }
form { margin: 0; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.row .grow { flex: 1 1 240px; }
.row input { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.grid .full-grid { grid-column: 1 / -1; }
.full { display: block; }

table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
/* Заметка гостя или контакт тоже могут оказаться сплошной строкой без
   пробелов. Без переноса такая ячейка растягивает таблицу за край экрана. */
td { overflow-wrap: anywhere; }
tr.bad td { background: var(--bad-bg); }
/* Шесть колонок не влезают в телефон. Пусть прокручивается сама таблица:
   иначе за край экрана уезжает вся страница, а вместе с ней и кнопки. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap table { min-width: 480px; }
/* В узкой колонке «Удалить» переносилось по буквам и растягивало строку. */
td button { white-space: nowrap; }

.days { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.day { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.day label { margin-bottom: 8px; }
.day input[type=time] { margin-bottom: 6px; }

/* --- страница гостя --- */
.guest-head { margin-bottom: 18px; }
.guest-head h1 { margin-bottom: 12px; }
.event-title { margin: 0 0 2px; font-size: 18px; font-weight: 600; }
.guest-head .meta { color: var(--muted); font-size: 14px; }
.owner-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.owner-profile p { margin: 0; }
.owner-copy { min-width: 0; }
.owner-name { color: var(--ink); font-weight: 600; }
.owner-bio {
  margin-top: 2px !important; color: var(--muted); font-size: 14px;
  line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere;
}
.avatar {
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; background: var(--line); color: var(--muted);
  border: 1px solid var(--line);
}
.avatar-guest { width: 64px; height: 64px; }
.avatar-admin { width: 72px; height: 72px; font-size: 28px; font-weight: 600; }
.avatar-placeholder { text-transform: uppercase; }
.profile-editor { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.profile-photo { flex: 1 1 auto; min-width: 0; }
.profile-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
/* Системное поле выбора файла показывать нечего: его открывает кнопка
   «Загрузить». Убираем с глаз, но оставляем в потоке — иначе до него не
   доберётся ни клавиатура, ни программа чтения с экрана. */
.filefield {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.filefield:focus-visible + .hint { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Удаление фото — не мгновенное действие, а пометка: она снимается тем же
   нажатием и вступает в силу вместе с остальной формой. */
.removephoto { position: relative; }
.removephoto input { position: absolute; opacity: 0; pointer-events: none; }
.removephoto .removephoto-on { display: none; }
.removephoto:has(input:checked) {
  background: var(--bad-bg); border-color: var(--danger); color: var(--danger);
}
.removephoto:has(input:checked) .removephoto-off { display: none; }
.removephoto:has(input:checked) .removephoto-on { display: inline; }
.removephoto:has(input:focus-visible) { outline: 2px solid var(--danger); outline-offset: 2px; }
.profile-editor:has(.removephoto input:checked) .avatar { opacity: 0.35; }
body.cropper-open { overflow: hidden; }
.cropper-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.68);
}
.cropper-card {
  width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 18px; border-radius: 14px; background: var(--card); color: var(--ink);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.35);
}
.crop-frame {
  position: relative; width: min(320px, 78vw); aspect-ratio: 1;
  margin: 12px auto; overflow: hidden; background: #111; touch-action: none;
}
.crop-frame canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.crop-frame canvas:active { cursor: grabbing; }
.crop-frame::after {
  content: ""; position: absolute; inset: 1px; pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.95); border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.52);
}
.crop-zoom { margin: 12px 0; }
.crop-actions { justify-content: flex-end; }
.tzrow { margin-bottom: 18px; }
.dayhead { font-size: 15px; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
button.slot { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
button.slot:hover { border-color: var(--accent); color: var(--accent); }
.chosen { font-size: 17px; }
dl { margin: 0; font-size: 14px; }
dt { color: var(--muted); font-size: 13px; margin-top: 10px; }
dd { margin: 2px 0 0; }

/* ссылка, выглядящая как кнопка */
a.btn, label.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 16px; border-radius: 8px; line-height: 24px;
  border: 1px solid transparent; background: var(--accent);
  color: var(--accent-ink); text-decoration: none; font-weight: 500;
  cursor: pointer;
}
a.btn.ghost, label.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
a.btn.ghost:hover, label.btn.ghost:hover { border-color: var(--muted); }
label.btn.danger { color: var(--danger); }

/* --- модальные окна --- */
/* Нативный <dialog>: Esc, ловушка фокуса и подложка достаются от браузера. */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86svh, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.45); }
/* Колонка: шапка и кнопки закреплены, прокручивается только середина. Иначе
   в невысоком окне заголовок и «Добавить» уезжают за край и непонятно, куда
   нажимать. */
dialog.modal > form {
  display: flex; flex-direction: column;
  max-height: inherit;
  padding: 0;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 20px 4px; overflow-y: auto; flex: 1 1 auto; }
button.icon {
  min-height: 0; padding: 2px 10px; line-height: 1.1;
  font-size: 20px; border-radius: 6px;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--card);
  flex: none;
}
/* Кнопка, которая должна читаться как ссылка: в пустом состоянии призыв
   стоит внутри предложения, и рамка кнопки там выглядела бы чужеродно. */
button.linklike {
  background: none; border: none; padding: 0; min-height: 0;
  color: var(--accent); font: inherit; text-decoration: underline;
  cursor: pointer;
}

ul.links { list-style: none; padding: 0; margin: 0 0 14px; }
ul.links li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.links li:last-child { border-bottom: none; }
.provider-help-shot { margin-top: 6px; }
.provider-help-shot summary {
  cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500;
}
.provider-help-shot p { margin: 8px 0; }
.provider-help-shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
ul.links a { font-weight: 500; margin-right: 8px; white-space: nowrap; }

/* --- недельная сетка --- */
.weekbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.weekbar .btn { min-height: 38px; padding: 6px 14px; }
.weekrange { flex: 1 1 auto; }
.weekrange span { display: block; }
.weekbar select { width: auto; margin: 0; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legenditem { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.key.free { background: var(--ok-bg); border: 1.5px solid var(--accent); }
.key.busy { background: var(--line); border: 1px solid var(--muted); }
.key.booking { background: var(--accent); }

.week {
  display: grid;
  grid-template-columns: 46px repeat(7, minmax(84px, 1fr));
  gap: 0;
  margin: 14px 0 18px;
  overflow-x: auto;       /* на телефоне неделя прокручивается вбок */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
/* колонка часов остаётся на месте при горизонтальной прокрутке недели */
.hours {
  position: sticky; left: 0; z-index: 5;
  height: 620px; margin-top: 30px;
  border-right: 1px solid var(--line); background: var(--card);
}
.hours::before {
  content: ""; position: absolute; left: 0; right: 0; top: -30px; height: 30px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.hourmark {
  position: absolute; right: 6px; z-index: 1; transform: translateY(-50%);
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.daycol { border-right: 1px solid var(--line); }
.daycol:last-child { border-right: none; }
.daycol.today { background: var(--ok-bg); }
.dayname {
  height: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--line);
}
.daycol.today .dayname { color: var(--accent); }
.track { position: relative; height: 620px; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); opacity: 0.5; }

.ev {
  position: absolute; left: 2px; right: 2px;
  border-radius: 4px; padding: 1px 4px; overflow: hidden;
  font-size: 10px; line-height: 1.25;
}
.ev b { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.ev span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.free { background: var(--ok-bg); border: 1px solid var(--accent); color: var(--accent); }
.ev.busy { background: var(--line); color: var(--ink); opacity: 0.85; z-index: 2; }
.ev.booking { background: var(--accent); color: var(--accent-ink); z-index: 3; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 12px; color: var(--muted); white-space: nowrap;
}

/* --- выбор длительности и навигация по дням --- */
.field { margin-bottom: 16px; }
.fieldname { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 20px; min-height: 40px;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.daystrip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
  margin-bottom: 4px; -webkit-overflow-scrolling: touch;
}
.daychip {
  flex: 0 0 auto; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; min-height: 46px; line-height: 1.2;
}
.daychip b { display: block; font-size: 12px; font-weight: 600; }
.daychip span { display: block; font-size: 11px; color: var(--muted); }
.daychip:hover { border-color: var(--accent); }

/* --- переключатель вида и месячная сетка --- */
.viewtoggle { display: flex; gap: 0; margin-bottom: 16px; }
.viewtoggle button {
  flex: 1 1 50%; background: var(--card); color: var(--muted);
  border: 1px solid var(--line); border-radius: 0; min-height: 40px;
  font-size: 14px;
}
.viewtoggle button:first-child { border-radius: 8px 0 0 8px; }
.viewtoggle button:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.viewtoggle button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.calhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.calhead strong { font-size: 16px; }
.calhead button { min-height: 38px; padding: 6px 16px; }
.calhead button:disabled { opacity: 0.35; cursor: default; }

.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 18px; }
.calname { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.calday {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; min-height: 46px; padding: 4px 2px; line-height: 1.1;
}
.calday b { display: block; font-size: 14px; font-weight: 500; }
.calday span { display: block; font-size: 10px; color: var(--accent); min-height: 12px; }
.calday:not(.off):not(.on) { border-color: var(--accent); background: var(--ok-bg); }
.calday.off { opacity: 0.35; background: transparent; }
.calday.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.calday.on span { color: var(--accent-ink); }

/* --- недельная сетка на странице гостя --- */
.guestweek {
  /* Публичный календарь занимает ширину страницы целиком. Колонки сжимаются
     вместе с экраном, поэтому внутри календаря больше нет отдельной
     горизонтальной прокрутки. */
  grid-template-columns: 46px repeat(var(--visible-days, 7), minmax(0, 1fr));
  margin: 0 0 10px;
  overflow-x: visible;
}
.guestweek .hours, .guestweek .track { height: 520px; }
.guestweek .dayname { font-size: 11px; }
/* Свободное время — область, а не россыпь кнопок. Пока гость не указал место,
   ему незачем видеть все возможные начала встречи: их десятки, и каждое из них
   ничего не значит само по себе. */
.freezone {
  position: absolute; left: 2px; right: 2px;
  border-radius: 6px; overflow: hidden; cursor: pointer;
  background: var(--ok-bg);
  border: 1px dashed var(--accent);
}
.freezone:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.zonelabel {
  position: absolute; left: 5px; right: 5px; top: 2px; pointer-events: none;
  font-size: 10px; line-height: 1.2; color: var(--accent);
  font-variant-numeric: tabular-nums; opacity: 0.8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.freezone.on .zonelabel { opacity: 0.35; }
/* Призрак будущей встречи: показывает не точку, а кусок времени, который она
   займёт, и ездит за курсором, прилипая к разрешённым началам. */
.slotghost {
  position: absolute; left: 0; right: 0; min-height: 18px;
  display: none; align-items: center; gap: 4px;
  padding: 1px 5px; border-radius: 5px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 10px; line-height: 1.2; pointer-events: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  transition: top 90ms ease-out, height 90ms ease-out;
}
.freezone.on .slotghost { display: flex; }
.slotghost b { font-weight: 600; font-variant-numeric: tabular-nums; }
.slotghost span { opacity: 0.75; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .slotghost { transition: none; } }

.mobile-continue {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.14);
}
.mobile-choice { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.mobile-choice span { display: block; color: var(--muted); font-size: 11px; }
.mobile-choice strong {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.mobile-continue button { flex: 0 0 auto; }

/* --- страница гостя: календарь использует всю доступную ширину --- */
.wrap.guest { max-width: 1400px; }
@media (min-width: 900px) {
  .wrap.guest { padding-top: 32px; }
  .wrap.guest .guest-head { max-width: 720px; }
  .wrap.guest h1 { font-size: 32px; }
  .guestweek { grid-template-columns: 58px repeat(var(--visible-days, 7), minmax(0, 1fr)); }
  .guestweek .hours, .guestweek .track { height: 660px; }
  .guestweek .dayname { height: 36px; font-size: 13px; }
  .guestweek .hours { margin-top: 36px; }
  .guestweek .hours::before { top: -36px; height: 36px; }
  .zonelabel, .slotghost { font-size: 12px; }
  .slotghost { min-height: 22px; }
  .calgrid { gap: 6px; }
  .calday { min-height: 62px; }
  .calday b { font-size: 16px; }
  .calname { font-size: 13px; }
  #listview, .viewtoggle, .field { max-width: 720px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); max-width: 720px; }
}

/* форма записи остаётся узкой в любом случае — это короткая анкета */
.formcard { max-width: 520px; }
.backlink {
  background: none; border: none; padding: 0 0 10px; min-height: 0;
  color: var(--accent); font-size: 14px; font-weight: 500;
}
.backlink:hover { text-decoration: underline; }
.formcard button[type=submit] { width: 100%; }

details.howto { margin: 10px 0 14px; font-size: 14px; }
details.howto summary { cursor: pointer; color: var(--accent); }
details.howto ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
details.howto li { margin-bottom: 6px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
       background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.center{text-align:center}.btn.yandex{width:100%;justify-content:center;border-color:#f2c500;color:#272631;background:#ffcc00;font-weight:700}.btn.yandex:hover{background:#ffd633}

/* --- свои записи гостя ---
   Гость не заводит аккаунт, поэтому свои встречи он узнаёт по цвету: зелёное —
   то, что можно занять, синее — то, что он уже занял. Нажатие ведёт в карточку
   встречи, где её видно целиком и откуда её можно отменить. */
.my-bookings { margin: 0 0 18px; }
.my-bookings h2 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.my-booking {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  padding: 10px 12px; margin-bottom: 8px; text-decoration: none;
  border: 1px solid var(--mine); border-left-width: 4px;
  border-radius: var(--radius); background: var(--mine-bg); color: var(--ink);
}
.my-booking:hover { border-color: var(--mine); filter: brightness(0.98); }
.my-booking-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.my-booking-title { color: var(--muted); font-size: 14px; }
.my-booking-open { margin-left: auto; color: var(--mine); font-size: 13px; white-space: nowrap; }

.my-booking-row {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px;
  padding: 8px 10px; text-decoration: none; border-radius: 8px;
  background: var(--mine-bg); border: 1px solid var(--mine); color: var(--ink);
}
.my-booking-row b { font-variant-numeric: tabular-nums; }
.my-booking-row span { margin-left: auto; color: var(--mine); font-size: 13px; }

.daychip.mine { border-color: var(--mine); background: var(--mine-bg); }
.calday.mine { border-color: var(--mine); background: var(--mine-bg); }
/* День со своей встречей и без свободного времени — не пустой: гасить его
   нельзя, иначе встреча пропадёт вместе с днём. */
.calday.off.mine { opacity: 1; }
.calday.on.mine { background: var(--accent); border-color: var(--mine); }

/* В недельной сетке своя встреча стоит ровно там, где в свободном времени
   образовалась дырка, — блоком, а не пунктиром: выбирать здесь уже нечего. */
.mybooking {
  position: absolute; left: 2px; right: 2px; z-index: 2;
  display: flex; align-items: center; gap: 4px; min-height: 18px;
  overflow: hidden; padding: 1px 5px; border-radius: 6px;
  text-decoration: none; background: var(--mine); color: var(--mine-ink);
  font-size: 10px; line-height: 1.2;
}
.mybooking b { font-weight: 600; font-variant-numeric: tabular-nums; }
.mybooking span { opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mybooking:focus-visible { outline: 2px solid var(--mine); outline-offset: 1px; }

/* --- записи в кабинете ---
   Раньше это была таблица на шесть колонок. Имя, заметка гостя и ссылка на
   звонок — тексты произвольной длины: в узких колонках они рвались по слогам
   («подтвер / ждена»), а колонка с часовым поясом хозяина повторяла на каждой
   строке одно и то же. */
.bookings { list-style: none; margin: 0; padding: 0; }
.booking-card {
  padding: 12px 0; border-top: 1px solid var(--line);
}
.booking-card:first-child { border-top: 0; padding-top: 0; }
.booking-card p { margin: 4px 0 0; }
.booking-card-top {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
}
.booking-card-when { flex: 1 1 auto; min-width: 0; }
.booking-card-when b { font-size: 17px; font-variant-numeric: tabular-nums; }
.booking-card-when span { color: var(--muted); font-variant-numeric: tabular-nums; }
.booking-card-type { margin-left: 8px; font-size: 13px; }
.booking-card-when .booking-card-type::before { content: "· "; }
.booking-card-who { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.booking-card-contact { color: var(--muted); overflow-wrap: anywhere; }
.booking-card-note { color: var(--ink); overflow-wrap: anywhere; }
.booking-card .ghost.danger { min-height: 38px; padding: 6px 14px; font-size: 14px; }
/* Статус — слово, а не колонка: пусть занимает ровно себя и не переносится. */
.booking-status {
  display: inline-block; border-radius: 20px; padding: 3px 10px;
  font-size: 13px; white-space: nowrap;
}
.booking-status.ok { background: var(--ok-bg); color: var(--accent); }
.booking-status.off { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted); }
