/* Интерфейс персонала и кабинета турфирмы. Мобильная вёрстка первой (от 320 px); от 1024 px — боковое меню.
   HTMX 2.0.4 лежит рядом: staff/htmx.min.js. Цвета, радиусы и шрифты — только через переменные ниже:
   под другого клиента меняются акцент (--accent, --accent-soft, --accent-line) и PRODUCT_NAME в настройках.
   Янтарь (--warn*) — ожидание и долг; красный (--danger*) — ошибки, опасные действия, просроченные запросы. */
:root {
  --bg: #f4f4f6;
  --card: #fff;
  --line: #e7e7ec;
  --ink: #16161d;
  --muted: #6b6b78;
  --accent: #1f5f3f;
  --accent-soft: #e7f1ea;
  --accent-line: #b9d6c3;
  --accent-ink: #fff;
  --warn-bg: #fff4e5;
  --warn: #a35a00;
  --warn-line: #f1d3a6;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --danger-line: #f2c4c0;
  --neutral: #ececf1;
  --neutral-ink: #50505b;
  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --tap: 44px;
  /* Шкала отступов: новые и переведённые экраны берут отступы только отсюда. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --overlay: rgba(22, 22, 29, 0.45);
  --shadow-pop: 0 12px 40px rgba(22, 22, 29, 0.18);
  --hover-dim: rgba(0, 0, 0, 0.06);
  --sidebar: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

/* Шрифты лежат у нас (OFL, лицензии рядом с файлами): без внешних запросов. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/inter-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/staff/fonts/inter-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/staff/fonts/inter-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/staff/fonts/inter-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/staff/fonts/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/staff/fonts/inter-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/staff/fonts/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/source-serif-4-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* latin-ext: в том числе знак рубля ₽ (U+20BD). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/inter-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/staff/fonts/inter-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/staff/fonts/inter-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/staff/fonts/inter-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/staff/fonts/source-serif-4-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------------------------------------------------------------- основа */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.has-nav { padding-bottom: calc(var(--tap) + 28px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 50; padding: 10px 16px;
  background: var(--card); color: var(--accent); border-radius: var(--pill); border: 1px solid var(--line);
}
.skip-link:focus { top: 8px; }

h1 { font-family: var(--serif); font-weight: 400; font-size: 1.85rem; line-height: 1.15; letter-spacing: -0.01em; margin: 4px 0 16px; }
h2 { font-size: 1rem; font-weight: 600; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.h-serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---------------------------------------------------------------- раскладка */
.layout { min-height: 100vh; }
.layout-main { min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: 16px; }
.page-narrow { max-width: 440px; padding-top: 8vh; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; min-width: 0; }
.brand-mark { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--accent); }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Боковое меню — только на компьютере. */
.sidebar { display: none; }

/* Шапка телефона: логотип, база со стрелкой (выбор базы) или название турфирмы. */
.topbar {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand-mark { width: 22px; height: 22px; }
.topbar-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .switcher { flex: 1; min-width: 0; }
.logout { margin: 0; }

/* Выбор базы: на вид — название со стрелкой, по нажатию — системный список. */
.switcher { position: relative; margin: 0; }
.switcher select {
  width: 100%; min-height: var(--tap); padding: 8px 36px 8px 12px; font: inherit; font-weight: 600;
  color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis;
}
.switcher select:hover { background: var(--bg); }
.switcher::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  pointer-events: none;
}
.switcher-single { display: flex; align-items: center; min-height: var(--tap); padding: 0 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Пункты меню (боковое и нижнее). */
.nav-icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; min-width: 0; min-height: calc(var(--tap) + 12px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px; font-size: 0.72rem; font-weight: 500; line-height: 1.15;
  color: var(--muted); text-decoration: none; text-align: center;
}
.bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.bottom-nav a[aria-current="page"] .nav-icon { stroke-width: 2.2; }

@media (min-width: 1024px) {
  body.has-nav { padding-bottom: 0; }
  .layout.has-sidebar { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .topbar, .bottom-nav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 20px 14px; background: var(--card); border-right: 1px solid var(--line);
  }
  .sidebar .brand { padding: 0 8px 4px; }
  .sidebar-org { margin: 0; padding: 0 12px; font-weight: 600; color: var(--muted); }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px;
    border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 500;
  }
  .side-nav a:hover { background: var(--bg); color: var(--ink); }
  .side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .sidebar .logout { margin-top: auto; }
  .sidebar .logout .btn { width: 100%; justify-content: flex-start; }
  .page { padding: 28px 32px 40px; }
  .page-narrow { padding-top: 12vh; }
  h1 { font-size: 2.2rem; }
}

/* ---------------------------------------------------------------- компоненты */
/* Заголовок страницы с действиями справа. */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.page-head h1 { margin: 0; }
.page-head .page-actions, .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Плитки. */
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.tile > h2, .tile-title { padding: 0; border: 0; margin: 0 0 8px; font-size: 1rem; font-weight: 600; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: 0 0 12px; }
.tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Плитка-счётчик: подпись и крупная цифра с засечками. */
.stat { padding: 14px 16px; }
.stat-k { color: var(--muted); font-size: 0.85rem; }
.stat-v { font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Строка списка внутри плитки. */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--tap); padding: 10px 0; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
a.list-row:hover { color: var(--accent); }
.list-row > :first-child { min-width: 0; }

/* Метки статусов. */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--pill);
  font-size: 0.75rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.tag-ok { background: var(--accent); color: var(--accent-ink); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-agency { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.tag-muted { background: var(--neutral); color: var(--neutral-ink); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }

/* Кнопки-«таблетки»: основная — акцент, обычная — светло-серая, опасная — красная обводка. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: var(--tap); padding: 8px 18px;
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  border: 1px solid transparent; border-radius: var(--pill);
  background: var(--neutral); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(0.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--card); filter: none; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); filter: none; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--bg); color: var(--ink); filter: none; }
a.btn { text-decoration: none; }

/* Поля: подпись над полем, ошибка красным под ним. */
select, textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="url"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="month"] {
  min-height: var(--tap); padding: 9px 12px; font: inherit; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
/* Во всю ширину — текстовые поля везде, числа и даты — только в формах (.bform, .field):
   поле даты в панели шахматки и количество в выдаче турфирмы остаются по содержимому. */
select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"] { width: 100%; }
:is(.bform, .field) :is(input[type="number"], input[type="date"], input[type="tel"], input[type="datetime-local"], input[type="month"]) { width: 100%; }
.inline-form input, input.count { width: auto; }
input.count { max-width: 6em; margin-left: 0; color: var(--ink); }
select:focus, textarea:focus, input:focus { border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.field { display: block; margin: 0 0 14px; min-width: 0; }
.field > label, .field-label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; }
.field-hint { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }
.field-error { color: var(--danger); margin: 4px 0 0; font-size: 0.9rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }

/* Таблица в плитке (широкую прокручивать внутри .table-scroll). */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  padding: 10px 12px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile > .table-scroll, .tile > .table { margin: -4px -4px 0; width: calc(100% + 8px); }

/* Список строк внутри плитки: главная строка и пояснение слева, метка справа. */
.tile-list { list-style: none; margin: 0; padding: 0; }
.tile-list > li:first-child > .list-row { border-top: 0; }
.tile-list > .empty { padding: 14px 0; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.list-row > .tag { flex: none; }
.tile-warn { border-color: var(--warn-line); background: var(--warn-bg); }
.tile-warn .list-row { border-top-color: var(--warn-line); }
.tile-warn .muted { color: var(--warn); }
.tile-warn > h2 { color: var(--warn); }
.tile-warn .tag-warn { border-color: var(--warn-line); background: var(--card); }
.tile + .tile { margin-top: 12px; }
.tiles > .tile + .tile { margin-top: 0; }
.req-item { padding: 12px 0; border-top: 1px solid var(--line); }
.req-item:first-child { border-top: 0; }
.req-item p { margin: 0 0 6px; }
.req-item .inline-form { margin-top: 10px; }

/* Пустое состояние. */
.empty { padding: 14px 16px; color: var(--muted); }
.tile > .empty, .empty-block { padding: 24px 8px; text-align: center; }
.empty-block .actions { justify-content: center; }

/* Плашки-сообщения. */
.notice { padding: 12px 16px; margin: 0 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.notice-ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.notice-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }

/* ---------------------------------------------------------------- вход, долг, отказ, поиск, «Ещё» */
/* Вход персонала, пароль и блокировка турфирмы: одна плитка по центру. */
.card.login {
  max-width: 400px; margin: 0 auto; padding: 24px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.card.login h1 { margin-top: 0; }
.card.login label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.9rem; }
.card.login .btn { width: 100%; margin-top: 20px; }
.login-brand { justify-content: center; margin: 0 0 20px; }

/* Долг — янтарём, как в карточке заказа и на «Сегодня». */
.debt { color: var(--warn); font-weight: 700; }
.decline { margin-top: 8px; }
.decline > summary { display: inline-flex; align-items: center; list-style: none; }
.decline > summary::-webkit-details-marker { display: none; }

.searchform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.searchform input { flex: 1; min-width: 0; }

/* «Ещё»: список разделов. */
.more-list { list-style: none; margin: 0; padding: 0 16px; }
.more-list li:first-child .list-row { border-top: 0; }
.more-list .list-row::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-right: 4px;
  border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg);
}
.more-list .list-row { justify-content: flex-start; }
.more-list .list-row > span:first-child { flex: 1; font-weight: 500; }
.more-logout { margin-top: 12px; }

/* Шахматка: прокрутка только у сетки, первый столбец с номером закреплён. Брони — скруглённые полосы по статусу:
   подтверждена/заселён — акцент; ждёт оплаты/подтверждения — янтарь пунктиром; запрос турфирмы — мягкий акцент
   с рамкой; выехал — серая; закрытие — штриховка. Те же классы у сетки бань (resources_day). */
.page:has(.chess-scroll) { max-width: none; }
.chess-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.chess-nav, .chess-days { display: flex; gap: 4px; }
.chess-days { flex-wrap: wrap; }
.chess-range-form { display: flex; align-items: center; gap: 6px; }
.chess-range-form label { color: var(--muted); font-size: 0.85rem; }
.chess-range-form.is-custom input[type="date"] { border-color: var(--accent); }
.chess-phone-note { margin: 0 4px 8px; font-size: 0.8rem; }
@media (max-width: 767px) { .chess-wide-only { display: none; } }
.chess-range { flex: 1; min-width: 8em; color: var(--muted); font-weight: 500; }
.chess-scroll {
  position: relative; /* скрытые подписи (.sr-only) в клетках позиционируются внутри — не расширяют страницу */
  overflow-x: auto; overscroll-behavior-x: contain; max-width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.chess-board { padding: 0; overflow: hidden; }
.chess-board > .chess-scroll { border: 0; border-radius: 0; }
.chess { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 0.85rem; }
.chess th, .chess td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; }
.chess tr > :last-child { border-right: 0; }
.chess tbody tr:last-child > * { border-bottom: 0; }
.chess thead th { position: sticky; top: 0; background: var(--card); z-index: 2; padding: 8px 4px; font-weight: 600; text-align: center; min-width: 64px; white-space: nowrap; }
.chess-wd { color: var(--muted); font-weight: 500; }
.chess thead th.is-today { background: var(--accent-soft); color: var(--accent); }
.chess thead th.is-today .chess-wd { color: var(--accent); }
.chess .chess-unit { position: sticky; left: 0; z-index: 3; background: var(--card); min-width: 92px; max-width: 132px; padding: 6px 12px; text-align: left; font-weight: 600; box-shadow: 1px 0 0 var(--line); }
.chess thead .chess-unit { z-index: 4; color: var(--muted); font-weight: 500; }
.chess-group th { position: sticky; left: 0; background: var(--bg); padding: 6px 12px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.chess-group-name { position: sticky; left: 12px; display: inline-block; }
.chess-num { display: inline-block; min-width: 1.6em; margin-right: 4px; color: var(--muted); font-weight: 400; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.chess-total { display: block; font-size: 0.72rem; font-weight: 600; color: var(--ink); }
.chess-list-total { margin: 4px 4px 8px; font-size: 0.85rem; font-weight: 600; }
.chess td.is-today { background: var(--accent-soft); }
.chess-flag { display: block; font-size: 0.7rem; font-weight: 500; color: var(--warn); line-height: 1.2; }
.chess-cell { height: var(--tap); min-width: 64px; }
.chess-cell > a { display: flex; flex-direction: column; justify-content: center; height: 100%; min-height: var(--tap); padding: 2px 6px; color: inherit; text-decoration: none; overflow: hidden; }
.chess-cell > a:focus-visible { outline-offset: -2px; }
.chess-cell.free > a { display: block; }
.chess-cell.free > a:hover { background: var(--bg); }
.chess-cell.closed { background: repeating-linear-gradient(135deg, var(--neutral), var(--neutral) 6px, var(--card) 6px, var(--card) 12px); }
.chess-cell.booked > a {
  height: auto; min-height: calc(var(--tap) - 8px); margin: 4px 3px; padding: 2px 10px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.chess-cell.booked > a:hover { filter: brightness(1.08); }
.chess-cell.booked > a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.chess-cell.status-awaiting_payment > a, .chess-cell.status-awaiting_confirmation > a { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); }
.chess-cell.status-agency_request > a { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chess-cell.status-checked_out > a { background: var(--neutral); color: var(--neutral-ink); border-color: var(--neutral); }
/* Значок источника брони: нейтральный, цвет полосы остаётся по статусу. */
.src-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box;
  min-width: 1.35em; height: 1.35em; margin-right: 5px; padding: 0 3px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--card); color: var(--muted);
  font-size: 0.7rem; font-weight: 700; line-height: 1; vertical-align: middle;
}
.chess-guest { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chess-status { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.chess-cell.booked .chess-status { color: inherit; font-weight: 500; }
.chess-cell.booked .debt { padding: 0 6px; border-radius: var(--pill); background: var(--warn-bg); color: var(--warn); }
.chess-cell.status-awaiting_payment .debt, .chess-cell.status-awaiting_confirmation .debt { background: var(--card); }
.chess-legend { list-style: none; margin: 12px 0 0; padding: 0; color: var(--muted); }
.chess-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chess-legend .legend-sources { flex-wrap: wrap; gap: 4px 10px; }
.chess-legend .legend-sources span { display: inline-flex; align-items: center; gap: 4px; }
.swatch.s-confirmed { background: var(--accent); border-color: var(--accent); }
.swatch.s-wait { background: var(--warn-bg); border: 1px dashed var(--warn); }
.swatch.s-agency { background: var(--accent-soft); border-color: var(--accent-line); }
.swatch.s-out { background: var(--neutral); }

/* Шахматка на телефоне: список домиков, у каждого полоска клеток окна по 7 в ряд (столбцы — дни недели). */
.chess-board { display: none; }
.chess-list-type { padding: 0; border: 0; margin: 18px 4px 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.chess-list-group:first-of-type .chess-list-type { margin-top: 6px; }
.chess-unit-tile { padding: 12px; }
.chess-unit-tile + .chess-unit-tile { margin-top: 8px; }
.chess-unit-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.chess-unit-name { min-width: 0; overflow-wrap: anywhere; }
.chess-unit-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.strip { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.strip-head { margin: 0 13px; font-size: 0.72rem; color: var(--muted); text-align: center; }
.strip-cell {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: var(--tap);
  border: 1px solid transparent; border-radius: 8px; background: var(--bg); color: var(--muted);
  font-size: 0.8rem; font-weight: 500; font-variant-numeric: tabular-nums; text-decoration: none;
}
a.strip-cell.free:hover { border-color: var(--line); color: var(--ink); }
.strip-cell.status-confirmed, .strip-cell.status-checked_in { background: var(--accent); color: var(--accent-ink); }
.strip-cell.status-awaiting_payment, .strip-cell.status-awaiting_confirmation { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); }
.strip-cell.status-agency_request { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.strip-cell.status-checked_out { background: var(--neutral); color: var(--neutral-ink); }
.strip-cell.closed { background: repeating-linear-gradient(135deg, var(--neutral), var(--neutral) 4px, var(--card) 4px, var(--card) 8px); color: var(--neutral-ink); }
.strip-cell.is-today { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.strip-cell.has-debt::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 1.5px var(--card); }
/* Первый день брони — светлый край слева: две брони подряд не сливаются в одну полосу. */
.strip-cell.is-start { box-shadow: inset 3px 0 0 var(--card); }
.strip-cell .src-mark { position: absolute; top: 2px; left: 2px; min-width: 1.1em; height: 1.1em; margin: 0; padding: 0 2px; font-size: 0.6rem; }
@media (min-width: 768px) {
  .chess-board { display: block; }
  .chess-list { display: none; }
}

/* Карточка заказа и форма брони. */
h2.plain { padding: 0; border: 0; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 12px 0 0; }
.bform label { display: block; margin: 12px 0 4px; font-weight: 600; }
.bform fieldset { border: 1px solid var(--line); margin: 0 0 12px; min-width: 0; }
.bform legend { font-weight: 700; padding: 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; align-items: center; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.inline-form input[type="text"] { width: auto; min-width: 12em; }
.diff-line { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }

/* Сетка бань и беседок: часовые столбцы поуже, чем сутки в шахматке. */
.chess.hours thead th { min-width: 56px; }
.chess.hours .chess-cell { min-width: 56px; }
.chess-cell.buffer { background: var(--warn-bg); color: var(--warn); text-align: center; vertical-align: middle; }
.chess-cell.buffer .chess-status { color: var(--warn); }
.hours-board { padding: 0; overflow: hidden; }
.hours-board > .chess-scroll { border: 0; border-radius: 0; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.85rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); border-radius: 3px; vertical-align: middle; }
.swatch.buffer { background: var(--warn-bg); border-color: var(--warn-line); }
.swatch.closed { background: repeating-linear-gradient(135deg, var(--neutral), var(--neutral) 3px, var(--card) 3px, var(--card) 6px); }
.swatch.free { background: var(--card); }
.bform label.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-weight: 400; }
.bform label.check input { width: 20px; height: 20px; }
.bform label.check-top { align-items: flex-start; padding: 10px 0; }
.bform label.check-top input { flex: none; margin: 2px 0 0; }

/* Контент, цены, турфирмы. */
.messages { list-style: none; margin: 0 0 12px; padding: 0; }
.message { padding: 12px 16px; margin: 0 0 8px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.message.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.message.info { background: var(--card); border-color: var(--line); color: var(--ink); }
.message.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.messages:empty { display: none; }
.message { display: flex; align-items: flex-start; gap: var(--space-3); }
.message > span { flex: 1; }
.message-close {
  flex: none; min-width: var(--tap); min-height: var(--tap); margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) 0;
  border: 0; background: transparent; color: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; border-radius: var(--radius-sm);
}
.message-close:hover { background: var(--hover-dim); }

/* Окно подтверждения (staff/_confirm_dialog.html, staff/confirm.js). */
dialog.confirm {
  width: min(28rem, calc(100vw - 2 * var(--space-4))); max-width: none; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog.confirm::backdrop { background: var(--overlay); }
.confirm-body { padding: var(--space-5) var(--space-4) var(--space-4); }
.confirm-body h2 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 var(--space-3); overflow-wrap: anywhere; }
.confirm-details { margin: 0 0 var(--space-4); padding-left: var(--space-5); color: var(--ink); overflow-wrap: anywhere; }
.confirm-details li + li { margin-top: var(--space-1); }
.confirm-actions { display: flex; flex-direction: column-reverse; gap: var(--space-2); }
.confirm-actions .btn { width: 100%; min-height: var(--tap); justify-content: center; }
@media (min-width: 480px) {
  .confirm-actions { flex-direction: row; justify-content: flex-end; }
  .confirm-actions .btn { width: auto; }
}

/* Подсказка «?» (staff/_help.html): раскрывается на месте. */
details.help { position: relative; display: inline-block; vertical-align: middle; margin-left: var(--space-1); }
details.help > summary {
  /* Область касания — 44 px (--tap), видимый кружок — 26 px в центре. */
  list-style: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); margin: calc(-1 * var(--space-2)) 0; border-radius: var(--pill);
  background: radial-gradient(circle, var(--accent-soft) 12px, var(--accent-line) 12.5px, var(--accent-line) 13px, transparent 13.5px);
  color: var(--accent); font: 600 0.9rem/1 var(--font); cursor: pointer;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help[open] > summary { background: radial-gradient(circle, var(--accent) 13px, transparent 13.5px); color: var(--accent-ink); }
details.help > p {
  /* Подсказка всплывает под «?» и не сдвигает страницу; шрифт — обычный текст, даже внутри заголовка. */
  position: absolute; z-index: 20; top: calc(100% + var(--space-1)); left: 0; width: min(22rem, calc(100vw - 2 * var(--space-4)));
  margin: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); box-shadow: var(--shadow-pop); color: var(--ink); font: 400 0.9rem/1.45 var(--font); letter-spacing: 0;
}
@media (max-width: 480px) { details.help > p { position: fixed; top: auto; bottom: calc(var(--tap) + 40px); left: var(--space-4); } }
.table-scroll { overflow-x: auto; }

/* перетаскивание в шахматке */
.chess-cell.booked[data-line] > a { cursor: grab; }
.chess-cell.free.drop-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.chess-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: min(420px, 92vw);
  background: var(--card); color: var(--ink);
}
.chess-dialog::backdrop { background: color-mix(in srgb, var(--ink) 35%, transparent); }
.chess-dialog h2.plain { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin: 0 0 12px; }
.chess-dialog p { margin: 0 0 10px; }
.chess-dialog .notice { margin: 0 0 12px; }
.chess-dialog .diff-line { font-variant-numeric: tabular-nums; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }


/* ---------------------------------------------------------------- карточка заказа, формы брони и бани */
.back { margin: 0 0 4px; }
.back a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; text-decoration: none; }
.back a:hover { text-decoration: underline; }
.page-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.page-sub { margin: 6px 0 0; }
.tile-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.tile-head > .tile-title { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.order-layout .tile p, .diff-tile p { margin: 0 0 8px; }
.order-layout .tile p:last-child, .diff-tile p:last-child { margin-bottom: 0; }
.notice-title { padding: 0; border: 0; margin: 0 0 4px; font-size: 1rem; }
.notice p { margin: 0; }

/* Карточка заказа: на компьютере справа колонка оплаты. */
.order-layout { display: grid; gap: 12px; margin: 0 0 12px; }
.order-main, .order-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.order-main > .tile + .tile, .order-side > .tile + .tile { margin-top: 0; }
.order-main > .notice, .order-main > .actions { margin: 0; }
@media (min-width: 1024px) {
  .order-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); align-items: start; gap: 16px; }
}
.guest-name { font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px 16px; margin: 4px 0 0; }
.facts dt { color: var(--muted); font-size: 0.8rem; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts a { display: inline-flex; align-items: center; min-height: var(--tap); margin: -10px 0; }
.facts-wide { grid-column: 1 / -1; }
.line-span { font-weight: 500; }
.line-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.rooms-by-type { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.rooms-by-type strong { font-variant-numeric: tabular-nums; }
.line-note { overflow-wrap: anywhere; }

/* Расчёт (строка заказа и живой расчёт формы): позиции, итог крупной цифрой с засечками. */
.tile > .table.calc, .table.calc { margin: 4px 0 8px; width: 100%; }
.table.calc th, .table.calc td { padding: 8px 0; }
.table.calc td + td, .table.calc th + td, .table.calc th + th { padding-left: 12px; }
.table.calc tfoot th, .table.calc tfoot td { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 0.92rem; font-weight: 600; vertical-align: baseline; }
.table.calc tfoot tr + tr > * { border-top: 0; padding-top: 0; font-weight: 400; color: var(--muted); }
.table.calc tfoot .num strong, .calc-total .num strong { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; }
.table.calc .muted { white-space: nowrap; }

.line-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 12px 0 8px; }
.line-actions:last-child { margin-bottom: 0; }
.reason-form { flex: 1 1 100%; align-items: center; }
.reason-form input[type="text"] { flex: 1 1 12em; min-width: 0; }
.reason-form .field-hint { order: 3; flex-basis: 100%; margin: 0; }
.add-lines { margin: 0; }

/* Оплата: итоги крупными цифрами, баланс плашкой, касса. */
/* Флекс с переносом: суммы стоят рядом, пока помещаются целиком, иначе — друг под другом (число не рвётся). */
.sums { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 12px; }
.sums > div { flex: 1 1 auto; }
.sums dt { color: var(--muted); font-size: 0.85rem; }
.sums dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.6rem; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: normal; white-space: nowrap; }
/* Узкий телефон (до 360 px): итоги всегда друг под другом. */
@media (max-width: 359px) { .sums { flex-direction: column; } }
.tile .balance { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tile .balance.debt { background: var(--warn-bg); color: var(--warn); }
.payments { margin: 0 0 12px; font-size: 0.9rem; }
.pay-row { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.payments > .pay-row:first-child { border-top: 0; padding-top: 0; }
.refund-online { margin: 0 0 12px; }
.cash-form { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.cash-title { margin: 0 0 10px; font-size: 1rem; }
.bform fieldset.choice { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.bform fieldset.choice > legend { float: left; width: 100%; padding: 0; margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; }
.bform label.choice-item {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); margin: 0; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--pill); font-weight: 500; cursor: pointer;
}
.bform label.choice-item:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.bform label.choice-item input { width: 18px; height: 18px; margin: 0; }

/* История — свёрнута. */
.history-tile summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--tap); margin: -8px 0; cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.history-tile summary::-webkit-details-marker { display: none; }
.history-tile summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-right: 6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.history-tile details[open] summary::after { transform: rotate(-135deg); }
.history-tile summary .tile-title { margin: 0; }
.history-tile details[open] .tile-list { margin-top: 12px; }
.history-row { padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.9rem; overflow-wrap: anywhere; }
.history-tile .tile-list > li:first-child { border-top: 0; }

/* Заявка турфирмы в карточке. */
.decline-form { margin-top: 12px; }
.decline-form .field { margin-bottom: 0; }

/* Формы брони и бани: блоки-плитки слева, расчёт и кнопки — липкая колонка справа (на телефоне — внизу формы,
   сразу над кнопками; ничего не перекрывает). */
.form-layout { display: grid; gap: 12px; align-items: start; }
.form-main { display: grid; gap: 12px; min-width: 0; }
.form-side { display: grid; gap: 12px; min-width: 0; }
.form-narrow { display: grid; gap: 12px; max-width: 760px; }
.bform fieldset.fblock { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.bform fieldset.fblock > legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 1rem; font-weight: 600; }
.bform fieldset.fblock > legend + * { clear: both; }
.bform .field > label, .bform .field-label { display: block; margin: 0 0 6px; font-size: 0.9rem; font-weight: 600; }
.bform .field-label { margin-top: 2px; }
.bform .fblock > .field:last-child, .bform .fblock > .field-row:last-child { margin-bottom: 0; }
.bform .fblock > p.muted { margin: 0 0 12px; }
.bform .fblock > p.muted:last-child { margin-bottom: 0; }
.bform .fblock label.check { margin: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px 12px; margin: 0 0 14px; }
/* Подписи разной длины в одном ряду: поля выравниваются по нижнему краю подписи. */
.field-row > .field { display: flex; flex-direction: column; margin: 0; }
.field-row > .field > label { flex: 1 0 auto; }
.form-submit { margin: 0; }
.quote-tile #quote > .muted, .quote-tile #quote > .notice { margin: 0; }
.diff-tile .diff-line { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin: 0 0 12px; }
.diff-tile form { margin: 0 0 10px; }
@media (min-width: 1024px) {
  .form-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
  .form-side {
    position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto;
    padding: 3px; margin: -3px; /* место для рамки фокуса у кнопок внутри прокрутки */
  }
  .form-side .form-submit .btn-primary { flex: 1; }
}

/* Закрытие номера: форма и список закрытий рядом на компьютере. */
.close-tiles { align-items: start; }
.closure-row { align-items: center; flex-wrap: wrap; }
.tile-list > li.list-row:first-child { border-top: 0; }
.closure-row .row-main { flex: 1 1 14em; }

/* ---------------------------------------------------------------- контент, цены, прайсы, турфирмы, отчёт */
.page-note { margin: 12px 0 0; }
.nowrap { white-space: nowrap; }
.form-narrow + .tile, .danger-zone { margin-top: 12px; }
.row-tags { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.chev {
  flex: none; width: 7px; height: 7px; margin-right: 4px;
  border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg);
}
.fblock .facts { margin: 0 0 12px; }
.fblock > .facts:last-child { margin-bottom: 0; }

/* Контент: тип размещения — название-ссылка, под ним номера-«фишки» (закрытие на период). */
.type-row { align-items: flex-start; flex-wrap: wrap; }
.type-row .row-main { flex: 1 1 16em; }
.type-row .row-tags { padding-top: 12px; }
.row-link { display: inline-flex; align-items: center; min-height: var(--tap); align-self: flex-start; color: var(--ink); text-decoration: none; }
a.row-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 2px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap);
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--pill);
  color: var(--ink); text-decoration: none; font-weight: 500; font-variant-numeric: tabular-nums;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* Правка типа: единицы — подблоки внутри плитки, разделены линией. */
.bform fieldset.unit-block { margin: 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.bform fieldset.unit-block + .unit-block { margin-top: 16px; }
.bform .unit-block > legend { float: left; width: 100%; padding: 0; margin: 0 0 10px; font-weight: 600; }
.bform .unit-block > legend + * { clear: both; }
.bform .unit-block label.check { margin: 0; }
.unit-close { margin: 6px 0 0; }

/* Фото: загрузка и сетка карточек; у обложки — акцентная рамка и метка. */
.photo-upload { margin: 0 0 4px; }
.photo-upload .actions { margin-top: 0; }
.bform input[type="file"] {
  width: 100%; min-height: var(--tap); padding: 8px 10px; font: inherit; color: var(--muted);
  background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.bform input[type="file"]::file-selector-button {
  min-height: 34px; margin-right: 10px; padding: 0 14px; font: inherit; font-weight: 600; font-size: 0.85rem;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--pill); cursor: pointer;
}
.photo-grid { list-style: none; margin: 16px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 12px; }
.photo-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.photo-card.is-cover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.photo-frame { position: relative; }
.photo-frame img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.photo-cover-tag { position: absolute; left: 8px; top: 8px; }
.photo-card .field { margin: 0; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.photo-actions .inline-form { flex: 1 1 auto; }
.photo-actions .btn { width: 100%; }

/* Цены: таблица в своей рамке, прокрутка внутри плитки, заголовки столбцов и названия строк липкие. */
.price-window { margin: 0 0 12px; }
.price-block .tile-head .tag { flex: none; }
.tile > .prices-scroll, .prices-scroll {
  position: relative; /* скрытые подписи клеток (.sr-only) остаются внутри прокрутки */
  width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.tile > .prices-scroll:last-child { margin-bottom: 0; }
/* Телефон: таблица не ограничена по высоте (без вложенной вертикальной прокрутки), липкий только столбец названий;
   с 768 px — своя высота, заголовки столбцов липнут сверху. */
@media (min-width: 768px) {
  .tile > .prices-scroll, .prices-scroll { max-height: min(70vh, 640px); overflow: auto; overscroll-behavior-x: contain; }
}
.table.prices { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; }
.table.prices caption { caption-side: top; padding: 10px 12px 4px; text-align: left; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.table.prices thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.table.prices tbody th {
  position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line);
  min-width: 7em; max-width: 8.5em; padding: 8px 10px; text-align: left; font-size: 0.9rem; font-weight: 500; color: var(--ink);
  white-space: normal; overflow-wrap: break-word; hyphens: auto; vertical-align: middle;
}
.table.prices thead th:first-child { left: 0; z-index: 3; box-shadow: 1px 0 0 var(--line); }
.table.prices td { padding: 6px 8px; vertical-align: middle; }
@media (min-width: 600px) { .table.prices tbody th { max-width: 14em; padding: 8px 12px; } }
.table.prices tbody tr:last-child > * { border-bottom: 0; }
.prices input[type="text"] { width: 7.5em; min-height: var(--tap); padding: 8px 10px; font: inherit; font-variant-numeric: tabular-nums; text-align: right; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.prices input[readonly] { background: var(--bg); color: var(--muted); }
.prices td.has-error input { border-color: var(--danger); }
.prices td .field-error { max-width: 10em; margin-left: auto; white-space: normal; text-align: right; font-size: 0.8rem; }
.diff-tile .diff-text { font-family: var(--font); font-size: 1rem; font-weight: 500; }

/* Карточка турфирмы: форма слева, доступ и заказы — колонка справа на компьютере. */
.card-layout { display: grid; gap: 12px; align-items: start; }
.card-main, .card-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.card-side > .tile + .tile { margin-top: 0; }
@media (min-width: 1024px) {
  .card-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; }
}
.bform .fblock > fieldset.choice { margin: 4px 0 0; }
.choice-error { flex-basis: 100%; }
.terms-note { margin: 0 0 14px; }
.invite-once { margin: 0 0 12px; }
.invite-once p { margin: 0 0 10px; }
.invite-copy { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-copy input[type="text"] { flex: 1 1 14em; width: auto; min-width: 0; color: var(--ink); font-size: 0.85rem; }
.account-row { flex-wrap: wrap; }
.account-row .row-main { flex: 1 1 12em; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.invite-form { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.invite-form .actions { margin-top: 0; }

/* Отчёт турфирмы за месяц (у персонала и в кабинете): фильтр, месяцы, итоги крупными цифрами, таблица в плитке. */
.report-bar { display: grid; gap: 12px; margin: 0 0 12px; }
.report-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.report-filter .field { flex: 1 1 12em; margin: 0; }
.report-filter-submit { flex: none; }
.report-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.report-month { order: -1; flex-basis: 100%; font-size: 1.35rem; line-height: 1.2; }
.report-csv { margin-left: auto; }
@media (min-width: 600px) {
  .report-month { order: 0; flex-basis: auto; padding: 0 6px; }
}
/* Итоги — сеткой: в колонку на узком телефоне, по 2–5 в ряд шире (без растяжения по высоте у .sums в колонку). */
.sums.report-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10em), 1fr)); gap: 12px 24px; }
.report-sums dd { font-size: 1.45rem; }
.report-table td { vertical-align: middle; }
.report-table td > a { display: inline-flex; align-items: center; min-width: var(--tap); min-height: var(--tap); margin: -12px 0; font-weight: 600; }

/* ---------------------------------------------------------------- кабинет турфирмы */
/* Наличие и цены: на телефоне подбор → выдача → заявка; с 1024 px подбор и заявка — колонка слева, выдача справа. */
.search-layout { display: grid; gap: 12px; align-items: start; grid-template-areas: "form" "offers" "cart"; }
.search-form { grid-area: form; }
.search-layout > .offers { grid-area: offers; }
.search-cart { grid-area: cart; min-width: 0; }
.search-cart:not(:has(*)) { display: none; }
.search-prop { margin: 0 0 14px; }
.offers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: start; min-width: 0; }
.offers > .tile + .tile { margin-top: 0; }
.offers > p { grid-column: 1 / -1; margin: 0; }
.offer .table.calc { margin-top: 0; }
.offer-note { margin: 0 0 8px; }
.offer-add { align-items: center; }
.offer-add .btn { flex: 1 1 auto; }
/* Итог «Добавить в заявку» — строкой прямо под кнопкой (приходит в ответе корзины, hx-swap-oob). */
.add-status { margin: 8px 0 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.add-status:empty { margin: 0; }
.add-status-ok { color: var(--accent); font-weight: 600; }
.add-status-error { color: var(--danger); }
.cart .table.calc { margin-bottom: 0; }
.cart-go .btn { flex: 1 1 auto; }
/* В корзине пояснение (даты, гости) длинное — переносится; в выдаче и карточке «3 × 7 200» не рвётся. */
.cart .table.calc .muted { white-space: normal; }
@media (min-width: 1024px) {
  .search-layout { grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "form offers" "cart offers"; gap: 16px; }
  .search-cart { position: sticky; top: 20px; }
}

/* Заявка: блоки по домикам, бани и контакт; расчёт и отправка — липкая колонка (.form-layout). */
.form-note { margin: 0; }
.bath-row .row-main { flex: 1 1 auto; }

/* Мои заявки: фильтр-«таблетки» и поиск, строки с суммой и меткой статуса. */
.orders-filter { margin: 0 0 12px; }
.orders-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.orders-search .field { flex: 1 1 14em; margin: 0; }
.row-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-sum { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pager { justify-content: center; }
.cancel-text { margin: 0 0 14px; }

/* Иностранные гости: список в строке проживания и на «Сегодня», печать уведомления. */
.foreign-block { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.foreign-title { margin: 0 0 4px; font-size: 0.95rem; }
.foreign-block > .btn { margin-top: 8px; }
.foreign-row { flex-wrap: wrap; }
.foreign-row > .row-main { flex: 1 1 14em; color: inherit; text-decoration: none; }
.foreign-row > .row-main:hover { color: var(--accent); }
.foreign-row .foreign-actions { margin: 0; }
.foreign-delete { margin-top: 12px; }
.foreign-print th { text-align: left; font-weight: 600; width: 45%; }
@media print {
  .sidebar, .topbar, .bottom-nav, .skip-link, .messages, .no-print { display: none !important; }
  /* На бумаге только сведения: кнопки и формы действий не нужны (заявка турфирмы для бухгалтера). */
  main form, main .line-actions, main details.decline, main details.help { display: none !important; }
  body, .tile { background: var(--card); }
  .foreign-print { border: 0; padding: 0; }
}

/* Уборка: строка — домик, срочное (заезд сегодня, а не убрано) — янтарём; кнопки во всю ширину на телефоне. */
.hk-row { flex-wrap: wrap; }
.hk-row > .row-main { flex: 1 1 10em; }
.hk-row > .tag { flex: none; }
.hk-arrival { color: var(--muted); font-size: 0.9rem; }
.hk-arrival.is-urgent { color: var(--warn); font-weight: 600; }
.hk-actions { flex: 1 1 100%; }
.hk-actions form { margin: 0; flex: 1 1 0; display: flex; }
.hk-actions .btn { flex: 1 1 auto; }
@media (min-width: 600px) {
  .hk-actions { flex: none; }
  .hk-actions form { flex: none; }
}
/* Метка у номера в шахматке: «нужна уборка» / «убирается» — точка, полосы броней не трогает. */
.hk-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; vertical-align: middle; background: var(--warn); }
.hk-dot.hk-cleaning { background: var(--card); box-shadow: inset 0 0 0 2px var(--warn); }

/* Панель владельца: плитки показателей (на телефоне — в столбик), полоски загрузки по дням — без библиотек. */
.kpi-tiles { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 0 0 12px; }
@media (min-width: 720px) { .kpi-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi-tiles > .tile + .tile { margin-top: 0; }
.kpi-tiles + .tile, .tile + .kpi-tiles { margin-top: 12px; }
.kpi p { margin: 0 0 4px; }
.kpi-value { font-family: var(--serif); font-size: 2rem; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-change { font-weight: 600; }
.kpi-up { color: var(--accent); }
.kpi-down { color: var(--danger); }
.kpi-muted { color: var(--muted); font-weight: 400; }
.day-bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; margin: 0; padding: 0 0 18px; list-style: none; }
.day-bar { position: relative; flex: 1 1 0; min-width: 0; height: 100%; border-radius: 3px 3px 0 0; background: var(--neutral); }
.day-fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--load, 0%); border-radius: inherit; background: var(--accent); }
.day-num { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 2px; color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
@media (max-width: 599px) { .day-bar:not(:first-child):not(:nth-child(5n)) .day-num { display: none; } }
.day-bar.is-off { background: repeating-linear-gradient(135deg, var(--neutral) 0 3px, var(--card) 3px 6px); }

/* План уборки (staff/_cleaning_plan.html): список для старшей горничной, печатается. */
.cleaning-plan { margin-bottom: var(--space-4); padding: var(--space-4); }
.plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.plan-days { display: flex; align-items: center; gap: var(--space-2); }
.plan-days a { padding: var(--space-2) var(--space-3); border-radius: var(--pill); color: var(--ink); text-decoration: none; }
.plan-days a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.plan-group { margin: var(--space-4) 0 var(--space-1); font-size: 0.95rem; }
.plan-urgent { color: var(--danger); }
.plan-list { margin: var(--space-1) 0 0; padding-left: var(--space-5); }
.plan-list li { padding: var(--space-1) 0; }

/* Шахматка: красная полоса между соседними бронями — выезд и заезд в один день (как в прежней сетке). */
.chess-cell.is-turnover { box-shadow: inset 3px 0 0 var(--danger); }
.swatch.s-turnover { background: var(--danger); width: 4px; }

/* «Уборка на завтра» на «Сегодня»: номера на глазах. */
.plan-today { padding: var(--space-3) var(--space-4) var(--space-4); }
.plan-today p { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.plan-today-note { color: var(--warn); font-weight: 600; }
.search-limit { padding: var(--space-3) var(--space-4); }

/* Редактор страницы номера на сайте. */
.site-page-link { margin-left: var(--space-2); font-size: 0.85rem; }
.site-fact, .site-cond { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.site-fact:first-of-type, .site-cond:first-of-type { border-top: 0; }
.site-icons { flex-wrap: wrap; }

/* Поиск: строка закреплена вверху при прокрутке, одна карточка на гостя. */
.search-bar { position: sticky; top: 0; z-index: 5; padding: var(--space-2) 0; background: var(--card); }
@media (max-width: 1023px) { .search-bar { top: 56px; } } /* под закреплённой панелью телефона */
.search-guest { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.search-guest:last-child { border-bottom: 0; }
.search-guest-head { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: baseline; padding: 0 var(--space-1); }
.search-orders { margin: var(--space-1) 0 0; padding: 0; list-style: none; }
.search-no-orders { margin: var(--space-1) 0 0; padding: 0 var(--space-1); }
