/* База отдыха «На краю земли» — модуль бронирования.
   Собственные стили. Ни одной внешней ссылки: шрифт лежит локально,
   иконки нарисованы SVG прямо здесь.

   Принцип оформления: светлый лист. Глубина задаётся границей в 1px
   и белой карточкой на светло-сером фоне, а не тенями и заливками. */

@import url('/static/fonts/manrope.css');

:root {
  --bg: #FBFAF8;
  --surface: #FFFFFF;
  --ink: #1E211C;
  --muted: #6E736B;
  --line: #E8E6E1;
  --accent: #3F6B52;
  --accent-dark: #355944;
  --accent-soft: #EFF4F0;
  --danger: #A6402F;
  --danger-soft: #FBF1EF;
  --ok: #3F6B52;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 33, 28, .04);

  --gap-block: 48px;   /* между смысловыми блоками */
  --gap-card: 24px;    /* внутри карточки */
  --gap-field: 16px;   /* между элементами формы */
  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  /* Ничего не должно уезжать за край на узких экранах. */
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { margin: 0 0 16px; font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 19px; letter-spacing: -.01em; }
p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1560px; margin: 0 auto; padding: 0 24px; }

.lead { font-size: 19px; color: var(--muted); line-height: 1.55; max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 6px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.req { color: var(--danger); }

.mt { margin-top: var(--gap-field); }
.mb { margin-bottom: var(--gap-field); }
.block { margin-bottom: var(--gap-block); }
.block:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--gap-card) 0; }

/* ---------- Шапка ---------- */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 68px; flex-wrap: wrap; padding: 12px 24px;
}
.brand {
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
  line-height: 1.25;
}
.brand small {
  display: block; font-size: 12px; font-weight: 500; color: var(--muted);
  letter-spacing: 0;
}
.brand:hover { color: var(--ink); }
.top nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a {
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; color: var(--muted);
}
.top nav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.top nav a.on { color: var(--accent); font-weight: 700; }

main { padding: 40px 0 72px; }

/* ---------- Подвал ---------- */
.foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 32px 0;
  font-size: 14px;
  color: var(--muted);
}
.foot .wrap { display: flex; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.foot b { color: var(--ink); font-weight: 700; display: block; margin-bottom: 4px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--gap-card);
  margin-bottom: var(--gap-card);
}
.card:last-child { margin-bottom: 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--gap-field); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap-card); }

/* ---------- Полоса шагов ---------- */
.steps {
  display: flex; align-items: center; gap: 0;
  list-style: none; margin: 0 0 var(--gap-block); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.steps li {
  flex: 1 1 0; display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; font-size: 14px; font-weight: 500; color: var(--muted);
  border-right: 1px solid var(--line); min-width: 0;
}
.steps li:last-child { border-right: 0; }
.steps .n {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
}
.steps .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps li.done { color: var(--accent); }
.steps li.done .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.now { color: var(--ink); font-weight: 700; background: var(--accent-soft); }
.steps li.now .n { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit; font-size: 15px; font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn.off {
  background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed;
}
.btn[disabled]:hover, .btn.off:hover { background: var(--line); border-color: var(--line); color: var(--muted); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.btn.warn { background: var(--danger); border-color: var(--danger); }
.btn.warn:hover { background: #8f3627; border-color: #8f3627; }
.btn.full { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 14px; }
.btn.tiny { padding: 5px 10px; font-size: 13px; font-weight: 500; border-radius: 8px; }
.btn.link {
  background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500;
}
.btn.link:hover { background: none; color: var(--accent-dark); text-decoration: underline; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; min-width: 0; }
.field + .field { margin-top: var(--gap-field); }

label { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }

input[type=text], input[type=date], input[type=number], input[type=email],
input[type=tel], input[type=password], input[type=search], input[type=time],
select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit; font-size: 16px;
  color: var(--ink);
  min-width: 0;
}
input::placeholder, textarea::placeholder { color: #A8ADA4; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=file] { padding: 9px 12px; font-size: 14px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236E736B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* Сетка полей: две колонки на большом экране, одна на телефоне. */
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-field); }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form .field + .field { margin-top: 0; }

.inline { display: flex; gap: var(--gap-field); flex-wrap: wrap; align-items: flex-end; }
.inline > .field { flex: 1 1 180px; }
.inline > .field + .field { margin-top: 0; }
.inline > .field.sm { flex: 0 1 116px; }
.inline > .act { flex: 0 0 auto; }

.check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 15px; color: var(--ink); cursor: pointer;
}
.check + .check { margin-top: 12px; }
.check input { margin: 4px 0 0; flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent); }
.check span { line-height: 1.45; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px 20px; margin: 0 0 var(--gap-field); }
fieldset:last-child { margin-bottom: 0; }
legend { font-size: 14px; font-weight: 700; color: var(--ink); padding: 0 8px; }

/* Ошибка показывается под полем, а не всплывающим окном. */
.err-text { font-size: 14px; color: var(--danger); margin-top: 6px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid input:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- Сообщения ---------- */
.flash {
  padding: 14px 18px; border-radius: var(--radius-sm);
  margin-bottom: var(--gap-card); font-size: 15px;
  border: 1px solid var(--line); background: var(--surface);
}
.flash.ok { border-color: #CBDDD1; background: var(--accent-soft); color: var(--accent-dark); }
.flash.err { border-color: #E7C9C2; background: var(--danger-soft); color: var(--danger); }

/* ---------- Статус точкой, а не заливкой ---------- */
.dot {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.dot::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex: 0 0 auto;
}
.dot.new::before { background: #3E6EA8; }
.dot.confirmed::before { background: var(--accent); }
.dot.checked_in::before { background: #7A5BA6; }
.dot.cancelled::before { background: var(--danger); }
.dot.open::before { background: var(--accent); }
.dot.closed::before { background: #B4B8B1; }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
}
.tag.accent { border-color: #CBDDD1; background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Первый экран ---------- */
.hero { padding: 24px 0 var(--gap-block); }
.hero h1 { max-width: 16ch; }
.hero .lead { margin-bottom: 0; }

.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.how h3 { margin-bottom: 8px; font-size: 17px; }
.how p { font-size: 15px; color: var(--muted); line-height: 1.55; }
.how .step-no {
  display: block; font-size: 13px; font-weight: 700; color: var(--accent);
  margin-bottom: 8px; letter-spacing: .04em;
}

/* ---------- Строка поиска ---------- */
.searchbar { position: relative; }
/* Календарь раскрывается точно под своей строкой полей. */
[data-calendar] { position: relative; }
.searchbar .inline > .act .btn { padding: 12px 30px; }
.dates-input { cursor: pointer; }

/* ---------- Календарь ---------- */
.cal-pop {
  position: absolute; z-index: 60; left: 0; top: 100%; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 1px 2px rgba(30, 33, 28, .04);
  padding: 24px; max-width: calc(100vw - 32px);
}
.cal-months { display: flex; gap: 40px; }
.cal-month { width: 280px; flex: 0 0 auto; }
.cal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-size: 16px; font-weight: 700;
}
.cal-nav {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--ink); flex: 0 0 auto;
}
.cal-nav:hover:not([disabled]) { background: var(--accent-soft); border-color: var(--accent); }
.cal-nav[disabled] { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.cal-wd {
  font-size: 12px; font-weight: 500; color: var(--muted);
  text-align: center; padding-bottom: 10px;
}
.cal-day {
  position: relative; border: 0; background: none; cursor: pointer;
  font: inherit; text-align: center; color: var(--ink);
  padding: 6px 0 7px; border-radius: 0;
}
.cal-day .d { display: block; font-size: 15px; font-weight: 500; line-height: 1.2; }
.cal-day .p {
  display: block; font-size: 11px; font-weight: 400; color: var(--muted);
  line-height: 1.3; margin-top: 1px;
}
.cal-day:hover:not(:disabled) .d { color: var(--accent-dark); }
.cal-day:disabled { cursor: not-allowed; color: #B8BCB5; }
.cal-day:disabled .d { text-decoration: line-through; }
.cal-day:disabled .p { color: #C7CBC4; }
.cal-day.empty { visibility: hidden; }

/* Диапазон — светло-зелёная подложка, края — зелёный круг. */
.cal-day.between { background: var(--accent-soft); }
.cal-day.edge { background: var(--accent-soft); }
.cal-day.edge.start { border-radius: 999px 0 0 999px; }
.cal-day.edge.end { border-radius: 0 999px 999px 0; }
.cal-day.edge.only { border-radius: 999px; }
.cal-day.edge .d,
.cal-day.edge .p { position: relative; z-index: 1; }
.cal-day.edge::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%; background: var(--accent);
}
.cal-day.edge .d { color: #fff; font-weight: 700; }
.cal-day.edge .p { color: rgba(255, 255, 255, .8); }

.cal-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px;
  font-size: 15px; flex-wrap: wrap;
}
.cal-foot .info b { font-weight: 700; }
.cal-foot a { cursor: pointer; font-weight: 500; }

/* ---------- Сетка карточек ---------- */
.grid { display: grid; gap: var(--gap-card); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
.item .pic {
  aspect-ratio: 4 / 3;
  background: #F2F1ED center/cover no-repeat;
  border-bottom: 1px solid var(--line);
}
/* Заглушка вместо фотографии: тонкая иконка домика, без подписей. */
.item .pic.empty {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 64 64' fill='none' stroke='%23C4C8C1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 29 32 9l24 20'/%3E%3Cpath d='M15 26v29h34V26'/%3E%3Cpath d='M26 55V39h12v16'/%3E%3C/svg%3E");
  background-size: 72px 72px;
  background-position: center;
}
.item .body { padding: var(--gap-card); display: flex; flex-direction: column; flex: 1; }
.item .body h3 { margin: 0 0 4px; }
.item .kind { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.item .props { font-size: 14px; color: var(--muted); line-height: 1.5; }
.item .foot { margin-top: auto; padding-top: 20px; }
.item .price { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.item .price-note { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.item.sold .pic { opacity: .5; }
.item.sold .price { color: var(--muted); }
.item.picked { border-color: var(--accent); }

/* ---------- Панель «Бронь» ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap-card); align-items: start; }
.side { position: sticky; top: 24px; }

.sum-line {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 7px 0; font-size: 15px;
}
.sum-line .lbl { color: var(--muted); flex: 0 1 auto; }
.sum-line .val { text-align: right; font-weight: 500; }
.sum-line.total {
  border-top: 1px solid var(--line); margin-top: 12px; padding-top: 16px;
  font-size: 22px; font-weight: 700; letter-spacing: -.02em;
}
.sum-line.total .val { font-weight: 700; }

/* На телефоне панель уезжает вниз, а итог закрепляется полосой. */
.mobile-bar { display: none; }

/* ---------- Таблицы ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  font-size: 13px; font-weight: 700; color: var(--muted);
  letter-spacing: .02em; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.key { color: var(--muted); width: 40%; }

/* ---------- Админка: боковое меню ---------- */
.adm { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 32px; align-items: start; }
.adm-side {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; position: sticky; top: 24px;
}
.adm-side a {
  display: block; padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; color: var(--ink);
  border-left: 3px solid transparent;
}
.adm-side a:hover { background: var(--bg); }
.adm-side a.on {
  background: var(--accent-soft); color: var(--accent-dark);
  font-weight: 700; border-left-color: var(--accent);
}
.adm-side .sep { border-top: 1px solid var(--line); margin: 10px 0; }
.adm-side .sub { font-size: 14px; color: var(--muted); }

/* ---------- Сетка цен ---------- */
.pricegrid { font-size: 14px; border-collapse: separate; border-spacing: 0; }
.pricegrid th, .pricegrid td {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 0; text-align: center;
}
.pricegrid th.rowhead, .pricegrid td.rowhead {
  text-align: left; padding: 10px 14px; position: sticky; left: 0;
  background: var(--surface); z-index: 2; min-width: 220px;
  border-right: 1px solid var(--line);
}
.pricegrid thead th { padding: 10px 6px; font-size: 12px; background: var(--surface); }
.pricegrid thead th .wd { display: block; color: var(--muted); font-weight: 500; }
.pricegrid thead th.we .wd { color: var(--accent); }
.pricegrid td.cell { min-width: 68px; }
.pricegrid td.cell input {
  width: 100%; border: 0; background: none; text-align: center;
  padding: 11px 4px; font: inherit; font-size: 14px; border-radius: 0;
}
.pricegrid td.cell input:focus {
  box-shadow: none; outline: 2px solid var(--accent); outline-offset: -2px;
}
.pricegrid td.cell.def input { color: var(--muted); }
.pricegrid td.locked { color: var(--muted); padding: 11px 4px; background: var(--bg); }
.pricegrid td.saved { animation: saved 1.1s ease-out; }
@keyframes saved { from { background: var(--accent-soft); } to { background: transparent; } }
.pricegrid tr.grp td { background: var(--bg); font-weight: 700; }
.pricegrid tr.grp td.rowhead { background: var(--bg); }

/* ---------- Фотографии в админке ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--gap-field); }
.photo { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.photo .th { aspect-ratio: 4 / 3; background: #F2F1ED center/cover no-repeat; border-bottom: 1px solid var(--line); }
.photo .acts { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; align-items: center; }
.photo form { display: inline; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .adm { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .cal-months { gap: 28px; }

  /* Боковое меню админки становится горизонтальной лентой. */
  .adm { grid-template-columns: minmax(0, 1fr); gap: var(--gap-card); }
  .adm-side {
    position: static; display: flex; gap: 4px; overflow-x: auto; padding: 8px;
  }
  .adm-side a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; padding: 9px 13px; }
  .adm-side a.on { border-left: 0; border-bottom-color: var(--accent); }
  .adm-side .sep { display: none; }
}

@media (max-width: 767px) {
  :root { --gap-block: 36px; --gap-card: 20px; }
  h1 { font-size: 30px; }
  h2 { font-size: 23px; }
  h3 { font-size: 18px; }
  .lead { font-size: 17px; }
  body { font-size: 16px; }

  main { padding: 24px 0 40px; }
  .wrap, .wrap-wide { padding: 0 16px; }
  .top-inner { padding: 12px 16px; min-height: 60px; gap: 12px; }

  .grid.c3, .grid.c2 { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .inline > .field, .inline > .field.sm { flex: 1 1 100%; }
  .inline > .act, .inline > .act .btn { width: 100%; }

  /* На телефоне в полосе шагов остаётся только текущий шаг. */
  .steps li { display: none; }
  .steps li.now { display: flex; border-right: 0; }

  /* Календарь: один месяц в видимой части, второй прокруткой. */
  .cal-pop { left: 0; right: 0; padding: 16px; }
  .cal-months { flex-direction: column; gap: 24px; }
  .cal-month { width: 100%; }

  /* Панель «Бронь» уезжает вниз, итог закрепляется полосой. */
  .side { margin-top: var(--gap-card); }
  .mobile-bar {
    display: flex; align-items: center; gap: 14px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .mobile-bar .sum { flex: 1 1 auto; min-width: 0; }
  .mobile-bar .lbl { display: block; font-size: 13px; color: var(--muted); line-height: 1.2; }
  .mobile-bar .val { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
  .mobile-bar .btn { flex: 0 0 auto; }
  body.has-bar { padding-bottom: 86px; }

  .card { padding: 18px; }
  fieldset { padding: 16px; }
  th, td { padding: 10px 12px; }
  .foot .wrap { flex-direction: column; gap: 16px; }
}

@media (max-width: 400px) {
  h1 { font-size: 27px; }
  .cal-day .p { font-size: 10px; }
  .cal-pop { padding: 12px; }
}

/* Уважаем настройку «меньше движения». */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Кто вошёл ---------- */
.who { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.2; margin-left: auto; }
.who small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.top nav { gap: 16px; align-items: center; }

/* ---------- Шахматка ---------- */
.chess { font-size: 13px; border-collapse: separate; border-spacing: 0; }
.chess th, .chess td {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 0; text-align: center;
}
.chess th.rowhead, .chess td.rowhead {
  text-align: left; padding: 8px 12px; position: sticky; left: 0;
  background: var(--surface); z-index: 2; min-width: 190px; line-height: 1.3;
}
.chess td.rowhead b { display: inline-block; min-width: 34px; }
.chess thead th { padding: 8px 4px; font-size: 12px; background: var(--surface); min-width: 34px; }
.chess thead th .wd { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.chess thead th.we .wd { color: var(--accent); }
.chess thead th.now { background: var(--accent-soft); }
.chess td.free { height: 38px; }
.chess td.blocked { background: repeating-linear-gradient(
    45deg, #F2F1ED, #F2F1ED 4px, #E4E2DC 4px, #E4E2DC 8px); color: var(--muted); }
.chess td.busy { background: var(--accent-soft); position: relative; }
.chess td.busy a {
  display: block; padding: 10px 4px; font-size: 12px; font-weight: 500;
  color: var(--accent-dark); white-space: nowrap; overflow: visible;
}
.chess td.busy.new { background: #E7EEF7; }
.chess td.busy.new a { color: #2C4F74; }
.chess td.busy.confirmed { background: var(--accent-soft); }
.chess td.busy.checked_in { background: #EDE8F5; }
.chess td.busy.checked_in a { color: #4F3D75; }
.chess td.busy.start { border-left: 3px solid var(--accent); }
.chess td.busy.end { border-right: 3px solid var(--accent); }

/* ---------- Плотная таблица (сводки) ---------- */
table.tight { font-size: 13px; }
table.tight th, table.tight td { padding: 6px 8px; }
table.tight tr.now { background: var(--accent-soft); }
table.tight tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }

/* ---------- Питание в карточке брони ---------- */
.meals th, .meals td { padding: 8px 10px; vertical-align: middle; }
.meals input[type=number] { width: 74px; text-align: center; }
.meals input[type=text] { min-width: 0; }
.meals td.saved { animation: saved 1.1s ease-out; }
.meals tr.off { opacity: .55; }

/* ---------- Вкладки услуг ---------- */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: var(--gap-card); padding-bottom: 2px;
}
.tabs a {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 15px; font-weight: 500; color: var(--ink);
  white-space: nowrap;
}
.tabs a:hover { background: var(--accent-soft); border-color: var(--accent); }
.tabs a.on {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700;
}

/* ---------- Сетка «дата × дома» ---------- */
.daygrid { font-size: 13px; border-collapse: separate; border-spacing: 0; }
.daygrid th, .daygrid td {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 0; text-align: center; vertical-align: middle;
}
.daygrid th.rowhead, .daygrid td.rowhead {
  text-align: left; padding: 8px 12px; position: sticky; left: 0;
  background: var(--surface); z-index: 2; min-width: 132px;
  font-weight: 700; white-space: nowrap;
}
.daygrid td.rowhead.sub { font-weight: 400; color: var(--muted); font-size: 12px; }
.daygrid tr.dayhead th {
  background: var(--bg); font-size: 12px; font-weight: 700;
  padding: 8px 6px; min-width: 116px; white-space: nowrap;
}
.daygrid tr.dayhead th.we { color: var(--accent); }
.daygrid tr.dayhead th.rowhead { background: var(--bg); font-size: 14px; }
.daygrid tr.dayhead th .wd { color: var(--muted); font-weight: 500; margin-left: 4px; }
/* Итоги живут в левом закреплённом столбце: при 21 доме отдельные колонки
   справа уезжали за край и наезжали на дома при прокрутке. */
.daygrid .daysum {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 20px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
}
.daygrid .rowsum {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border-radius: 20px; background: var(--accent-soft); color: var(--accent-dark);
  font-size: 12px; font-weight: 700;
}
.daygrid td.empty { background: #FCFCFB; }
.daygrid td input {
  width: 100%; border: 0; background: none; text-align: center;
  padding: 7px 4px; font: inherit; font-size: 13px; border-radius: 0;
}
.daygrid td input:focus {
  box-shadow: none; outline: 2px solid var(--accent); outline-offset: -2px;
  background: var(--surface);
}
.daygrid td.qty input { font-weight: 700; font-size: 15px; }
.daygrid td.note { padding: 4px 2px; }
.daygrid td.note .guest {
  display: block; font-size: 12px; font-weight: 700; color: var(--accent-dark);
  line-height: 1.2; padding: 2px 4px 0;
}
.daygrid td.note input { font-size: 12px; padding: 3px 4px; color: var(--muted); }
.daygrid td.saved { animation: saved 1.1s ease-out; }
.daygrid tr.grp td.rowhead { border-top: 2px solid var(--line); }

/* Заголовок группы услуг в карточке брони */
tr.grouprow td { background: var(--bg); }
tr.grouprow td b { font-size: 15px; }

/* Услуги в форме ручной брони */
.grouplabel {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--line);
}
.grouplabel:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.svcrow { align-items: center; gap: 12px; margin-bottom: 10px; }
.svcrow label { margin-bottom: 2px; color: var(--ink); font-weight: 500; }

/* Меню дня рядом с приёмом пищи */
.daygrid .menu {
  display: block; font-size: 11px; font-weight: 400; color: var(--muted);
  line-height: 1.35; margin-top: 3px; white-space: normal;
}
.daygrid th.rowhead, .daygrid td.rowhead { min-width: 240px; max-width: 240px; }

/* Услуги по дням: слева широкая сетка, справа сводка. Сетке нужен минимум
   ширины, иначе она сжимается сильнее, чем полезно. */
.monitor-layout { grid-template-columns: minmax(0, 1fr) 300px; }
.monitor-layout .tight th, .monitor-layout .tight td { padding: 7px 6px; }

/* Итоги — часть той же таблицы, в конце каждого блока даты */
.daygrid th.sum, .daygrid td.sum {
  background: var(--bg); min-width: 76px; padding: 6px;
  font-size: 12px; border-left: 1px solid var(--line);
}
.daygrid td.sum { font-size: 16px; font-weight: 700; }
.daygrid th.sum.grand, .daygrid td.sum.grand { background: var(--accent-soft); }
.daygrid td.sum.grand { font-size: 19px; color: var(--accent-dark); }

/* Календарь месяца в панели услуг по дням */
.svc-cal { border-collapse: collapse; width: 100%; table-layout: fixed; }
.svc-cal th {
  font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 0 0 6px; text-align: center; border: 0;
}
.svc-cal td { padding: 1px; border: 0; text-align: center; }
.svc-cal td.empty { visibility: hidden; }
.svc-cal td a {
  display: block; padding: 5px 0 4px; border-radius: 8px;
  border: 1px solid transparent; color: var(--ink); line-height: 1.1;
}
.svc-cal td a:hover { background: var(--accent-soft); border-color: var(--accent); }
.svc-cal .d { display: block; font-size: 13px; font-weight: 500; }
.svc-cal .q { display: block; font-size: 11px; color: var(--muted); min-height: 13px; }
.svc-cal td.has a { background: var(--accent-soft); }
.svc-cal td.has .q { color: var(--accent-dark); font-weight: 700; }
.svc-cal td.now a { background: var(--accent); border-color: var(--accent); }
.svc-cal td.now .d, .svc-cal td.now .q { color: #fff; }

/* ---------------------------------------------------------------------------
   Встроенный режим (iframe на Тильде). Класс ставит скрипт в base.html,
   когда страница открыта внутри чужого сайта: свою шапку и подвал прячем,
   отступы уменьшаем — вокруг уже есть сайт со своей шапкой.
   --------------------------------------------------------------------------- */
.embedded .top,
.embedded .foot { display: none; }
.embedded main { padding: 8px 0 24px; }


/* ---------------------------------------------------------------------------
   Галерея в карточке домика
   Фотографии лежат стопкой, видна одна. Листается стрелками и пальцем —
   так гость отсеивает неподходящее, не открывая каждый домик.
--------------------------------------------------------------------------- */
.item .pic { position: relative; overflow: hidden; }

.item .pic .shot {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity .25s ease;
}
.item .pic .shot.on { opacity: 1; }

.item .pic .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .82); color: var(--ink);
  font-size: 20px; line-height: 1; padding: 0;
  opacity: 0; transition: opacity .15s ease;
  display: flex; align-items: center; justify-content: center;
}
.item .pic .nav.prev { left: 8px; }
.item .pic .nav.next { right: 8px; }
.item:hover .pic .nav,
.item .pic .nav:focus-visible { opacity: 1; }

.item .pic .dots {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; gap: 5px; justify-content: center;
}
.item .pic .dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  transition: background .2s ease;
}
.item .pic .dots span.on { background: #fff; }

/* На телефоне наведения нет — стрелки видны всегда, но приглушены. */
@media (hover: none) {
  .item .pic .nav { opacity: .75; }
}

/* Предел свободных дат у конкретного дома: подсказка, а не тревога. */
.item .price-note.limit { color: var(--accent); }

/* ---------------------------------------------------------------------------
   Выбор даты выезда
   После выбора заезда видно три вещи: докуда можно уехать, где эта граница
   и каким получится срок под курсором. Недоступные дни не просто серые —
   они уходят на второй план, чтобы взгляд сам шёл по нужной полосе.
--------------------------------------------------------------------------- */
.cal-pop.picking .cal-day:disabled { opacity: .35; }
.cal-pop.picking .cal-day:disabled .p { visibility: hidden; }

.cal-day.allowed {
  background: var(--accent-soft);
  box-shadow: inset 0 -2px 0 rgba(63, 107, 82, .18);
}
.cal-day.allowed:hover { background: #DCEBE1; }

/* Граница окна: дальше уехать нельзя, и это видно без наведения. */
.cal-day.edge-last {
  border-radius: 0 999px 999px 0;
  box-shadow: inset -2px 0 0 var(--accent), inset 0 -2px 0 rgba(63, 107, 82, .18);
}

/* Предпросмотр: полоса от заезда до дня под курсором. */
.cal-day.in-preview { background: #DCEBE1; }
.cal-day.preview-end {
  background: var(--accent); color: #fff; border-radius: 0 999px 999px 0;
}
.cal-day.preview-end .d,
.cal-day.preview-end .p { color: #fff; }

/* Предложение сократить поездку вместо тупика «ничего нет». */
.offer { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.offer > div { flex: 1 1 320px; }
