/*
 * Калипсо PMS — оформление админки в духе кабинета TravelLine:
 * тёмно-синее боковое меню с раскрывающимися разделами, светло-серый фон
 * контента, синие кнопки с тонкой рамкой, плотная шахматка.
 * Значения размеров и цветов сняты с образцов страниц (reference/, не в git).
 */
:root {
  --primary: #1565c0;
  --primary-dark: #0e4f9a;
  --primary-soft: #e3f2fd;
  --primary-soft-2: #bbdefb;
  --bg: #eff2f5;
  --card-bg: #ffffff;
  --text: #364963;
  --muted: #8095b3;
  --border: #cfd7e2;
  --border-strong: #9fafc6;
  --border-light: #dfe4ec;
  --panel: #d7dce3;
  --danger: #e80000;
  --danger-soft: #fdecec;
  --success: #4caf50;
  --success-soft: #e8f5e9;
  --info: #1565c0;
  --info-soft: #e3f2fd;
  --warning: #fd952c;
  --warning-soft: #fff3e0;
  --sidebar-head: #243143;
  --sidebar-bg: #364963;
  --sidebar-sub: #476185;
  --sidebar-line: #243143;
  --sidebar-text: #ffffff;
  --radius: 3.5px;
  --radius-card: 7px;
  --font: "Open Sans", Arial, Helvetica, sans-serif;
  --shadow-pop: 0 4px 16px rgba(36, 49, 67, .22);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
}
a { color: var(--primary); }
button { font-family: inherit; }

.app-shell { display: flex; min-height: 100vh; }

/* ===================== Боковое меню ===================== */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1b2534 transparent;
}
.sidebar .brand {
  background: var(--sidebar-head);
  height: 50px;
  padding: 0 14px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-dots { display: flex; flex-direction: column; gap: 3px; padding: 0 4px; }
.brand-dots i { width: 4px; height: 4px; border-radius: 50%; background: #fff; display: block; }
.brand-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 16px; min-width: 0; }
.brand-name, .brand-city { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-nav { display: flex; flex-direction: column; }
.nav-group { border-bottom: 0.8px solid var(--sidebar-line); }
.nav-group-head {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 0 8px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border: 0;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.nav-group-head:hover { background: #3e5272; }
.nav-icon {
  width: 24px; height: 24px; flex-shrink: 0;
  fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.nav-group-label { flex: 1; }
.nav-caret {
  width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease;
}
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-group-body {
  max-height: 0;
  overflow: hidden;
  background: var(--sidebar-sub);
  transition: max-height .25s ease;
}
.nav-group-body a {
  display: block;
  height: 41px;
  line-height: 40px;
  padding: 0 16px 0 42px;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  border-top: 0.8px solid var(--sidebar-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s ease;
}
.nav-group-body a:hover { background: #557096; }
.nav-group-body a.active { background: var(--bg); color: var(--text); }

/* ===================== Контент и верхняя панель ===================== */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #eaf2fb 0%, #f6eef6 55%, #fbe6ec 100%);
  box-shadow: 0 1px 3px rgba(36, 49, 67, .18);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { padding-left: 24px; font-size: 13px; color: var(--muted); }
.user-menu { position: relative; height: 100%; }
.user-chip {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 0;
  font-size: 15px;
  cursor: pointer;
  max-width: 260px;
}
.user-chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.user-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown { right: 0; left: auto; top: 100%; min-width: 200px; }

.page { padding: 24px 32px 40px; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 24px; gap: 12px; flex-wrap: wrap; }
.page-header h1, h1.page-title { font-size: 36px; line-height: 44px; margin: 0; font-weight: 400; color: var(--text); }
h2 { font-size: 18px; line-height: 24px; margin: 24px 0 12px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.muted { color: var(--muted); }
.page-subnav { display: flex; gap: 24px; margin-bottom: 18px; font-size: 14px; border-bottom: 0.8px solid var(--border); }
.page-subnav a { color: var(--text); text-decoration: none; padding: 0 0 8px; display: inline-block; border-bottom: 2px solid transparent; }
.page-subnav a.active, .page-subnav a:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* ===================== Кнопки ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 4px 12px 5px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  border: 0.8px solid var(--primary);
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn:active { background: #0b417f; }
.btn:focus-visible { outline: 2px solid var(--primary-soft-2); outline-offset: 1px; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn-primary { /* синоним основной кнопки */ }
.btn-secondary, .btn-default { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover, .btn-default:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.btn-secondary:active, .btn-default:active { background: var(--primary-soft-2); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #3d8b40; border-color: #3d8b40; }
.btn-danger { background: #fff; color: #d32f2f; border-color: #d32f2f; }
.btn-danger:hover { background: var(--danger-soft); color: #d32f2f; border-color: #d32f2f; }
.btn-muted { background: #fff; color: var(--muted); border-color: #bfc9d9; }
.btn-muted:hover { background: var(--bg); color: var(--text); border-color: #bfc9d9; }
.btn-sm { height: 26px; padding: 2px 8px 3px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn svg, .btn-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-plus::before { content: "+"; font-size: 20px; line-height: 18px; font-weight: 300; margin-right: 2px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn + .btn { margin-left: -0.8px; }
.btn-group .btn.active { background: var(--primary-soft-2); color: var(--primary); }

/* Кнопка-фильтр «Статус: все ⌄» с выпадающим списком */
.filter-dd { position: relative; display: inline-block; }
.filter-dd-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 5px;
  background: #fff;
  color: var(--primary);
  border: 0.8px solid var(--primary);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-dd-btn b { font-weight: 700; }
.filter-dd-btn::after {
  content: ""; width: 6px; height: 6px; margin: -3px 0 0 4px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg);
}
.filter-dd-btn:hover { background: var(--primary-soft); }

/* ===================== Выпадающие меню ===================== */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  background: #fff;
  border-radius: 4px;
  box-shadow: var(--shadow-pop);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
}
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0); transition: opacity .12s ease, transform .12s ease; }
.dropdown-menu a, .dropdown-menu button, .dropdown-menu label {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 16px; font-size: 14px; color: var(--text); text-decoration: none;
  background: none; border: 0; text-align: left; cursor: pointer; white-space: nowrap;
}
.dropdown-menu a:hover, .dropdown-menu button:hover, .dropdown-menu label:hover { background: var(--primary-soft); }
.dropdown-caption { padding: 4px 16px 6px; font-size: 12px; color: var(--muted); }

/* ===================== Карточки и сообщения ===================== */
.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px; border: 0.8px solid transparent; }
.alert-error { background: var(--danger-soft); color: #c62828; border-color: #f5c2c2; }
.alert-success { background: var(--success-soft); color: #2e7d32; border-color: #c8e6c9; }
.alert-info { background: var(--info-soft); color: var(--primary); border-color: var(--primary-soft-2); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; background: var(--panel); padding: 8px; border-radius: var(--radius-card); }
.stat-card { background: #fff; border-radius: var(--radius-card); padding: 16px; }
.stat-value { font-size: 32px; line-height: 40px; font-weight: 300; color: var(--text); }
.stat-label { color: var(--text); font-size: 14px; margin-top: 4px; }

.badge {
  display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 18px; font-weight: 400;
  color: #fff; text-transform: uppercase; vertical-align: middle;
}
.badge-muted { background: #9ca8b9; }
.badge-danger { background: #dc3545; }
.badge-outline { background: #fff !important; border: 0.8px solid currentColor; }

/* ===================== Формы ===================== */
.form-card { background: #fff; border-radius: var(--radius-card); padding: 24px; max-width: 640px; }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-grid .field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.form-grid .field input[type=text], .form-grid .field input[type=number], .form-grid .field input[type=date],
.form-grid .field input[type=email], .form-grid .field input[type=password], .form-grid .field input[type=tel],
.form-grid .field input[type=time], .form-grid .field select, .form-grid .field textarea,
.filter-bar select, .filter-bar input, .input {
  width: 100%;
  height: 32px;
  padding: 5px 10px;
  border: 0.8px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-grid .field textarea { height: auto; min-height: 72px; }
.form-grid .field input:focus, .form-grid .field select:focus, .form-grid .field textarea:focus,
.filter-bar select:focus, .filter-bar input:focus, .input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21, 101, 192, .15);
}
.input::placeholder { color: #a6b3c6; }
.form-grid .field.has-error input, .form-grid .field.has-error select { border-color: #d32f2f; }
.form-grid .field-error { color: #d32f2f; font-size: 12px; margin-top: 4px; }
.form-grid .checkbox-field { display: flex; align-items: center; gap: 8px; }
.form-grid .checkbox-field label { margin: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-row { display: flex; gap: 16px; }
.form-row .field { flex: 1; }
.inline-form { display: inline; }

.filter-bar {
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 4px; }
.filter-bar label { font-size: 12px; color: var(--muted); }
.filter-bar select, .filter-bar input { min-width: 160px; width: auto; }

/* ===================== Таблицы ===================== */
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { padding: 12px; text-align: left; font-size: 14px; border-bottom: 0.8px solid var(--border-light); vertical-align: middle; }
.data-table th { background: var(--panel); color: var(--text); font-weight: 400; line-height: 20px; }
.data-table tr:hover td { background: var(--primary-soft); }
.data-table td a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: .8px; }
.data-table .actions { display: flex; gap: 6px; white-space: nowrap; }
.data-table .actions a { text-decoration: none; }
.data-table .empty-row td { text-align: center; color: var(--muted); padding: 32px; }
.row-muted td, .row-muted a { color: var(--muted); }

/* ===================== Вход ===================== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--sidebar-bg); }
.auth-card { background: #fff; padding: 32px; border-radius: var(--radius-card); width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 400; }
.auth-card .muted { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-card label { display: block; font-size: 14px; margin-bottom: 14px; color: var(--muted); }
.auth-card input {
  width: 100%; height: 36px; padding: 6px 10px; margin-top: 4px;
  border: 0.8px solid var(--border-strong); border-radius: var(--radius); font-size: 14px; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,101,192,.15); }
.auth-card button {
  width: 100%; height: 36px; background: var(--primary); color: #fff; border: 0.8px solid var(--primary);
  border-radius: var(--radius); font-size: 15px; cursor: pointer; margin-top: 8px;
}
.auth-card button:hover { background: var(--primary-dark); }

/* ===================== Шахматка: сводка вверху ===================== */
.stats-toggle {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0;
  color: var(--primary); font-size: 14px; cursor: pointer; border-bottom: 1px dashed currentColor;
}
.stats-toggle::before {
  content: ""; width: 6px; height: 6px; border-left: 1.6px solid currentColor; border-top: 1.6px solid currentColor;
  transform: rotate(45deg); margin-top: 3px; transition: transform .2s ease;
}
.stats-toggle.collapsed::before { transform: rotate(225deg); margin-top: -3px; }
.stats-spoiler { overflow: hidden; transition: max-height .3s ease, opacity .3s ease, margin .3s ease; margin-bottom: 24px; }
.stats-spoiler.collapsed { opacity: 0; margin-bottom: 0; }
.stats-panel { display: grid; grid-template-columns: 300px minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 16px; background: var(--panel); padding: 16px; border-radius: var(--radius-card); }
.stats-card { background: #fff; border-radius: var(--radius-card); padding: 16px 20px; min-height: 184px; }
.stats-card-title { display: flex; justify-content: space-between; align-items: center; font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.stats-help { width: 16px; height: 16px; border-radius: 50%; border: 1.3px solid #9ca8b9; color: #9ca8b9; font-size: 11px; line-height: 13px; text-align: center; font-weight: 600; cursor: help; }
.load-box { display: flex; gap: 14px; }
.load-percent {
  width: 92px; height: 92px; border-radius: 5px; background: #fc5630; color: #fff;
  font-size: 32px; font-weight: 300; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.load-percent.mid { background: #fd952c; }
.load-percent.high { background: #50ac58; }
.load-figures { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 4px; }
.load-figures span { font-size: 13px; }
.load-figures b { font-size: 24px; line-height: 28px; font-weight: 400; margin-right: 4px; }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { display: flex; align-items: center; gap: 10px; height: 30px; border-bottom: 0.8px solid var(--border-light); font-size: 13px; }
.summary-list li i { width: 8px; height: 8px; flex-shrink: 0; }
.summary-list li a, .summary-list li span.lbl { flex: 1; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: .8px; }
.summary-list li span.lbl { color: var(--text); text-decoration: none; }
.bar-list { display: grid; grid-template-columns: auto 1fr 24px; gap: 6px 10px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; background: #eff4f7; position: relative; }
.bar-track span { position: absolute; left: 0; top: 0; bottom: 0; }

/* ===================== Шахматка: панель действий и фильтры ===================== */
.chart-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.chart-search { display: flex; gap: 4px; flex: 0 1 720px; }
.chart-search .input { background: var(--bg); }
.search-wrap { position: relative; flex: 1; }
.search-wrap svg { position: absolute; right: 8px; top: 8px; width: 16px; height: 16px; fill: none; stroke: #a6b3c6; stroke-width: 2; }
.chart-filters { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-filters-left { display: flex; gap: 4px; flex-wrap: wrap; }
.chart-filters-right { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.dd-check { gap: 10px !important; }
.dd-check input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }

/* ===================== Шахматка: сетка ===================== */
.chart-frame { position: relative; --left: 284px; --cell: 44px; }
.chart-frame:has(.view-day) { --cell: 88px; }
.chart-frame > .chart-nav { position: absolute; top: 0; z-index: 12; border-left: 0.8px solid var(--border); }
.chart-frame > .chart-nav-prev { left: var(--left); }
.chart-frame > .chart-nav-next { right: 0; }
.chart-wrap {
  --row: 24px;
  background: #fff;
  border-top: 0.8px solid var(--border);
  overflow: auto;
  max-height: calc(100vh - 70px);
  font-size: 12px;
  line-height: 16px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #9ca8b9 var(--bg);
}
.chart-grid { width: max-content; min-width: 100%; position: relative; }
.chart-row { display: flex; height: var(--row); }
.chart-left {
  width: var(--left); flex-shrink: 0; position: sticky; left: 0; z-index: 6;
  background: #fff; border-right: 0.8px solid var(--border); border-bottom: 0.8px solid var(--border);
  display: flex; align-items: center; padding: 0 8px; gap: 6px;
}
.chart-days { display: flex; position: relative; }
.chart-c {
  width: var(--cell); flex-shrink: 0; height: var(--row);
  border-right: 0.8px solid var(--border); border-bottom: 0.8px solid var(--border);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.chart-c.we { background: rgba(227, 242, 253, .8); }

/* Шапка: дата + «Сегодня», месяцы, дни */
.chart-head { position: sticky; top: 0; z-index: 8; background: #fff; }
.chart-head .chart-left { height: 82px; flex-direction: column; align-items: stretch; justify-content: space-between; padding: 8px 8px 6px; border-bottom-color: var(--border); }
.chart-head-controls { display: flex; gap: 8px; }
.date-field {
  position: relative; display: flex; align-items: center; height: 36px; flex: 1;
  background: var(--bg); border: 0.8px solid var(--border-strong); border-radius: 4px; padding: 0 8px;
}
.date-field input {
  border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text); width: 100%; outline: none; padding: 0;
}
.date-field input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.today-btn {
  height: 36px; padding: 0 10px; background: #fff; border: 0.8px solid var(--border-strong); border-radius: 4px;
  color: var(--primary); font-size: 14px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center;
}
.today-btn:hover { background: var(--primary-soft); }
.collapse-all { background: none; border: 0; padding: 0; color: var(--text); font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.caret-up {
  width: 7px; height: 7px; border-left: 1.6px solid currentColor; border-top: 1.6px solid currentColor;
  transform: rotate(45deg); margin-top: 4px; transition: transform .2s ease; flex-shrink: 0;
}
.collapsed > .caret-up, .collapsed .caret-up { transform: rotate(225deg); margin-top: -4px; }
.chart-head-right { display: flex; flex-direction: column; }
.chart-months { display: flex; height: 36px; }
.chart-month { display: flex; align-items: center; padding-left: 10px; background: rgba(239, 242, 245, .5); border-right: 0.8px solid var(--border); white-space: nowrap; overflow: hidden; font-size: 13px; }
.chart-month:first-child { background: var(--bg); padding-left: calc(var(--cell) + 12px); }
.view-day .chart-month:first-child { padding-left: 56px; }
.chart-nav {
  width: 44px; flex-shrink: 0; height: 36px; border: 0; border-right: 0.8px solid var(--border);
  background: #fff; color: var(--primary); display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.chart-nav:hover { background: var(--primary-soft); }
.chart-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-dayhead .chart-c { height: 46px; flex-direction: column; font-size: 13px; line-height: 18px; border-top: 0.8px solid var(--border); }
.chart-dayhead .chart-c small { color: #9ca8b9; font-size: 12px; }

/* Строки категорий и номеров */
.chart-cat .chart-left, .chart-cat .chart-c { background: var(--bg); }
.chart-cat .chart-c.we { background: #e2ecf6; }
.chart-cat .chart-left { cursor: pointer; user-select: none; }
.chart-cat .chart-left .cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-cat .chart-c.full { color: #d32f2f; }
.chart-unassigned .chart-left { justify-content: flex-end; }
.chart-unassigned .chart-c, .chart-unassigned .chart-left { background: #fafbfc; }
.chart-unassigned .chart-c.has { background: #9fd8d3; }
button.chart-c.has { border-top: 0; border-left: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
button.chart-c.has:hover, button.chart-c.has:focus-visible { background: #6fc3bb; outline: none; }
.res-pick-title { font-weight: 600; margin-bottom: 10px; }
.res-pick { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px; border: 0.8px solid var(--border); border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; }
.res-pick:hover { background: var(--primary-soft); }
.chart-room .chart-left { justify-content: space-between; }
.room-floor { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-num { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; }
.room-num:hover { color: var(--primary); }
.room-num:disabled { cursor: default; color: var(--text); }
.room-state { width: 20px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }
.room-state svg { width: 18px; height: 18px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-group { overflow: hidden; overflow: clip; transition: max-height .25s ease; }


.chart-room .chart-c.free { cursor: pointer; }
.chart-room .chart-c.free:hover { background: var(--primary-soft); }
.chart-room .chart-c.free:hover::after { content: "+"; color: var(--primary); font-size: 16px; }

/* Полосы броней */
.res-bar {
  position: absolute; top: 2px; height: 20px; z-index: 3;
  display: flex; align-items: stretch;
  font-size: 11px; line-height: 18px; color: var(--text);
  border: 0.8px solid; border-radius: 2px; overflow: hidden; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: box-shadow .12s ease;
}
.res-bar:hover { box-shadow: 0 2px 6px rgba(36, 49, 67, .35); z-index: 4; }
.res-bar .res-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: clip; padding: 0 4px; }
.res-bar .res-sum { background: #607d8b; color: #fff; padding: 0 4px; flex-shrink: 0; }
.res-bar.cut-left { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.res-bar.cut-right { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.res-bar.st-new, .res-bar.st-confirmed { background: rgba(139, 195, 74, .75); border-color: #4caf50; }
.res-bar.st-checked_in { background: rgba(156, 39, 176, .35); border-color: #9c27b0; border-style: dotted; border-width: 1.6px; }
.res-bar.st-checked_in .res-mark { width: 5px; background: #009688; flex-shrink: 0; }
.res-bar.st-awaiting_payment { background: rgba(255, 193, 7, .45); border-color: #f0ad4e; border-style: dashed; }
.res-bar.st-checked_out { background: rgba(96, 125, 139, .3); border-color: #607d8b; }
.res-bar.st-other { background: rgba(244, 67, 54, .5); border-color: #f44336; }
.res-bar.hidden-by-filter { display: none; }

.now-line { position: absolute; top: 82px; bottom: 0; width: 1.6px; background: var(--primary); z-index: 5; pointer-events: none; }
.now-line::before { content: ""; position: absolute; top: -3px; left: -2.7px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 14px; font-size: 12px; color: var(--muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-swatch { width: 22px; height: 12px; border: 0.8px solid; border-radius: 2px; display: inline-block; }
.chart-legend-swatch.st-new, .chart-legend-swatch.st-confirmed { background: rgba(139, 195, 74, .75); border-color: #4caf50; }
.chart-legend-swatch.st-checked_in { background: rgba(156, 39, 176, .35); border: 1.6px dotted #9c27b0; }
.chart-legend-swatch.st-checked_out { background: rgba(96, 125, 139, .3); border-color: #607d8b; }

/* ===================== Модальное окно (номер: категория/состояние) ===================== */
.room-popup-overlay {
  position: fixed; inset: 0; background: rgba(36, 49, 67, .5); display: flex;
  align-items: center; justify-content: center; z-index: 70;
  opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility 0s linear .15s;
}
.room-popup-overlay.open { opacity: 1; visibility: visible; transition: opacity .15s ease; }
.room-popup-overlay[hidden] { display: none; }
.room-popup {
  background: #fff; border-radius: 4px; width: 420px; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,.3); transform: translateY(-12px); transition: transform .15s ease;
}
.room-popup-overlay.open .room-popup { transform: translateY(0); }
.room-popup-header {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 0.8px solid var(--border-light); font-size: 20px; font-weight: 400;
}
.room-popup-close { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: #9ca8b9; padding: 0; }
.room-popup-close:hover { color: var(--text); }
.room-popup-field { padding: 14px 20px 0; }
.room-popup-field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.room-popup-field select {
  width: 100%; height: 32px; padding: 4px 8px; border: 0.8px solid var(--border-strong); border-radius: var(--radius); font-size: 14px; font-family: inherit; color: var(--text); background: #fff;
}
.room-popup-statuses { display: flex; flex-direction: column; }
.room-status-option { display: flex !important; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 3px; cursor: pointer; font-size: 14px; color: var(--text) !important; margin: 0 !important; }
.room-status-option:hover { background: var(--primary-soft); }
.room-status-option input { accent-color: var(--primary); margin: 0; }
.room-status-icon { width: 20px; display: inline-flex; justify-content: center; }
.room-status-icon svg { width: 18px; height: 18px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.room-popup-actions { display: flex; gap: 8px; padding: 18px 20px 20px; }

/* ===================== Боковая панель брони (выезжает справа) ===================== */
.res-panel-overlay { position: fixed; inset: 0; z-index: 60; visibility: hidden; transition: visibility 0s linear .25s; }
.res-panel-overlay.open { visibility: visible; transition: none; }
.res-panel-overlay[hidden] { display: none; }
.res-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 472px; max-width: 100vw;
  background: #fff; box-shadow: -4px 0 16px rgba(36, 49, 67, .25);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.res-panel-overlay.open .res-panel { transform: translateX(0); }
.res-panel-header { position: absolute; top: 8px; right: 10px; z-index: 2; }
.res-panel-header span { display: none; }
.res-panel-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.res-panel-loading { color: var(--muted); padding: 40px 0; text-align: center; }
.rp-title { font-size: 26px; line-height: 34px; font-weight: 300; padding: 18px 40px 14px 20px; border-bottom: 0.8px solid var(--border-light); margin: 0; }
.rp-scroll { flex: 1; overflow-y: auto; padding: 0 20px; scrollbar-width: thin; }
.rp-section { display: grid; grid-template-columns: 195px 1fr; gap: 6px 12px; padding: 18px 0; border-bottom: 0.8px solid var(--border-light); font-size: 15px; line-height: 24px; }
.rp-section:last-child { border-bottom: 0; }
.rp-section dt { color: var(--muted); }
.rp-section dd { margin: 0; word-break: break-word; }
.rp-status { display: inline-block; border: 0.8px solid #4caf50; color: #4caf50; border-radius: 10px; padding: 0 8px; font-size: 12px; line-height: 18px; text-transform: uppercase; }
.rp-footer { display: flex; gap: 8px; padding: 16px 20px; border-top: 0.8px solid var(--border-light); box-shadow: 0 -2px 6px rgba(36,49,67,.06); }
.rp-footer form { display: contents; }
.rp-footer .btn { height: 36px; }
.rp-footer .btn-icon { width: 40px; }

/* Не переносить номера броней, ссылки и бейджи в таблицах */
.data-table td a, .data-table .badge { white-space: nowrap; }
.chart-month { text-overflow: ellipsis; }

/* ===================== Категория: «Описание, фото и удобства» ===================== */
.sc-card { background: #fff; border-radius: var(--radius-card); padding: 20px 24px; margin-bottom: 16px; }
.sc-card h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.sc-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px 16px; margin-top: 8px; }
@media (max-width: 900px) { .sc-grid { grid-template-columns: 1fr 1fr; } }
.sc-grid .field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.sc-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 3px 0; }
.sc-check input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.sc-search { max-width: 360px; margin: 6px 0 12px; }
.sc-group { border-top: 0.8px solid var(--border-light); }
.sc-group:last-child { border-bottom: 0.8px solid var(--border-light); }
.sc-group-head { width: 100%; display: grid; grid-template-columns: 220px 1fr 20px; gap: 12px; align-items: center; padding: 10px 4px; background: none; border: 0; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.sc-group-head:hover { background: var(--primary-soft); }
.sc-group-name { color: var(--primary); text-decoration: underline dashed; text-underline-offset: 4px; }
.sc-group-sum { color: var(--text); }
.sc-group-head svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s ease; }
.sc-group.open .sc-group-head svg { transform: rotate(180deg); }
.sc-group-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sc-items { columns: 3 220px; column-gap: 24px; padding: 4px 4px 14px 236px; }
@media (max-width: 900px) { .sc-items { padding-left: 4px; } .sc-group-head { grid-template-columns: 1fr 20px; } .sc-group-sum { grid-column: 1; } }
.sc-actions { display: flex; gap: 8px; margin: 0 0 24px; }
.sc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.sc-photo { margin: 0; position: relative; border: 0.8px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg); }
.sc-photo.is-cover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.sc-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.sc-photo figcaption { display: flex; gap: 6px; padding: 8px; flex-wrap: wrap; }
.sc-photo form { display: inline; }
.sc-cover-badge { position: absolute; left: 8px; top: 8px; background: var(--primary); color: #fff; font-size: 12px; padding: 1px 8px; border-radius: 10px; }
.sc-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Календарь цен тарифа: строки цены, доплаты, минимума ночей и закрытия продаж */
.rate-cell { padding: 2px; text-align: center; }
.rate-input { width: 100%; min-width: 64px; box-sizing: border-box; padding: 3px 4px; border: 1px solid var(--border, #d5dbe3); border-radius: 3px; font-size: 12px; text-align: right; background: #fff; }
.rate-row-price td { border-top: 2px solid #c9d3df; }
.rate-row-price:first-child td { border-top: 0; }
.rate-row .chart-room-col small { color: #6b7a90; }
.rate-cell.rate-closed { background: #fde3e3; }

/* ===================== Профили гостей ===================== */
.guests-search { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.guests-search input[type=search] { flex: 0 1 500px; height: 32px; padding: 4px 12px; border: 0.8px solid #bfc9d9; border-radius: var(--radius); font-size: 14px; }
.guests-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 0.8px solid #d5dbe3; flex-wrap: wrap; }
.guests-toolbar-side { display: flex; gap: 8px; flex-wrap: wrap; }
.guests-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.guests-filters-dd { display: flex; gap: 6px; flex-wrap: wrap; }
.guests-count { color: var(--muted); font-size: 13px; margin-left: auto; }
.guests-filters-bottom { justify-content: flex-end; margin-top: 12px; }
.dropdown-menu a.active { color: var(--primary); font-weight: 600; }
.dropdown-menu-right { left: auto; right: 0; min-width: 160px; }
.dropdown-menu form { margin: 0; }
.dropdown-menu button.danger { color: #c62828; }
.row-menu { position: relative; display: inline-block; }
.guests-table th { white-space: normal; vertical-align: bottom; }
.guests-table td.num, .guests-table th.num { text-align: right; }
.guests-table td.num { white-space: nowrap; }
.pager { display: inline-flex; gap: 4px; align-items: center; }
.pager-btn {
  min-width: 26px; height: 26px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  border: 0.8px solid #bfc9d9; border-radius: 3px; background: #fff; color: var(--primary); font-size: 13px; text-decoration: none;
}
.pager-btn:hover { background: var(--primary-soft); }
.pager-btn.active { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
.pager-btn.disabled { color: #bfc9d9; pointer-events: none; }
.pager-gap { color: var(--muted); padding: 0 2px; }

/* Чекбоксы в столбик (формы скидок) */
.checkbox-line { display: flex !important; align-items: center; gap: 8px; font-size: 14px; color: var(--text) !important; margin: 4px 0; }

/* ===================== Отчёт «Туристический налог» (как в TravelLine) ===================== */
.tt-card { background: #fff; border-radius: var(--radius-card); padding: 20px 24px; }
.tt-card > .btn { margin-bottom: 16px; }
.tt-list { margin-top: 4px; }
.tt-period { border-bottom: 1px dashed var(--primary); text-decoration: none !important; }
.tt-count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--primary); color: #fff; font-size: 12px; line-height: 22px; text-align: center; }
.tt-status { display: inline-block; padding: 0 10px; border: 0.8px solid var(--success); color: #2e7d32; border-radius: 12px; font-size: 13px; line-height: 22px; }
.tt-muted { color: var(--muted); font-size: 12px; }
.tt-num { text-align: right; white-space: nowrap; }
.tt-total td { font-weight: 600; }
.tt-menu { position: relative; display: inline-block; }
.tt-menu > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tt-menu > summary::-webkit-details-marker { display: none; }
.tt-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 4px 0; }
.tt-menu-list a, .tt-menu-list button { display: block; width: 100%; text-align: left; padding: 8px 14px; font-size: 14px; color: var(--text); background: none; border: 0; cursor: pointer; text-decoration: none !important; font-family: inherit; }
.tt-menu-list a:hover, .tt-menu-list button:hover { background: var(--primary-soft); }
.tt-menu-list form { margin: 0; }
.tt-menu-danger { color: #d32f2f !important; }
.tt-dialog { border: 0; border-radius: var(--radius-card); padding: 0; width: min(720px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.3); color: var(--text); }
.tt-dialog::backdrop { background: rgba(36,49,67,.45); }
.tt-dialog form { padding: 20px 24px; }
.tt-dialog-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 0.8px solid var(--border-light); padding-bottom: 12px; margin-bottom: 16px; }
.tt-dialog-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.tt-close { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.tt-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 12px; margin: 12px 0; }
.tt-row-top { align-items: start; margin-top: 20px; }
.tt-row select.input, .tt-cats { max-width: 260px; width: 100%; }
.tt-rate.input { width: 120px; }
.tt-hint { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; border: 0.8px solid var(--muted); color: var(--muted); font-size: 11px; align-items: center; justify-content: center; cursor: help; }
.tt-cats { position: relative; }
.tt-cats > summary { list-style: none; cursor: pointer; border: 0.8px solid #bfc9d9; border-radius: var(--radius); height: 32px; line-height: 30px; padding: 0 12px; background: #fff; font-size: 14px; }
.tt-cats > summary::-webkit-details-marker { display: none; }
.tt-cats > summary::after { content: "\25BE"; float: right; color: var(--muted); }
.tt-cats-list { position: absolute; z-index: 30; left: 0; right: -120px; top: calc(100% + 2px); background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px 0; max-height: 260px; overflow: auto; }
.tt-check { display: flex; gap: 8px; align-items: center; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.tt-check:hover { background: var(--primary-soft); }
.tt-radio { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.tt-radio input { margin-top: 4px; }
.tt-radio small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.tt-dialog-foot { border-top: 0.8px solid var(--border-light); padding-top: 16px; margin-top: 8px; display: flex; gap: 10px; }
.tt-params { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0 0 16px; color: var(--muted); }
.tt-params b { color: var(--text); font-weight: 600; }
.tt-tabs { display: flex; gap: 4px; align-items: center; border-bottom: 0.8px solid var(--border-light); margin-bottom: 12px; }
.tt-tabs > a:not(.btn) { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tt-tabs > a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tt-export { margin-left: auto; }
@media (max-width: 640px) { .tt-row { grid-template-columns: 1fr; gap: 4px; } }

/* ===================== Сетка цен тарифа (как «Цены, RUB» в TravelLine) ===================== */
.pg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 12px; }
.pg-years { display: inline-flex; }
.pg-year { display: inline-block; padding: 4px 12px; border: 0.8px solid var(--primary); color: var(--primary); background: #fff; text-decoration: none; font-size: 14px; }
.pg-year + .pg-year { margin-left: -0.8px; }
.pg-year:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.pg-year:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.pg-year:hover { background: var(--primary-soft); }
.pg-year.active { background: var(--primary); color: #fff; }
.pg-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.pg-tabs-wrap { display: flex; align-items: stretch; border-bottom: 0.8px solid var(--border); margin-bottom: 10px; }
.pg-tabs { display: flex; overflow-x: auto; scrollbar-width: thin; flex: 1; }
.pg-tab { flex: none; border: 0; background: none; padding: 8px 14px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.pg-tab:hover { color: var(--primary); }
.pg-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.pg-tabs-arrow { flex: none; width: 28px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--primary); cursor: pointer; }
.pg-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pg-sw { display: inline-block; width: 16px; height: 12px; border: 0.8px solid var(--border-strong); }
.pg-sw-blocked { background: repeating-linear-gradient(135deg, #f8c9c9 0 3px, #fff 3px 6px); }
.pg-sw-closed { background: var(--danger-soft); border-color: #e57373; }
.pg-sw-override { background: linear-gradient(225deg, var(--warning) 0 5px, #fff 5px); }
.pg-sw-pending { background: #fff7c2; }
.pg-savebar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; background: #fff7c2; border: 0.8px solid #f0d86e; border-radius: var(--radius); font-size: 14px; }
.pg-savebar[hidden] { display: none; }
.pg-hint { margin: 0 0 8px; font-size: 13px; }
.pg-scroll { overflow-x: auto; background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.pg-table { border-collapse: collapse; font-size: 12px; user-select: none; }
.pg-table caption { text-align: left; font-weight: 600; font-size: 14px; padding: 8px 10px; }
.pg-table th, .pg-table td { border: 0.8px solid var(--border-light); }
.pg-lab { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 190px; max-width: 190px; text-align: left; padding: 3px 8px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
thead .pg-lab { background: #f6f8fa; font-weight: 600; }
.pg-day { min-width: 52px; padding: 3px 2px; background: #f6f8fa; font-weight: 400; cursor: pointer; }
.pg-day b { display: block; font-size: 13px; }
.pg-day span { display: block; color: var(--muted); font-size: 11px; }
.pg-day.weekend span, .pg-day.weekend b { color: #c62828; }
.pg-day.today { background: var(--primary-soft-2); }
.pg-day.past { opacity: .55; }
.pg-cat .pg-lab { font-weight: 600; background: #eef2f7; cursor: pointer; }
.pg-cat .pg-lab small { font-weight: 400; color: var(--muted); }
.pg-free { background: #eef2f7; text-align: center; color: var(--muted); }
.pg-free.blocked { background: repeating-linear-gradient(135deg, #f8c9c9 0 3px, #fff 3px 6px); color: #c62828; font-weight: 600; }
.pg-rowlab { cursor: pointer; color: var(--text); }
.pg-rowlab:hover, .pg-catlab:hover, .pg-day:hover { color: var(--primary); }
.pg-c { position: relative; height: 24px; padding: 2px 4px; text-align: right; white-space: nowrap; cursor: cell; }
.pg-c.weekend { background: #fbfbfd; }
.pg-c.past { color: var(--muted); }
.pg-c.closed { background: var(--danger-soft); }
.pg-c.blocked-day { box-shadow: inset 0 2px 0 #f3a5a5; }
.pg-row-close .pg-c, .pg-row-min .pg-c { text-align: center; }
.pg-c.is-closed { background: var(--danger-soft); color: #c62828; font-weight: 700; }
.pg-c.override::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 6px 6px 0; border-color: transparent var(--warning) transparent transparent; }
.pg-c.pending { background: #fff7c2; font-weight: 600; }
.pg-c.sel { background: var(--primary-soft-2) !important; outline: 1px solid var(--primary); outline-offset: -1px; }
.pg-menu { position: fixed; z-index: 50; min-width: 200px; background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 4px 0; }
.pg-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 14px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.pg-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.pg-dialog-back { position: fixed; inset: 0; z-index: 60; background: rgba(36, 49, 67, .35); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.pg-dialog-back[hidden] { display: none; }
.pg-dialog { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-pop); padding: 18px 20px; width: 100%; max-width: 460px; }
.pg-dialog h3 { margin: 0 0 6px; font-size: 18px; }
.pg-dlg-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.pg-dlg-row > label { min-width: 84px; font-size: 14px; }
.pg-dlg-row input, .pg-dlg-row select { height: 32px; border: 0.8px solid var(--border); border-radius: var(--radius); padding: 0 8px; font: inherit; font-size: 14px; }
.pg-dlg-row input[type="text"] { width: 120px; }
.pg-dlg-period { border: 0.8px solid var(--border-light); border-radius: var(--radius); padding: 8px 12px; margin: 12px 0; }
.pg-dlg-period .pg-dlg-row > label { min-width: 0; }
.pg-dlg-wd { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.pg-dlg-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ===== Отчёт по броням (/finance) и Список заказов (/orders) — по образцу TravelLine ===== */
.fr-card { background: #fff; border: 0.8px solid var(--border-light); border-radius: var(--radius-card); padding: 16px 20px; margin-bottom: 16px; }
.fr-card h2 { font-size: 20px; margin: 0 0 12px; }
.fr-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0; }
.fr-label { min-width: 72px; }
.fr-search { flex: 1 1 360px; max-width: 520px; }
.fr-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.fr-dd { position: relative; }
.fr-dd > summary { list-style: none; cursor: pointer; display: inline-block; padding: 6px 12px; border: 0.8px solid var(--primary); border-radius: var(--radius); color: var(--primary); background: #fff; font-size: 14px; white-space: nowrap; }
.fr-dd > summary::-webkit-details-marker { display: none; }
.fr-dd > summary::after { content: ' ▾'; }
.fr-dd > summary.btn::after, .po-menu > summary::after { content: ''; }
.fr-dd[open] > summary { background: var(--primary-soft); }
.fr-dd-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 340px; overflow: auto; background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 8px 0; }
.fr-dd-right { left: auto; right: 0; }
.fr-dd-menu label, .fr-dd-menu a, .fr-dd-menu button { display: block; padding: 6px 14px; font-size: 14px; white-space: nowrap; color: var(--text); text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.fr-dd-menu label:hover, .fr-dd-menu a:hover, .fr-dd-menu button:hover { background: var(--primary-soft); }
.fr-dd-menu .btn { width: auto; margin: 6px 14px 0; }
.fr-dd-dates label { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.fr-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 12px; }
.fr-total-actions { display: flex; gap: 8px; align-items: center; }
.fr-view > summary { padding: 6px 12px; }
.fr-table-wrap { overflow-x: auto; border: 0.8px solid var(--border-light); border-radius: var(--radius); }
.fr-table th, .fr-table td, .po-table th, .po-table td { font-size: 13px; padding: 10px; }
.fr-table th { min-width: 80px; }
.fr-table .c-guest, .fr-table .c-methods, .fr-table .c-comment, .fr-table .c-type { min-width: 150px; }
.fr-table .c-comment { max-width: 320px; }
.fr-table td.c-cost, .fr-table td.c-paid, .fr-table td.c-refunded, .fr-table td.c-balance, .fr-table td.c-discount { white-space: nowrap; }
.fr-debt { color: #c62828; }
.fr-table td.c-ext, .fr-table td.c-number, .fr-table td.c-created, .fr-table td.c-checkin, .fr-table td.c-checkout { white-space: nowrap; }
.fr-pages { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; margin: 12px 0; }
.fr-pages a, .fr-pages span { min-width: 30px; padding: 4px 8px; text-align: center; border: 0.8px solid var(--border); border-radius: var(--radius); text-decoration: none; font-size: 13px; }
.fr-pages a.active { background: var(--primary-soft-2); color: var(--primary); border-color: var(--primary); }

.po-stats-wrap > summary { cursor: pointer; color: var(--primary); text-align: right; margin-bottom: 8px; font-size: 14px; }
.po-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.po-card { background: #fff; border: 0.8px solid var(--border-light); border-radius: var(--radius-card); padding: 14px 18px; border-left: 4px solid; }
.po-card-title { font-weight: 600; font-size: 14px; }
.po-card-n { font-size: 28px; margin: 6px 0 2px; }
.po-card-sum { font-size: 13px; color: var(--muted); }
.po-card-new { border-left-color: #f5b301; }
.po-card-paid { border-left-color: #2e9e4f; }
.po-card-cancelled { border-left-color: #d32f2f; }
.po-card-refund { border-left-color: #8e3bb5; }
.po-actions { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; border-bottom: 0.8px solid var(--border-light); padding-bottom: 12px; }
.po-filters .po-search { margin-left: auto; display: inline-flex; gap: 6px; }
.po-filters .po-search input { width: 240px; }
.po-start { font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.po-total { font-size: 14px; }
.po-sort { color: inherit !important; text-decoration: none !important; white-space: nowrap; }
.po-sort span { color: var(--muted); font-size: 12px; }
.po-badge { display: inline-block; padding: 1px 10px; border-radius: 999px; border: 0.8px solid; font-size: 12px; white-space: nowrap; background: #fff; }
.po-new { color: #b07d00; }
.po-overdue { color: #e65100; }
.po-paid { color: #2e7d32; }
.po-done { color: #9e9d24; }
.po-cancelled { color: #d32f2f; }
.po-refund { color: #8e3bb5; margin-left: 4px; }
.po-menu > summary { padding: 2px 10px; }
.po-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.po-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.po-detail .fr-card { margin: 0; }
.po-dl { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.po-dl dt { color: var(--muted); }
.po-dl dd { margin: 0; }
.po-link { word-break: break-all; }
.po-form { max-width: 760px; }
.po-form h3 { margin: 16px 0 8px; font-size: 16px; }
.po-form-grid { display: grid; grid-template-columns: 230px 1fr; gap: 10px 16px; align-items: start; padding-bottom: 12px; border-bottom: 0.8px solid var(--border-light); margin-bottom: 8px; }
.po-form-grid > label { padding-top: 6px; }
.po-form-grid input, .po-form-grid textarea { width: 100%; }
.po-form-grid .po-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.po-form-grid .po-dates input { width: auto; }
.po-form .field-error { color: #d32f2f; font-size: 12px; margin-top: 4px; }
.tt-dialog label { display: block; margin: 10px 0; font-size: 14px; }
.tt-dialog label select, .tt-dialog label input { display: block; width: 100%; margin-top: 4px; }
@media (max-width: 700px) {
  .po-form-grid, .po-dl { grid-template-columns: 1fr; }
  .po-detail { grid-template-columns: 1fr; }
  .po-filters .po-search { margin-left: 0; }
}

/* ===== Блок «Гости» в форме брони — поиск с подсказками, как в TravelLine ===== */
.rg { border: 0; padding: 0; margin: 0 0 8px; }
.rg legend { font-size: 22px; padding: 0 0 10px; width: 100%; border-bottom: 0.8px solid var(--border-light); margin-bottom: 14px; }
.rg-row { display: grid; grid-template-columns: 220px minmax(0, 520px); gap: 6px 16px; align-items: center; margin-bottom: 10px; }
.rg-row > label { color: var(--text); }
.rg-row input { width: 100%; }
.rg-row.has-error input { border-color: #d32f2f; }
.rg-row .field-error { color: #d32f2f; font-size: 12px; margin-top: 4px; }
.rg-search-wrap { position: relative; }
.rg-dd { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 0.8px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 4px 0; max-height: 360px; overflow: auto; }
.rg-opt { padding: 6px 16px; cursor: pointer; }
.rg-opt:hover, .rg-opt.active { background: var(--primary-soft); }
.rg-name { font-size: 15px; }
.rg-sub { font-size: 12px; color: var(--muted); }
.rg-bl .rg-name { color: #c62828; }
.rg-empty { padding: 6px 16px; font-size: 13px; color: var(--muted); }
.rg-black { color: #c62828; }
.rg-link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; font: inherit; }
@media (max-width: 700px) { .rg-row { grid-template-columns: 1fr; } }

/* Шахматка по ширине экрана (ширина дня считается скриптом в chart/index.php) */
@media (max-width: 1500px) { .chart-frame { --left: 220px; } }
.chart-tight .chart-dayhead .chart-c { font-size: 11px; }
.chart-tight .chart-dayhead .chart-c small { font-size: 10px; }
.chart-tight .chart-cat .chart-c, .chart-tight .chart-unassigned .chart-c { font-size: 11px; }
.chart-tight .res-bar .res-sum { display: none; }

/* «Объединить профили» */
.mg-search { display: flex; gap: 8px; margin: 12px 0 4px; max-width: 640px; }
.mg-search input { flex: 1; }
.form-card h3 { font-size: 16px; margin: 18px 0 8px; }
.mg-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 0.8px solid var(--border-light); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; max-width: 760px; }
.mg-opt:hover { background: var(--primary-soft); }
.mg-opt input { margin-top: 4px; }
.mg-opt .hint { display: block; }

/* «Вид отображения» шахматки */
.chart-gear { padding: 6px 8px; display: inline-flex; align-items: center; }
.chart-gear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cs .fr-card h2 { font-size: 20px; padding-bottom: 12px; border-bottom: 0.8px solid var(--border-light); }
.cs-row { display: grid; grid-template-columns: 230px 1fr; gap: 8px 24px; padding: 12px 0; border-bottom: 0.8px solid var(--border-light); }
.cs-row:last-child { border-bottom: 0; }
.cs-opt { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; cursor: pointer; }
.cs-opt input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.cs-hint { margin: 4px 0 8px; }
.cs-order { list-style: none; padding: 0; margin: 0; counter-reset: cs; max-width: 900px; }
.cs-order li { counter-increment: cs; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 10px; background: var(--bg); border: 0.8px solid var(--border); border-radius: var(--radius); cursor: grab; }
.cs-order li::before { content: counter(cs); width: 18px; color: var(--muted); }
.cs-order li.dragging { opacity: .5; }
.cs-drag { color: var(--muted); }
.cs-name { flex: 1; }
.cs-move { border: 0.8px solid var(--border); background: #fff; border-radius: var(--radius); width: 28px; height: 26px; cursor: pointer; }
@media (max-width: 700px) { .cs-row { grid-template-columns: 1fr; } }

/* ===================== Отчёты: платежи, загрузка, долги, журнал ===================== */
.report-stats { margin-bottom: 12px; }
.report-presets { flex-direction: row !important; gap: 12px !important; align-self: center; font-size: 13px; }
.occ-bar { display: inline-block; width: 90px; height: 8px; background: #eff4f7; vertical-align: middle; margin-right: 6px; }
.occ-bar i { display: block; height: 100%; background: var(--success); }
.occ-we td { background: rgba(227, 242, 253, .5); }
.audit-diff { font-size: 12px; line-height: 16px; max-width: 520px; word-break: break-word; }
.audit-table code { font-size: 12px; }

/* ===================== Заметки и указания ===================== */
.notes-card { max-width: none; margin-top: 16px; }
.notes-card h2 { margin-top: 0; }
.notes-list { list-style: none; margin: 0 0 16px; padding: 0; }
.note { padding: 10px 12px; border: 0.8px solid var(--border-light); border-left: 3px solid var(--primary); border-radius: var(--radius); margin-bottom: 8px; background: #fff; }
.note.is-due { border-left-color: #d32f2f; background: #fff8f8; }
.note.is-done { border-left-color: #9ca8b9; opacity: .65; }
.note.is-done .note-text { text-decoration: line-through; }
.note-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.note.is-due .note-when, .note-due { color: #d32f2f; font-weight: 600; }
.note-actions { display: flex; gap: 6px; margin-top: 8px; }
.note-add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.note-add .field { display: flex; flex-direction: column; gap: 4px; }
.note-add label { font-size: 13px; color: var(--muted); }
.note-add textarea, .note-add input { border: 0.8px solid var(--border-strong); border-radius: var(--radius); padding: 6px 10px; font: inherit; }
.note-add textarea { width: 100%; }
.rp-note { padding: 2px 0; }

/* ===================== Настройки: модуль бронирования, резервные копии ===================== */
.settings-card { max-width: 900px; margin-bottom: 16px; }
.settings-card h2 { margin-top: 0; }
.settings-save { max-width: 900px; margin-bottom: 24px; }

/* ===================== Роли и права (users/roles.php) ===================== */
.role-add { display: flex; gap: 12px; align-items: flex-end; max-width: none; margin-bottom: 16px; }
.role-add .field { display: flex; flex-direction: column; gap: 4px; }
.role-add label { font-size: 13px; color: var(--muted); }
.role-card { max-width: none; margin-bottom: 16px; }
.role-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.role-name { max-width: 420px; font-weight: 600; }
.role-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 24px; margin-bottom: 8px; }
.role-perms .checkbox-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.role-perms input { margin-top: 3px; accent-color: var(--primary); }

/* ===================== «Переселить» (reservations/move.php) ===================== */
.mv-info { margin: 0 0 8px; line-height: 22px; }
.mv-group { font-size: 15px; margin: 18px 0 8px; }
.mv-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.mv-room {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 64px; padding: 8px;
  background: #fff; border: 0.8px solid var(--border-strong); border-radius: var(--radius-card); cursor: pointer;
}
.mv-room input { position: absolute; opacity: 0; pointer-events: none; }
.mv-room b { font-size: 16px; font-weight: 600; }
.mv-room small { font-size: 12px; color: #2e7d32; }
.mv-room:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1.5px var(--primary); }
.mv-room:has(input:focus-visible) { outline: 2px solid var(--primary-soft-2); }
.mv-room.is-busy, .mv-room.is-current { cursor: default; background: var(--bg); }
.mv-room.is-busy b { color: var(--muted); }
.mv-room.is-busy small { color: #d32f2f; }
.mv-room.is-current small { color: var(--primary); }
.mv-type-hint { margin-top: 12px; }

/* ===================== Телефон (≤760px): вид приложения — меню шторкой, нижняя панель, поля 16px, кнопки ≥44px. См. docs/MOBILE.md ===================== */
.topbar-burger, .m-tabbar, .sidebar-backdrop, .chart-feed, .chart-mode, .m-filter-toggle { display: none; }
.list-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.list-meta:last-child { margin: 12px 0 0; justify-content: flex-end; }
@media (max-width: 760px) {
  :root { --m-tabbar-h: 58px; --m-topbar-h: 52px; }
  html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
  body { padding-bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom)); touch-action: manipulation; }
  body.nav-open { overflow: hidden; }
  .app-shell { display: block; min-height: 100vh; min-height: 100dvh; }

  /* Боковое меню — шторка слева */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(86vw, 320px); z-index: 70;
    transform: translateX(-100%); transition: transform .25s ease; overscroll-behavior: contain;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .nav-open .sidebar { transform: none; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 69; background: rgba(20, 28, 40, .5);
    opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s;
  }
  .nav-open .sidebar-backdrop { opacity: 1; visibility: visible; transition: opacity .2s ease; }
  .nav-group-head { height: 52px; }
  .nav-group-body a { height: 48px; line-height: 47px; }

  /* Шапка: «≡», название раздела, пользователь */
  /* В Safari шапка не закрепляется (над ней просвечивала бы страница); в режиме приложения — закреплена, см. ниже */
  .topbar { position: relative; height: calc(var(--m-topbar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); background: var(--sidebar-head); box-shadow: none; }
  .topbar-burger { display: flex; align-items: center; justify-content: center; width: 52px; height: var(--m-topbar-h); flex-shrink: 0; background: none; border: 0; color: #fff; cursor: pointer; }
  .topbar-burger svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .topbar-title { flex: 1; min-width: 0; padding-left: 0; font-size: 17px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-menu { height: var(--m-topbar-h); }
  .user-chip { background: transparent; color: #fff; padding: 0 14px 0 10px; max-width: none; }
  .user-chip-name { display: none; }
  .user-dropdown { position: fixed; top: calc(var(--m-topbar-h) + env(safe-area-inset-top)); right: 8px; }
  .dropdown-menu a, .dropdown-menu button, .dropdown-menu label { min-height: 44px; font-size: 15px; }
  /* Выпадающие списки фильтров — шторкой над нижней панелью, во всю ширину */
  .dropdown-menu:not(.user-dropdown), .fr-dd-menu {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom) + 8px);
    width: auto; min-width: 0; max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain;
    z-index: 55; border-radius: 12px; box-shadow: 0 8px 40px rgba(20, 28, 40, .35);
  }
  .dropdown-menu:not(.user-dropdown) a, .dropdown-menu:not(.user-dropdown) label, .fr-dd-menu label, .fr-dd-menu a, .fr-dd-menu button {
    display: flex; align-items: center; min-height: 44px; white-space: normal;
  }
  .fr-dd > summary { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; }

  /* Нижняя панель */
  .m-tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #fff; border-top: 0.8px solid var(--border);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .m-tabbar a, .m-tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--m-tabbar-h);
    padding: 0; background: none; border: 0; color: var(--muted); font: 600 11px var(--font); text-decoration: none; cursor: pointer;
  }
  .m-tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .m-tabbar .active { color: var(--primary); }
  .m-tabbar .m-tab-plus { color: var(--primary); }
  .m-tabbar .m-tab-plus svg { width: 28px; height: 28px; }
  .m-tabbar a:active, .m-tabbar button:active { background: var(--primary-soft); }

  /* Страница */
  .page { padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
  .page-header { margin: 0 0 16px; }
  .page h1, .page-header h1, h1.page-title { font-size: 24px; line-height: 30px; margin-top: 0; }
  .page-subnav { overflow-x: auto; white-space: nowrap; gap: 18px; scrollbar-width: none; }

  /* Поля 16px (iOS не увеличивает масштаб), кнопки и поля не ниже 44px */
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]), select, textarea { font-size: 16px !important; }
  .form-grid .field input[type=text], .form-grid .field input[type=number], .form-grid .field input[type=date],
  .form-grid .field input[type=email], .form-grid .field input[type=password], .form-grid .field input[type=tel],
  .form-grid .field input[type=time], .form-grid .field select, .filter-bar select, .filter-bar input, .input { height: 44px; }
  .btn { height: auto; min-height: 44px; padding: 8px 16px; font-size: 15px; }
  .btn-sm { min-height: 36px; padding: 4px 10px; font-size: 14px; }
  .btn-icon { width: 44px; padding: 0; }
  .filter-dd-btn { height: 44px; font-size: 15px; }
  .form-card { padding: 16px; max-width: none; }
  .form-row { flex-direction: column; gap: 16px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .field, .filter-bar select, .filter-bar input { width: 100%; min-width: 0; }
  .filter-bar .btn { width: 100%; }
  .page input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not(.date-field input), .page select { min-height: 40px; }
  .rg-row input { height: 44px; padding: 8px 10px; border: 0.8px solid var(--border-strong); border-radius: var(--radius); background: #fff; color: var(--text); }

  /* Таблицы — прокрутка вбок внутри своего блока, страница не «разъезжается» */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .data-table th, .data-table td { padding: 10px; }
  .data-table tr:hover td { background: none; }

  /* Списки (брони, приём, гости) — карточками: заголовок, статус справа, остальное «подпись — значение» */
  .data-table.m-cards { display: block; overflow: visible; background: none; }
  .m-cards thead { display: none; }
  .m-cards tbody { display: flex; flex-direction: column; gap: 8px; }
  .m-cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; background: #fff; border-radius: var(--radius-card); box-shadow: 0 1px 2px rgba(36, 49, 67, .08); }
  .m-cards td { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; border: 0; text-align: right; }
  .m-cards td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; flex-shrink: 0; }
  .m-cards td.m-title { grid-column: 1; display: block; font-size: 16px; text-align: left; }
  .m-cards td.m-badge { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .m-cards td.m-sub { display: block; font-weight: 600; text-align: left; }
  .m-cards td.m-hide { display: none; }
  .m-cards td:not([data-label]):not(.m-title):not(.m-badge):not(.m-sub) { justify-content: flex-start; padding-top: 8px; }
  .m-cards tr:hover td { background: none; }
  .m-cards .empty-row { display: block; }
  .m-cards .empty-row td { display: block; text-align: center; }
  .list-meta { margin-bottom: 10px; }
  .pager-btn { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .report-presets { flex-wrap: wrap; }
  .m-cards td.audit-diff { display: block; text-align: left; max-width: none; }
  /* Бронирования: на телефоне — поиск и кнопка «Фильтры», остальное по нажатию */
  .filter-bar[data-m-collapse]:not(.is-open) .m-more { display: none; }
  .m-filter-actions { flex-direction: row !important; gap: 8px !important; }
  .m-filter-actions .btn { flex: 1; width: auto; }
  .m-filter-toggle { display: inline-flex; }

  /* Главная и сводка шахматки */
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 26px; line-height: 32px; }
  .stats-panel { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .stats-card { min-height: 0; }

  /* Шахматка: узкая колонка номеров, сетка прокручивается внутри экрана */
  .chart-search { flex: 1 1 100%; }
  .chart-filters-right { justify-content: flex-start; }
  .chart-frame, .chart-frame:has(.view-day) { --left: 132px; }
  .chart-wrap { max-height: calc(100dvh - var(--m-topbar-h) - var(--m-tabbar-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px); }
  .chart-head .chart-left { padding: 6px; }
  .chart-head-controls { flex-direction: column; gap: 4px; }
  .chart-head .date-field { height: 34px; padding: 0 4px; }
  .chart-head .date-field input { font-size: 13px !important; }
  .chart-head .today-btn { height: 28px; font-size: 12px; justify-content: center; }
  .chart-head .collapse-all, .room-floor { display: none; }

  /* Шахматка: «Лента» (по умолчанию) или «Сетка» — переключатель в фильтрах */
  .chart-mode { display: inline-flex; }
  .chart-mode .btn { min-width: 76px; }
  .chart-feed { display: block; }
  html:not(.chart-grid-on) .chart-frame, html:not(.chart-grid-on) .chart-legend { display: none; }
  html.chart-grid-on .chart-feed { display: none; }
  .feed-days {
    position: sticky; top: 0; z-index: 6; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px 8px; padding: 6px 16px; background: var(--bg);
  }
  .feed-days::-webkit-scrollbar { display: none; }
  .feed-day, .feed-nav {
    flex: 0 0 48px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 0.8px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; padding: 0;
  }
  .feed-nav { flex-basis: 36px; font-size: 22px; color: var(--primary); }
  .feed-day small { font-size: 11px; line-height: 14px; color: var(--muted); }
  .feed-day b { font-size: 17px; line-height: 22px; font-weight: 600; }
  .feed-day.we small { color: #d32f2f; }
  .feed-day.today { border-color: var(--primary); }
  .feed-day.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .feed-day.active small { color: #dbe9fb; }
  .feed-sum { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
  .feed-cat { font-size: 14px; font-weight: 600; margin: 14px 0 6px; color: var(--text); text-transform: uppercase; letter-spacing: .03em; }
  .feed-room { display: flex; gap: 8px; align-items: stretch; margin-bottom: 6px; }
  .feed-num {
    flex: 0 0 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: #fff; border-radius: var(--radius-card); font-size: 16px;
  }
  .feed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .feed-res, .feed-free, .feed-out {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 52px; padding: 8px 12px;
    border: 0; border-left: 4px solid; border-radius: var(--radius-card); background: #fff; color: var(--text);
    font: inherit; font-size: 14px; line-height: 18px; text-align: left; cursor: pointer; text-decoration: none;
  }
  .feed-res b { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed-dates { font-size: 13px; color: var(--muted); }
  .feed-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
  .feed-st { color: var(--muted); }
  .feed-debt { color: #d32f2f; font-weight: 600; }
  .feed-res.st-new, .feed-res.st-confirmed { border-left-color: #4caf50; }
  .feed-res.st-checked_in { border-left-color: #9c27b0; }
  .feed-res.st-awaiting_payment { border-left-color: #f0ad4e; }
  .feed-res.st-checked_out { border-left-color: #607d8b; }
  .feed-res.st-other { border-left-color: #f44336; }
  .feed-res.hidden-by-filter { display: none; }
  .feed-free { flex-direction: row; align-items: center; justify-content: space-between; border-left-color: transparent; color: var(--muted); background: rgba(255, 255, 255, .6); }
  a.feed-free { color: var(--primary); }
  .feed-plus { font-size: 24px; line-height: 20px; font-weight: 300; }
  .feed-out { min-height: 40px; border-left-color: #607d8b; font-size: 13px; color: var(--muted); }
  .feed-unassigned .feed-res { margin-bottom: 6px; }

  /* Панель брони — на весь экран */
  .res-panel { width: 100%; top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .rp-title { font-size: 20px; line-height: 26px; padding: 14px 56px 12px 16px; }
  .rp-scroll { padding: 0 16px; }
  .rp-section { grid-template-columns: 1fr; gap: 0; padding: 14px 0; }
  .rp-section dd + dt { margin-top: 8px; }
  .rp-footer { flex-wrap: wrap; padding: 12px 16px; }
  /* Действия брони — плитки с подписями (data-label в panel.php) */
  .rp-footer { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .rp-footer .btn, .rp-footer .btn-icon { width: auto; height: auto; min-height: 56px; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 12px; line-height: 14px; }
  .rp-footer .btn-icon::after { content: attr(data-label); }
  .role-add { flex-direction: column; align-items: stretch; }
  .role-perms { grid-template-columns: 1fr; }
  .role-perms .checkbox-line { min-height: 40px; align-items: center; }
  .role-perms input { width: 20px; height: 20px; margin: 0; }
  /* «Переселить»: кнопка над нижней панелью */
  .mv-rooms { grid-template-columns: repeat(3, 1fr); }
  .mv-actions { position: sticky; bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; margin: 16px -16px -16px; padding: 12px 16px; background: #fff; border-top: 0.8px solid var(--border-light); }

  /* Форма брони — мастер из 3 шагов (скрипт в reservations/form.php); нижнюю панель заменяет панель шагов */
  .wiz [data-wiz]:not(.wiz-on), .wiz .form-actions { display: none !important; }
  .wiz-active .m-tabbar { display: none; }
  /* Шаг 1 плотнее: дата и время в строку, взрослые и дети рядом */
  .wiz .form-row[data-wiz="1"]:has(input[type=time]) { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
  .wiz .form-row[data-wiz="1"]:has(input[name=adults]) { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  body.wiz-active { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .wiz-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; counter-reset: wiz; }
  .wiz-steps[hidden] { display: none; }
  .wiz-steps li { flex: 1; }
  .wiz-steps button {
    width: 100%; min-height: 44px; padding: 4px 0; background: none; border: 0; border-bottom: 3px solid var(--border);
    color: var(--muted); font: 600 13px var(--font); cursor: pointer; counter-increment: wiz;
  }
  .wiz-steps button::before { content: counter(wiz) ". "; }
  .wiz-steps button.done { color: var(--text); border-bottom-color: var(--primary-soft-2); }
  .wiz-steps button.active { color: var(--primary); border-bottom-color: var(--primary); }
  .wiz-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
    background: #fff; border-top: 0.8px solid var(--border); box-shadow: 0 -4px 16px rgba(36, 49, 67, .08);
    padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .wiz-bar[hidden], .wiz-bar [hidden] { display: none; }
  .wiz-sum { flex: 1; min-width: 0; line-height: 18px; }
  .wiz-sum small { display: block; color: var(--muted); font-size: 12px; }
  .wiz-sum b { font-size: 18px; white-space: nowrap; }

  /* Вход и подтверждение входа */
  .auth-page { padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
  .auth-card { width: 100%; max-width: 420px; padding: 24px 20px; }
  .auth-card input { height: 44px; }
  .auth-card button { height: 44px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop, .res-panel { transition: none; }
}
@media (max-width: 760px) and (display-mode: standalone) {
  .topbar { position: sticky; top: 0; }
}

/* ===================== Перенос брони мышью по шахматке ===================== */
.res-bar { user-select: none; -webkit-user-drag: none; }
.res-bar.st-new, .res-bar.st-confirmed, .res-bar.st-awaiting_payment, .res-bar.st-checked_in { cursor: grab; }
.res-bar.dragging { opacity: .35; }
.res-bar.res-ghost {
  pointer-events: none; z-index: 6; opacity: .9;
  box-shadow: 0 0 0 2px var(--primary), 0 4px 12px rgba(36, 49, 67, .35);
}
.res-bar.res-ghost.conflict { box-shadow: 0 0 0 2px #e80000, 0 4px 12px rgba(232, 0, 0, .35); background: rgba(232, 0, 0, .25); }
body.chart-dragging, body.chart-dragging * { cursor: grabbing !important; user-select: none; }
.move-body { padding: 14px 20px 0; font-size: 14px; }
.move-body p { margin: 0 0 8px; }
.move-body .move-note { color: var(--muted); }
.move-body .alert { margin: 10px 0 0; }
.chart-notice {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 80;
  background: #364963; color: #fff; padding: 10px 18px; border-radius: 4px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
