:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --ink: #2a211a;
  --muted: #7a6a5c;
  --line: #eadfd3;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3d8;
  --ok: #2f7d4f;
  --warn: #a86a00;
  --danger: #b3261e;
  --night: #3b3550;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f;
    --surface: #221c17;
    --ink: #f3ebe3;
    --muted: #b3a394;
    --line: #3a3029;
    --accent: #e0794a;
    --accent-ink: #1a120c;
    --accent-soft: #3a2519;
    --ok: #6cc391;
    --warn: #e2b04d;
    --danger: #f08a80;
    --night: #b9b2d6;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17130f; --surface: #221c17; --ink: #f3ebe3; --muted: #b3a394; --line: #3a3029;
  --accent: #e0794a; --accent-ink: #1a120c; --accent-soft: #3a2519; --ok: #6cc391; --warn: #e2b04d;
  --danger: #f08a80; --night: #b9b2d6; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.app { max-width: 640px; margin: 0 auto; padding-bottom: 32px; }
h1 { font-size: 22px; margin: 0; line-height: 1.2; }
h2 { font-size: 18px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
p { margin: 6px 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.pad { padding: 16px; }
.pad-x { padding-left: 16px; padding-right: 16px; }
.lead { font-size: 17px; margin: 14px 0 4px; }

.demo-strip {
  background: var(--night);
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: 6px 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .demo-strip { color: #17130f; } }

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.title { display: flex; flex-direction: column; min-width: 0; }
.title h1 { overflow-wrap: anywhere; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
}
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700;
}

.list { display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); color: inherit; text-align: left; font: inherit; width: 100%;
}
button.card { cursor: pointer; }
button.card:hover, .link-card:hover { border-color: var(--accent); }
.link-card { display: block; text-decoration: none; color: var(--ink); font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.price { color: var(--accent); font-weight: 600; white-space: nowrap; font-size: 15px; }
.room .small { margin-top: 4px; }

.about { margin-top: 24px; }
.about summary { cursor: pointer; font-weight: 600; padding: 10px 0; }

.crumbs { display: flex; gap: 12px; align-items: center; padding-top: 12px; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 6px 0; }

.room-detail { margin-top: 10px; }
.tariffs { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.tariffs td { padding: 5px 0; border-top: 1px solid var(--line); }
.tariffs .num { text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 8px; }
.chips.scroll { overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chips.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.chips.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; border-radius: 12px; padding: 10px 12px; min-height: 44px; cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-variant-numeric: tabular-nums;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip small { font-size: 12px; opacity: .85; }
.chip.date { min-width: 64px; }
.chip.date b { font-size: 16px; }
.chip.night:not(.on) { color: var(--night); }
.chip.closed:not(.on) { background: var(--accent-soft); border-color: var(--accent); }
.chip.dur { align-items: flex-start; }
.tabs { padding-top: 4px; }
.tabs .chip { flex-direction: row; gap: 6px; }

.stepper { display: flex; align-items: center; gap: 16px; }
.stepper output { font-size: 24px; font-weight: 700; min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }

.extra { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.extra input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.extra > span { display: flex; flex-direction: column; gap: 2px; }

.lines { margin: 8px 0; padding-left: 18px; font-size: 14px; }
.lines li { margin: 3px 0; }
.total { font-weight: 700; font-size: 17px; }

.booking .status { font-size: 14px; margin: 4px 0; }
.booking.s-pending { border-left: 4px solid var(--warn); }
.booking.s-accepted { border-left: 4px solid var(--accent); }
.booking.s-confirmed { border-left: 4px solid var(--ok); }
.booking.s-rejected, .booking.s-cancelled { opacity: .7; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; border-radius: 12px; padding: 10px 14px; min-height: 44px; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.primary.danger { color: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.round { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; padding: 0; }
.btn.wide { width: 100%; margin-top: 12px; }

.with-bar { padding-bottom: 90px; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bar-total { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .bar { left: 50%; transform: translateX(-50%); width: 640px; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; } }

.done { text-align: center; padding: 20px 0 10px; }
.done .big { font-size: 44px; }
.hint { margin-top: 14px; background: var(--accent-soft); border-color: transparent; }
.hint .btn { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  width: max-content; max-width: calc(100vw - 32px); font-size: 14px;
  display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast[hidden] { display: none; }
.toast .link { color: var(--accent-soft); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast .link { color: var(--accent); } }

/* Заметка и поля брони по телефону */
.note { font-size: 14px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
.field { display: grid; gap: 6px; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.field textarea {
  font: inherit; font-weight: 400; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; min-height: 64px;
}
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; justify-content: center; }

/* Шахматка */
:root {
  --cell-free: #e8f3ea; --cell-web: #d2683c; --cell-phone: #6b5ca5; --cell-cleanup: #efe4d6; --cell-off: #ece8e3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cell-free: #1f3326; --cell-web: #c9643a; --cell-phone: #8576c4; --cell-cleanup: #3a3027; --cell-off: #2a2420; }
}
:root[data-theme="dark"] { --cell-free: #1f3326; --cell-web: #c9643a; --cell-phone: #8576c4; --cell-cleanup: #3a3027; --cell-off: #2a2420; }

.sched-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sched { border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.sched th { font-weight: 600; color: var(--muted); padding: 4px 0; min-width: 30px; text-align: center; }
.sched .room-col {
  position: sticky; left: 0; z-index: 1; background: var(--surface); color: var(--ink);
  text-align: left; padding: 0 8px; min-width: 92px; max-width: 110px; font-size: 13px; line-height: 1.2;
}
.cell { height: 40px; min-width: 30px; border-radius: 6px; padding: 0; }
.cell button {
  width: 100%; height: 100%; border: 0; background: none; cursor: pointer; border-radius: 6px;
  color: #fff; font: inherit; font-size: 11px; font-weight: 700; padding: 0 2px; white-space: nowrap; overflow: visible;
}
.cell.free { background: var(--cell-free); }
.cell.free button:hover { outline: 2px solid var(--ok); outline-offset: -2px; }
.cell.web { background: var(--cell-web); }
.cell.phone { background: var(--cell-phone); }
.cell.st-pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }
.cell.cleanup { background: var(--cell-cleanup); }
.cell.closed { background: repeating-linear-gradient(45deg, var(--cell-off) 0 5px, var(--line) 5px 10px); }
.cell.off, .cell.past { background: var(--cell-off); opacity: .6; }
.cell.sel { outline: 3px solid var(--ink); outline-offset: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 4px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 16px; min-width: 0; border-radius: 4px; }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
