:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-alt: #efe9df;
  --text: #241f1a;
  --muted: #6e655c;
  --primary: #8c4a1e;
  --primary-hover: #703915;
  --accent: #2e6f40;
  --danger: #b9382c;
  --border: #dfd6c9;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(36, 31, 26, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

.container,
.view-section,
.owner-tab,
.client-tab,
.panel {
  min-width: 0;
  max-width: 100%;
}

.main-content {
  padding-bottom: 40px;
}

.topbar {
  background: #2b2118;
  color: #fff;
  padding: 14px 0;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 24px;
  background: rgba(255, 255, 255, 0.12);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.subtitle {
  margin: 0;
  font-size: 12px;
  color: #d6c8b8;
}

.role-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.role-btn {
  border: none;
  background: transparent;
  color: #e5d8c8;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  min-height: 36px;
}

.role-btn.active {
  background: #fff;
  color: #2b2118;
}

.hidden {
  display: none !important;
}

.subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.client-tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
}

.client-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pill {
  background: #2b2118;
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
}

.client-tab-btn.active .pill {
  background: #fff;
  color: var(--primary);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.section-header h2 {
  margin: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.bath-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.bath-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.bath-card.selected {
  border-color: var(--primary);
  background: #fdf9f3;
}

.bath-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.bath-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0;
}

.bath-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 16px;
}

.chips-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.chip-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.chip-btn.active {
  background: #2b2118;
  color: #fff;
  border-color: #2b2118;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  align-content: start;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.product-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.qty-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.two-col {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-bottom: 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.panel h3 {
  margin-top: 0;
  margin-bottom: 14px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label, .field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
}

input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-height: 42px;
  width: 100%;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.inline-form input {
  flex: 1;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
  margin: 6px 0;
}

.slot-btn {
  padding: 9px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
}

.slot-btn.busy {
  background: #f2ece4;
  color: #a39a90;
  text-decoration: line-through;
  cursor: not-allowed;
}

.slot-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
}

.service-check-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-check-left input {
  width: auto;
  min-height: auto;
}

.price-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-alt);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 16px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-lg {
  min-height: 48px;
  font-size: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #2b2118;
  color: #fff;
}

.btn-ghost {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 32px;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.booking-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fdfbf8;
}

.booking-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending, .badge-new { background: #fef3c7; color: #92400e; }
.badge-confirmed, .badge-preparing { background: #dcfce7; color: #166534; }
.badge-completed, .badge-delivered { background: #e0e7ff; color: #3730a3; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.owner-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  min-height: 40px;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--muted);
}

.kpi-card .kpi-val {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  flex: 1 1 140px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.actions-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 24px;
  background: #2b2118;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
  max-width: calc(100vw - 32px);
}

.toast.error {
  background: var(--danger);
}

.mobile-bottom-nav {
  display: none;
}

/* ==================== МОБИЛЬНАЯ ВЕРСИЯ ==================== */
@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }

  .panel {
    padding: 14px;
  }

  .topbar {
    padding: 10px 0;
    margin-bottom: 12px;
  }

  .brand h1 {
    font-size: 16px;
    line-height: 1.25;
  }

  .role-switch {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .role-btn {
    padding: 7px 8px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 34px;
  }

  .two-col, .row-2 {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 8px;
  }

  .filter-bar input,
  .filter-bar select {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .filter-bar button {
    width: 100%;
    min-width: 0;
  }

  .filter-bar button:only-of-type {
    grid-column: 1 / -1;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--surface);
  }

  .table-wrap td {
    padding: 3px 0;
    border-bottom: none;
    text-align: left;
    word-break: break-word;
  }

  .table-wrap td.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .owner-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px;
  }

  .tab-btn {
    padding: 7px 10px;
    font-size: 13px;
    min-height: 36px;
    flex: 1 1 auto;
    text-align: center;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    padding: 14px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }

  .booking-item-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .subnav {
    display: none;
  }

  .main-content {
    padding-bottom: 84px;
  }

  .toast {
    bottom: 78px;
    left: 16px;
    right: 16px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }

  .mob-nav-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
  }

  .mob-nav-btn span {
    font-size: 18px;
  }

  .mob-nav-btn.active {
    color: var(--primary);
  }

  .mob-badge {
    position: absolute;
    top: 2px;
    right: 22%;
    background: var(--primary);
    color: #fff;
    font-style: normal;
    font-size: 11px;
    border-radius: 999px;
    padding: 0 6px;
  }
}


.badge-checked_in { background: #d1fae5; color: #065f46; }
.badge-cleaning { background: #fef9c3; color: #854d0e; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 90;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-pay-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .row-3 {
    grid-template-columns: 1fr;
  }
}

.schedule-grid-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sched-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.sched-table th,
.sched-table td {
  border: 1px solid var(--border);
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
}

.sched-table th:first-child,
.sched-table td:first-child {
  text-align: left;
  min-width: 140px;
  font-weight: 600;
  background: #faf7f2;
  position: sticky;
  left: 0;
  z-index: 2;
}

.sched-cell-free { background: #ecfdf5; color: #166534; }
.sched-cell-booked { background: #fef3c7; color: #92400e; cursor: pointer; font-weight: 600; }
.sched-cell-in { background: #dbeafe; color: #1e40af; cursor: pointer; font-weight: 600; }
.sched-cell-clean { background: #ffedd5; color: #9a3412; cursor: pointer; font-weight: 600; }
.sched-cell-maint { background: #f1f5f9; color: #475569; }

/* Инструкция и уведомления об обновлениях */
.modal-card-wide {
  max-width: 860px;
  width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.guide-scroll-body {
  overflow-y: auto;
  max-height: 68vh;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.guide-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.guide-step {
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  margin: 8px 0;
  background: #faf7f2;
  border-radius: 0 8px 8px 0;
}

.guide-step strong {
  display: block;
  margin-bottom: 2px;
}

.guide-img-wrap {
  margin: 10px 0;
  text-align: center;
}

.guide-img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8f5f0;
  cursor: zoom-in;
}

.guide-tip {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-top: 8px;
}

.whats-new-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px;
}

.whats-new-box ul,
.whats-new-box ol {
  margin: 6px 0 0 18px;
  padding: 0;
}

.whats-new-box li {
  margin-bottom: 4px;
}


/* ===== Страница бани (витрина) ===== */
#client-view.landing-mode > :not(#landing-view) { display: none !important; }
.landing-hero { padding: 0; overflow: hidden; }
.landing-hero > :not(.landing-gallery) { margin-left: 16px; margin-right: 16px; }
.landing-gallery { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; margin-bottom: 12px; }
.landing-gallery img { flex: 0 0 auto; width: min(86%, 520px); height: 300px; object-fit: cover; scroll-snap-align: start; border-radius: 0; }
.landing-title { margin: 12px 0 4px; font-size: 1.6rem; }
.landing-subtitle { margin: 0 0 10px; }
.landing-contacts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; }
.landing-contacts a { text-decoration: none; }
.landing-description { white-space: pre-line; line-height: 1.5; }
.landing-video { margin: 12px 16px; }
.landing-video-frame { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; }
.landing-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.landing-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 16px 18px; }
@media (max-width: 600px) { .landing-gallery img { height: 220px; width: 88%; } }

/* ===== Оплата по QR ===== */
.pay-methods-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; text-align: left; }
.pay-method-card { border: 1px solid rgba(0,0,0,0.12); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pay-method-title { font-weight: 700; }
.pay-qr { width: 200px; max-width: 100%; height: auto; border-radius: 8px; background: #fff; }
.pay-qr-sm { width: 110px; }
.pay-qr-empty { width: 110px; height: 110px; display: flex; align-items: center; justify-content: center; border: 1px dashed rgba(0,0,0,0.25); border-radius: 8px; text-align: center; }
.ld-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-photo { position: relative; }
.ld-photo img { width: 140px; height: 100px; object-fit: cover; border-radius: 8px; display: block; }
.ld-photo button { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,0.9); }
.ld-link-qr { margin-top: 12px; }
.ld-link-qr img, .ld-link-qr canvas { background: #fff; padding: 6px; border-radius: 8px; }


/* График, выходные, согласие */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .85rem; }
.chip button { border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 6px; color: var(--muted); }
#wh-table select { min-width: 0; padding: 4px 6px; }
#wh-table td, #wh-table th { padding: 4px 6px; }
.bk-consent-box { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); display: flex; flex-direction: column; gap: 6px; }
.bk-consent-box p { margin: 0; }

/* Галочки и переключатели: в одну строку с текстом */
.checkbox-inline { display: block; line-height: 1.4; }
.checkbox-inline input[type="checkbox"], .checkbox-inline input[type="radio"],
#wh-table input[type="checkbox"] { width: 18px; height: 18px; min-width: 0; min-height: 0; padding: 0; margin: 0 6px 0 0; display: inline-block; vertical-align: -3px; flex: none; }
