/* Park-Hotel Wollen — booking admin. Природная палитра. */
:root {
  --bg: #F7F3EA;
  --card: #FFFCF6;
  --text: #26322B;
  --muted: #6B7569;
  --head: #1F3B2D;
  --green: #3F6B4A;
  --green-soft: #5b8a66;
  --water: #4F8FA3;
  --sun: #D8A24A;
  --sun-dark: #c08e36;
  --border: #DDD0B8;
  --border-soft: #ece3d2;
  --danger: #c0563f;
  --danger-soft: #e8d3cb;

  /* статусы */
  --st-booking: #FFFFFF;
  --st-booking-line: #2F64D6;
  --st-arrival: #E89236;
  --st-stay: #8FB9CE;
  --st-departure: #ECEFF1;
  --st-departure-line: #5A5F62;
  --st-cancelled: #C0563F;
  --st-external: #4a6d78;
  --pay-blue: #2F64D6;
  --pay-debt: #C0563F;
  --pay-partial: #E0992F;
  --pay-paid: #3E9B57;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(38,50,43,.08), 0 4px 14px rgba(38,50,43,.05);
  --shadow-lg: 0 8px 30px rgba(38,50,43,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 20px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--head); margin: 0 0 .4em; font-weight: 650; }
a { color: var(--green); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 19px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 18px; font-weight: 550;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--green); background: #fff; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--sun); border-color: var(--sun-dark); color: #3b2c0e;
}
.btn-primary:hover { background: var(--sun-dark); color: #2c2008; }
.btn-green { background: var(--green); border-color: var(--head); color: #fff; }
.btn-green:hover { background: var(--head); }
.btn-danger { background: #fff; border-color: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--border-soft); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Логин ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(79,143,163,.10), transparent),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 32px 28px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo svg { width: 38px; height: 38px; }
.login-badge { width: 48px; height: 48px; object-fit: contain; }
.login-logo .name { font-size: 25px; font-weight: 700; color: var(--head); }
.login-sub { color: var(--muted); font-size: 16px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 16px; color: var(--muted); margin-bottom: 5px; font-weight: 550; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); }
.field textarea { resize: vertical; min-height: 64px; }
.form-error { color: var(--danger); font-size: 16px; margin: 4px 0 12px; min-height: 18px; }

/* ---------- Каркас приложения ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar {
  width: 100%; height: 74px; flex-shrink: 0;
  background: var(--head); color: #e9efe7;
  display: flex; flex-direction: row; align-items: center;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; border-right: 1px solid rgba(255,255,255,.1); flex-shrink: 0; height: 100%; box-sizing: border-box;
}
.sidebar .brand svg { width: 30px; height: 30px; }
.logo-badge { width: 36px; height: 36px; border-radius: 50%; background: #fff; padding: 3px; object-fit: contain; box-shadow: 0 1px 3px rgba(0,0,0,.25); flex-shrink: 0; }
.logo-badge.sm { width: 30px; height: 30px; padding: 2px; }
.sidebar .brand .name { font-weight: 700; font-size: 20px; color: #fff; white-space: nowrap; }
.nav { padding: 6px 8px; flex: 1; display: flex; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; min-width: 0; height: 100%; box-sizing: border-box; }
.nav button {
  width: auto; flex-shrink: 0; text-align: left; border: none; background: transparent;
  color: #cfe0d1; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 550; display: flex; align-items: center; gap: 7px;
  margin-bottom: 0; margin-right: 2px; white-space: nowrap; transition: background .12s, color .12s;
}
.nav button .ic { width: 17px; text-align: center; opacity: .9; }
.nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.active { background: var(--green); color: #fff; }
.nav .badge {
  margin-left: 4px; background: var(--sun); color: #3b2c0e;
  font-size: 14px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
}
/* пункт-пользователь: прижат вправо, отделён */
.nav .nav-user { margin-left: auto; flex-shrink: 0; border-left: 1px solid rgba(255,255,255,.12); border-radius: 0; padding-left: 14px; }
.nav .nav-user .nav-role { font-size: 13px; color: #a9c2ad; font-weight: 400; }
#app-ver { display: none; }
/* подвал со сборкой */
.app-foot { text-align: center; padding: 14px 10px 20px; font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-top: 74px; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar h2 { margin: 0; font-size: 24px; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px 60px; }

/* мобильная шапка */
.mobile-top { display: none; }

/* ---------- Карточки/таблицы ---------- */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.panel-title { font-size: 19px; font-weight: 650; color: var(--head); margin-bottom: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { margin-bottom: 0; }
.toolbar .field input, .toolbar .field select { min-width: 140px; }

.cards-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.stat {
  flex: 1; min-width: 150px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .l { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-size: 32px; font-weight: 700; color: var(--head); margin-top: 2px; }
.stat .v.green { color: var(--green); }
.stat .v.water { color: var(--water); }
.stat .v.danger { color: var(--danger); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 19px; }
table.tbl th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 2px solid var(--border);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.clickable:hover td { background: #fff8ec; }
.tbl-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl-wrap table.tbl th:first-child, .tbl-wrap table.tbl td:first-child { padding-left: 16px; }
.tbl-wrap table.tbl th:last-child, .tbl-wrap table.tbl td:last-child { padding-right: 16px; }

/* ---------- Статусы / метки ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 15px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.st-unconfirmed { background: #fbf0c4; color: #6b5a10; box-shadow: inset 0 0 0 2px #000; }
.st-confirmed { background: var(--st-booking); color: var(--head); box-shadow: inset 0 0 0 2px var(--st-booking-line); }
.st-checked_in { background: var(--st-stay); color: #fff; }
.st-checked_out { background: var(--st-departure); color: var(--text); box-shadow: inset 0 0 0 2px var(--st-departure-line); }
.st-cancelled, .st-rejected { background: #f0dfda; color: #9a4631; }
.st-no_show { background: #efe0da; color: #8a4631; }
.st-external { background: #e6e1f0; color: #564a70; }

.pay-ok { background: #d6efd9; color: #2c6238; }
.pay-debt { background: #f3dad3; color: var(--danger); }
.pay-partial-tag { background: #f8e5c4; color: #8a5118; }
.pay-wait { background: #e6e9e6; color: #5b635b; }
.pay-over { background: #d3e7ed; color: #2b6072; }

/* ---------- Ассистент ---------- */
.assist { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; overflow: hidden; }
.assist h4 { margin: 0; padding: 10px 14px; background: var(--head); color: #fff; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.assist-body { max-height: 340px; overflow-y: auto; }
.assist-ev { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; align-items: flex-start; cursor: pointer; }
.assist-ev:last-child { border-bottom: none; }
.assist-ev:hover { background: var(--border-soft); }
.assist-ev.urgent { background: #f8e3dd; }
.assist-ev.urgent:hover { background: #f3d5cc; }
.assist-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.assist-dot.d1 { background: #C0563F; }
.assist-dot.d2 { background: #E0992F; }
.assist-dot.d3 { background: #3E9B57; }
.assist-ev b { color: var(--head); }
.assist-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.assist-sub2 { color: var(--muted); font-size: 12px; margin-top: 1px; }
.assist-debt { color: var(--pay-debt); font-weight: 600; }
.assist-ok { color: var(--pay-paid); font-weight: 600; }
.assist-empty { padding: 14px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- Вкладки страниц ---------- */
.tabbar { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tabbar .tab { border: none; background: transparent; padding: 10px 16px; font-size: 16px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.tabbar .tab:hover { color: var(--text); }
.tabbar .tab.active { color: var(--head); border-bottom-color: var(--green); }

/* ---------- Шахматка ---------- */
.grid-controls {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px;
  position: sticky; top: 74px; z-index: 25;
  background: var(--bg); padding: 6px 0;
}
.grid-controls .seg { margin-left: auto; }
.grid-controls #g-goto { margin-right: 2px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: none; background: var(--card); padding: 7px 13px; font-size: 16px; font-weight: 550; color: var(--text); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--green); color: #fff; }

.gantt-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); touch-action: manipulation; }
.gantt { border-collapse: collapse; width: max-content; min-width: 100%; }
.gantt th, .gantt td { border-bottom: 1px solid #cbd0d4; }
.gantt thead th { box-shadow: inset -1.2px 0 0 #b7bdc2; }
.gantt thead th {
  position: sticky; top: 0; background: var(--card); z-index: 5;
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 15px 0 6px; text-align: center; box-sizing: border-box;
}
.gantt thead th .mon {
  position: absolute; top: 1px; left: 3px;
  font-size: 11px; font-weight: 700; color: var(--head);
  white-space: nowrap; pointer-events: none; letter-spacing: .02em;
}
.gantt thead th.m-light { background: #eef0f2; }
.gantt thead th.m-dark { background: #e0e4e8; }
.gantt thead th.month-start { border-left: 2px solid #b9bec4; }
.gantt thead th.today { background: #dcefe0; }
.gantt thead th .dow { display: block; font-size: 14px; font-weight: 700; color: #2b3a30; }
.gantt thead th .dom { display: block; font-size: 19px; color: #14201a; font-weight: 800; }
.gantt thead th.house-col { color: var(--head); font-weight: 700; font-size: 16px; }
.gantt th.house-col, .gantt td.house-col {
  position: sticky; left: 0; z-index: 6; background: var(--card);
  width: 60px; min-width: 60px; max-width: 60px;
  text-align: center; padding: 8px 4px; border-right: 2px solid var(--border);
}
.gantt thead th.house-col { z-index: 8; }
.gantt td.house-col .hn { font-weight: 700; color: var(--head); font-size: 19px; }
.gantt td.house-col .hn-num { font-weight: 900; color: var(--head); font-size: 22px; line-height: 1; text-align: center; }
.gantt td.house-col .hp { font-size: 15px; color: var(--muted); }
.gantt tbody td { height: 60px; padding: 0; position: relative; background: #fff; }
.gantt td.weekend { background: #f4efe2; }
.gantt td.today { background: #fbf3df; }
.gantt th.today .dom { color: #2c6238; }
.gantt th.today .dow { color: #2c6238; }
.gantt thead th.weekend .dom { color: #c0563f; }
.gantt thead th.weekend .dow { color: #c0563f; }

.row-track { position: relative; }
.day-bg { touch-action: manipulation; }
.booking-bar {
  position: absolute; top: 8px; bottom: 8px; left: 0;
  border-radius: 7px; padding: 0 8px;
  display: flex; flex-direction: column; justify-content: center;
  font-size: 16px; line-height: 1.2; color: #fff; cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 0 0 1px rgba(255,255,255,.22);
  border: 4px solid transparent;
  background-clip: padding-box;
  transition: filter .12s, transform .12s;
  touch-action: manipulation;
}
.booking-bar:hover { filter: brightness(1.06); transform: translateY(-1px); z-index: 4; box-shadow: var(--shadow); }
.booking-bar .bn { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: clip; color: #000; text-shadow: none; }
.booking-bar .bm { font-size: 15px; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: clip; color: #000; text-shadow: none; }
.booking-bar .bn, .booking-bar .bm { position: relative; z-index: 2; }
.booking-bar .bar-fill {
  position: absolute; inset: 0; z-index: 0;
  display: flex; overflow: hidden; border-radius: 3px;
}
.booking-bar.vbar .bar-fill { flex-direction: column; }
.booking-bar .bar-seg { min-width: 0; min-height: 0; }
.booking-bar .seg-arrival { flex: 1; background: var(--st-arrival); }
.booking-bar .seg-stay { flex: 1; background: var(--st-stay); }
.booking-bar.bar-unconfirmed {
  background: #fbf0c4;
  color: #4a3d08;
  box-shadow: 0 1px 2px rgba(0,0,0,.18), inset 0 0 0 2px #000;
}
.booking-bar.bar-booking,
.booking-bar.bar-confirmed {
  background: var(--st-booking);
  color: var(--head);
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.booking-bar.bar-stay,
.booking-bar.bar-stay-mixed,
.booking-bar.bar-checked_in { background: var(--st-stay); color: var(--head); }
.booking-bar.bar-departure,
.booking-bar.bar-checked_out {
  background: var(--st-departure);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.16), inset 0 0 0 2px var(--st-departure-line);
}
.booking-bar.bar-booking .bn,
.booking-bar.bar-booking .bm,
.booking-bar.bar-departure .bn,
.booking-bar.bar-departure .bm,
.booking-bar.bar-unconfirmed .bn,
.booking-bar.bar-unconfirmed .bm,
.booking-bar.bar-confirmed .bn,
.booking-bar.bar-confirmed .bm,
.booking-bar.bar-checked_out .bn,
.booking-bar.bar-checked_out .bm,
.booking-bar.bar-stay .bn,
.booking-bar.bar-stay .bm,
.booking-bar.bar-stay-mixed .bn,
.booking-bar.bar-stay-mixed .bm,
.booking-bar.bar-checked_in .bn,
.booking-bar.bar-checked_in .bm {
  text-shadow: none;
}
.booking-bar.bar-cancelled, .booking-bar.bar-rejected { background: var(--st-cancelled); }
.booking-bar.bar-no_show { background: var(--st-cancelled); }
.booking-bar.bar-external { background-color: var(--st-external); background-image: radial-gradient(rgba(255,255,255,.30) 1.6px, transparent 1.7px); background-size: 7px 7px; color: #000; }
.booking-bar.pay-blue { border-color: var(--pay-blue); }
.booking-bar.pay-debt { border-color: var(--pay-debt); }
.booking-bar.pay-partial { border-color: var(--pay-partial); }
.booking-bar.pay-paid { border-color: var(--pay-paid); }
.booking-bar.has-source { padding-left: 28px; }
.source-mark {
  position: absolute; top: 3px; left: 4px;
  width: 13.6px; height: 13.6px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); color: var(--head);
  font-size: 10px; font-weight: 900; line-height: 1; text-transform: lowercase;
  box-shadow: 0 1px 2px rgba(0,0,0,.24);
  z-index: 3;
}
.source-w { background: var(--pay-blue); color: #fff; }
.source-b { color: #28475a; }
.source-ext { background: #F2C94C; color: #3b2c0e; }

/* дорожка строки (один td на colspan дней) */
.gantt td.track { position: relative; padding: 0; height: 72px; background: #fff; }
.day-bg {
  position: absolute; top: 0; bottom: 0; box-sizing: border-box;
  border-right: 1.2px solid #b7bdc2; cursor: pointer; z-index: 1;
}
.day-bg.m-light { background: #eef0f2; }
.day-bg.m-dark { background: #e0e4e8; }
.day-bg.month-start { border-left: 2px solid #b9bec4; }
.day-bg.m-light.today, .day-bg.m-dark.today { background: #dcefe0; box-shadow: inset 0 2px 0 var(--green); }
.day-bg:hover { background: #fff8ec; }
.day-bg:hover::after {
  content: "+"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--green); font-size: 22px; font-weight: 700; opacity: .5;
}
.gantt td.track .booking-bar { z-index: 3; }

.legend { margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 4px; }
.legend .li { display: flex; align-items: center; gap: 5px; }
.legend .sw { width: 13px; height: 13px; border-radius: 4px; }
.legend .status-demo { background: #fff; border: 2px solid transparent; }
.legend .status-booking { background: var(--st-booking); border-color: var(--st-booking-line); }
.legend .status-arrival { background: var(--st-arrival); }
.legend .status-stay { background: var(--st-stay); }
.legend .status-departure { background: var(--st-departure); border-color: var(--st-departure-line); }
.legend .pay-demo { background: #fff; border: 4px solid transparent; }
.legend .pay-demo.pay-blue { border-color: var(--pay-blue); }
.legend .pay-demo.pay-debt { border-color: var(--pay-debt); }
.legend .pay-demo.pay-partial { border-color: var(--pay-partial); }
.legend .pay-demo.pay-paid { border-color: var(--pay-paid); }

/* ---------- Модалка ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(31,59,45,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 600px;
  border: 1px solid var(--border);
}
.modal.wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 21px; }
.modal-head .spacer { flex: 1 1 auto; min-width: 8px; }
.modal-head .x { border: none; background: transparent; font-size: 28px; line-height: 1; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
.modal-head .x:hover { background: var(--border-soft); color: var(--text); }
.bk-header-cancel { white-space: nowrap; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* карточка брони — детали */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-weight: 550; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.subblock { margin-top: 16px; }
.subblock h4 { font-size: 16px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 8px; }
.mini-list { font-size: 16px; }
.mini-list .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-soft); gap: 10px; }
.mini-list .row:last-child { border-bottom: none; }
.mini-list .muted { color: var(--muted); }
.hist .row { display: block; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.hist .when { color: var(--muted); font-size: 15px; }

.money-pos { color: var(--green); font-weight: 600; }
.money-neg { color: var(--danger); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 19px; color: var(--text); margin-bottom: 4px; }
.spinner { text-align: center; color: var(--muted); padding: 30px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--head); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 18px; max-width: 320px;
  animation: slidein .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--green); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.hint { font-size: 16px; color: var(--muted); margin-top: 4px; }
.avail-box { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 18px; margin-top: 4px; }
.avail-box.ok { background: #d9efdc; color: #2c6238; border: 1px solid #b9ddbf; }
.avail-box.no { background: #f3dad3; color: var(--danger); border: 1px solid #e3c1b8; }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-top: 0; }
  .mobile-top {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; background: var(--head); color: #fff;
    position: sticky; top: 0; z-index: 40;
  }
  .mobile-top svg { width: 26px; height: 26px; }
  .mobile-top .name { font-weight: 700; font-size: 20px; }
  .mobile-top .spacer { flex: 1; }
  .mobile-top .burger { background: rgba(255,255,255,.12); border: none; color: #fff; padding: 7px 11px; border-radius: 8px; font-size: 22px; }
  .grid-controls { top: 54px; }
  .drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60; }
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 230px; background: var(--head); z-index: 61; display: flex; flex-direction: column; }
  .drawer .nav { display: block; }
.drawer .nav button { width: 100%; margin-right: 0; margin-bottom: 2px; font-size: 18px; padding: 10px 12px; }
.drawer .nav .badge { margin-left: auto; }
  .topbar { display: none; }
  .content { padding: 16px 14px 60px; }
  .detail-grid { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .cards-row .stat { min-width: 120px; }
}

/* ============ Адаптив под разные устройства ============ */

/* Планшеты и небольшие ноутбуки */
@media (max-width: 1024px) {
  .content { padding: 18px 16px 50px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .cards-row .stat { min-width: 140px; }
}

/* Смартфоны (в дополнение к мобильному меню-drawer на 860px) */
@media (max-width: 600px) {
  body { font-size: 19px; }
  .content { padding: 14px 12px 48px; }
  .toolbar { gap: 8px; }
  .toolbar .field { flex: 1 1 calc(50% - 8px); }
  .toolbar .field input, .toolbar .field select { min-width: 0; width: 100%; }
  .toolbar > .btn { flex: 1 1 100%; justify-content: center; }
  .cards-row { gap: 10px; }
  .cards-row .stat { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .stat .v { font-size: 28px; }
  .grid3, .grid2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal-back { padding: 12px; }
  .modal, .modal.wide { max-width: 100%; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .kv { grid-template-columns: 110px 1fr; }
  .detail-actions .btn { flex: 1 1 auto; justify-content: center; }
  .gantt th.house-col, .gantt td.house-col { width: 46px; min-width: 46px; max-width: 46px; padding: 6px 2px; }
  .booking-bar .bm { font-size: 14px; }
}

/* Очень узкие экраны (компактные смартфоны) */
@media (max-width: 380px) {
  .cards-row .stat { flex: 1 1 100%; }
  .toolbar .field { flex: 1 1 100%; }
  .stat .v { font-size: 25px; }
}

.no-name { color: #c0563f; font-weight: 600; }
.booking-bar .bn .no-name, .booking-bar .no-name { color: #fff; opacity: .95; }
.booking-bar.bar-booking .bn .no-name,
.booking-bar.bar-booking .no-name,
.booking-bar.bar-departure .bn .no-name,
.booking-bar.bar-departure .no-name,
.booking-bar.bar-unconfirmed .bn .no-name,
.booking-bar.bar-unconfirmed .no-name,
.booking-bar.bar-confirmed .bn .no-name,
.booking-bar.bar-confirmed .no-name,
.booking-bar.bar-checked_out .bn .no-name,
.booking-bar.bar-checked_out .no-name {
  color: var(--danger);
}

/* ================= Вертикальная шахматка (домики сверху, даты слева) ================= */
.vgrid-wrap { overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 220px); touch-action: manipulation; }
.vgrid { width: max-content; min-width: 100%; position: relative; }

/* шапка домиков (липкая сверху) */
.vg-head { display: flex; position: sticky; top: 0; z-index: 8; background: var(--card); border-bottom: 2px solid var(--border); }
.vg-corner { position: sticky; left: 0; z-index: 9; background: var(--card); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--head); font-size: 15px; border-right: 2px solid var(--border); flex-shrink: 0; }
.vg-hcol { flex-shrink: 0; padding: 6px 4px; text-align: center; border-right: 1px solid #cbd0d4; box-sizing: border-box; }
.vg-hcol .hn-num { font-weight: 900; color: var(--head); font-size: 22px; line-height: 1; }

.vg-body { display: flex; position: relative; }

/* колонка дат (липкая слева) */
.vg-datecol { position: sticky; left: 0; z-index: 6; background: var(--card); flex-shrink: 0; border-right: 2px solid var(--border); }
.vg-date { position: absolute; left: 0; right: 0; box-sizing: border-box; border-bottom: 1px solid #cbd0d4; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 2px 5px; }
.vg-date .vdow { font-size: 11px; font-weight: 600; color: #51605a; line-height: 1; }
.vg-date .vdate { font-size: 16px; font-weight: 800; color: var(--head); line-height: 1.05; }
.vg-date.m-light { background: #eef0f2; }
.vg-date.m-dark { background: #e0e4e8; }
.vg-date.today { background: #dcefe0; box-shadow: inset 3px 0 0 var(--green); }
.vg-date.today .vdate { color: #2c6238; }
.vg-date.month-start { border-top: 2px solid #b9bec4; }
.vg-date.weekend .vdate { color: #c0563f; }
.vg-date.weekend .vdow { color: #c0563f; }

/* колонка-дорожка домика */
.vg-track { position: relative; flex-shrink: 0; border-right: 1px solid #cbd0d4; box-sizing: border-box; }
.vg-track .booking-bar { z-index: 3; }
.vg-track .day-bg { border-right: none; border-bottom: 1px solid #cbd0d4; }
.vg-track .day-bg.today { background: #dcefe0; }
.vg-track .day-bg.month-start { border-left: none; border-top: 2px solid #b9bec4; }

/* вертикальный бар брони */
.booking-bar.vbar { left: 3px; right: 3px; width: auto; top: 0; bottom: auto; padding: 2px 4px; justify-content: flex-start; flex-direction: column; align-items: stretch; }
.booking-bar.vbar.has-source { padding-left: 4px; padding-top: 16px; }
.booking-bar.vbar .bn { font-size: 14px; white-space: normal; word-break: break-word; line-height: 1.12; overflow: hidden; width: 100%; }
.booking-bar.vbar .bm { font-size: 13px; }
.booking-bar.vbar .source-mark { top: 3px; left: 3px; }

@media (max-width: 600px) {
  .vgrid-wrap { max-height: none; }
  .vg-hcol .hn-num { font-size: 20px; }
  .booking-bar.vbar .bn { font-size: 13px; }
}

/* Выделение интервала в шахматке (два клика: заезд → выезд) */
.day-bg.sel-range { background: rgba(79,143,163,.32) !important; box-shadow: inset 0 0 0 1px rgba(79,143,163,.7); }
.day-bg.sel-start { background: rgba(79,143,163,.55) !important; box-shadow: inset 0 0 0 2px var(--water); }
/* Замороженные даты (BookingHold — временное удержание другим источником).
   Тёмно-серый фон, виден только пока не истёк expires_at на бэкенде. */
.day-bg.held {
  background: #5c6660 !important;
  box-shadow: inset 0 0 0 1px #3d4540;
}
.day-bg.held:hover {
  background: #4d5751 !important;
}

/* Прокрутка перетаскиванием */
.drag-scroll { cursor: grab; }
.drag-scroll.dragging { cursor: grabbing; user-select: none; }
.drag-scroll.dragging * { user-select: none; }

/* Поле перехода на дату */
.goto-input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text); font-size: 15px; }

/* Карточка просмотра брони — плоский макет */
.bk-header-meta { font-size: 13px; white-space: nowrap; }

.bk-summary { margin-bottom: 10px; }
.bk-sum-title { font-size: 18px; color: var(--head); }

.bk-status-row { margin-bottom: 12px; }

.bk-guest-row { display: flex; justify-content: space-between; gap: 16px; font-size: 17px; padding: 3px 0; }
.bk-guest-row.muted { font-size: 15px; color: var(--muted); margin-bottom: 10px; }

.bk-request-line {
  color: var(--sun-dark); font-weight: 600; font-size: 15px;
  padding: 4px 0;
}
.bk-wishes { font-size: 15px; margin: 6px 0 4px; }

.bk-balance-grid { margin: 14px 0 4px; }
.bk-balance-grid .kv { grid-template-columns: 120px 1fr; font-size: 16px; }

.bk-extras-payments { margin: 14px 0; align-items: start; }
.bk-block-btn { width: 100%; margin-top: 8px; justify-content: center; }

.bk-subacc { margin-top: 4px; border-top: 1px dashed var(--border-soft); padding-top: 8px; }
.bk-subacc > summary {
  cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; touch-action: manipulation;
}
.bk-subacc > summary::-webkit-details-marker { display: none; }
.bk-subacc > summary::before { content: "▸"; font-size: 12px; color: var(--muted); }
.bk-subacc[open] > summary::before { content: "▾"; }
.bk-subacc .mini-list { margin-top: 8px; }

.bk-notes { margin-top: 16px; }
.bk-notes-label { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.bk-notes-box { background: var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; min-height: 20px; }

.bk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--border); }
.bk-actions .btn { flex: 1; min-width: 120px; justify-content: center; }
.bk-exit { width: 100%; margin-top: 10px; justify-content: center; }

@media (max-width: 600px) {
  .modal-head h3 { font-size: 18px; }
  .bk-header-cancel.btn { font-size: 14px; padding: 7px 12px; }
  .bk-header-meta { display: block; width: 100%; order: 10; margin-top: 4px; }
  .bk-guest-row { font-size: 15px; }
  .bk-extras-payments { grid-template-columns: 1fr; }
  .bk-balance-grid { grid-template-columns: 1fr; }
}


/* ==== Редизайн карточки брони (build 35) ==== */
.bk-head-meta { font-size: 12px; margin-bottom: 8px; }
.bk-guest-line { font-size: 15px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bk-phone { color: var(--head); font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--head); }
.bk-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 12px; }
.bk-tab {
  flex: 1; padding: 12px 6px; min-height: 44px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.bk-tab.active { color: var(--head); font-weight: 700; border-bottom-color: var(--head); }
.bk-money { border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
.bk-money-paid  { background: #e4f2e4; }
.bk-money-debt  { background: #fdeeda; }
.bk-money-over  { background: #e0eef7; }
.bk-money-total { font-size: 19px; font-weight: 700; }
.bk-money-sub   { font-size: 12px; color: var(--muted); }
.bk-money-paidline { margin-top: 8px; font-size: 15px; }
.bk-money-last  { font-size: 16px; font-weight: 700; margin-top: 2px; }
.bk-tab-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.bk-tab-foot .btn { min-height: 44px; }
.bk-actions .btn { min-height: 44px; }

/* ==== Карточные списки-отчёты + пагинация (build 35) ==== */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.rec-card {
  background: var(--panel, #fdfaf1); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; cursor: pointer;
}
.rec-card:active { background: #f4efe2; }
.rec-line1 { font-size: 15px; font-weight: 600; }
.rec-line2 { font-size: 14px; margin-top: 2px; }
.rec-line3 { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 15px; }
.rec-status .tag { font-size: 12px; }
.rec-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.btn-more { display: block; width: 100%; margin-top: 10px; min-height: 48px; }

/* ==== Контролы шахматки: верх/низ, тач-таргеты ==== */
.grid-controls-top, .grid-controls-bottom { display: flex; align-items: center; gap: 8px; }
.grid-controls-top { margin-bottom: 8px; }
.grid-controls-bottom { margin-top: 8px; }
.btn-touch { min-height: 44px; min-width: 44px; font-size: 16px; }
.grid-controls .seg button { min-height: 44px; padding: 0 14px; }
.grid-controls .goto-input { min-height: 44px; font-size: 15px; }
.grid-controls .spacer { flex: 1; }
