:root {
  --bg: #f6f3ec; --card: #fffefb; --ink: #25261f; --muted: #6a6a5f; --line: #e3ded0;
  --accent: #36634a; --accent-ink: #fff; --wood: #8a5a2b;
  --ok: #2e7d32; --warn: #a86400; --err: #b3261e; --info: #1f5f8b;
  --ok-bg: #e5f3e6; --warn-bg: #fdf0d5; --err-bg: #fbe4e1; --info-bg: #e1eef7; --soft: #efeadc;
  --free: #d7ebd9; --half: #f6e3b4; --busy: #f2c4bd;
  --bar-ok: #3d8456; --bar-ok-ink: #fff; --bar-done: #6c8fae; --bar-done-ink: #fff; --bar-draft: #e8b14a; --bar-draft-2: #f3d18a; --bar-draft-ink: #3a2905;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1d19; --card: #24271f; --ink: #ecebe2; --muted: #a2a294; --line: #3a3e33;
    --accent: #6fae88; --accent-ink: #12150f; --wood: #d1a46c;
    --ok: #8fd194; --warn: #f0b95b; --err: #f29b92; --info: #8cc3ec;
    --ok-bg: #243a26; --warn-bg: #44371a; --err-bg: #47241f; --info-bg: #1f3646; --soft: #2d3027;
    --free: #2b4a30; --half: #5a4a22; --busy: #5a2f29;
    --bar-ok: #3b7c53; --bar-ok-ink: #f1fbf3; --bar-done: #4b6c8a; --bar-done-ink: #eef5fc; --bar-draft: #b9882c; --bar-draft-2: #a07424; --bar-draft-ink: #1c1403;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
header.top { background: var(--accent); color: var(--accent-ink); }
.bar { max-width: 1120px; margin: 0 auto; padding: .55rem 16px; display: flex; align-items: center; gap: 1rem; }
.brand { font-weight: 700; letter-spacing: .01em; white-space: nowrap; color: inherit; text-decoration: none; font-size: 1.1rem; }
nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav a { color: inherit; text-decoration: none; padding: .35rem .65rem; border-radius: 6px; white-space: nowrap; font-size: .93rem; opacity: .92; }
nav a:hover, nav a.on { background: rgba(255,255,255,.18); opacity: 1; }
.pill { background: var(--warn); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .4rem; margin-left: .2rem; }
main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.card.booking-new { background: var(--info-bg); border-left: 4px solid var(--info); }
.booking-new li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.booking-new li .btn { margin-left: auto; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid > .card { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.tw { overflow-x: auto; }
table.t { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--line); padding: 6px 8px; white-space: nowrap; }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; background: var(--soft); white-space: nowrap; }
.st-confirmed, .pay-paid { background: var(--ok-bg); color: var(--ok); }
.st-draft, .pay-partial, .pay-unknown_total { background: var(--warn-bg); color: var(--warn); }
.st-cancelled { background: var(--soft); color: var(--muted); text-decoration: line-through; }
.st-completed { background: var(--info-bg); color: var(--info); }
.pay-unpaid, .pay-overpaid { background: var(--err-bg); color: var(--err); }
.pay-review { background: var(--info-bg); color: var(--info); border: 1px dashed var(--info); }
.pay-cancelled { background: transparent; color: var(--muted); }
.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--line); }
.flash.ok { background: var(--ok-bg); } .flash.error { background: var(--err-bg); } .flash.warn { background: var(--warn-bg); }
.note { padding: .55rem .8rem; border-radius: 8px; margin: 8px 0; background: var(--warn-bg); border-left: 4px solid var(--warn); }
.note.info { background: var(--info-bg); border-color: var(--info); }
.note.err { background: var(--err-bg); border-color: var(--err); }
form.inline { display: inline; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .5rem 0 .15rem; }
input, select, textarea { width: 100%; font: inherit; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); min-height: 40px; }
textarea { min-height: 80px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; margin-right: .35rem; }
label.chk { display: flex; align-items: center; color: var(--ink); font-size: .95rem; }
.fg { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.btn { display: inline-block; font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: .42rem .9rem; border-radius: 7px; text-decoration: none; min-height: 40px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.sm { padding: .15rem .6rem; min-height: 32px; font-size: .88rem; }
details { margin: 6px 0; } summary { cursor: pointer; color: var(--accent); }
details[open] > summary { margin-bottom: 6px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); } .list li:last-child { border-bottom: 0; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 3px; }
.strip div { text-align: center; font-size: .72rem; border-radius: 5px; padding: 3px 0; line-height: 1.15; }
.strip .f2 { background: var(--free); } .strip .f1 { background: var(--half); } .strip .f0 { background: var(--busy); }
/* Календар: місяць пн–нд; у клітинці дня — по смужці на будинок (ніч з цього дня на наступний) */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head h1 { margin: 0; min-width: 9.5ch; text-align: center; white-space: nowrap; }
.cal-acts { display: flex; gap: 8px; flex: 1; justify-content: space-between; }
.cal-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.cal-stats b { color: var(--ink); font-weight: 600; }
.cal-layout { display: grid; gap: 14px; align-items: start; }
@media (min-width: 900px) { .cal-layout { grid-template-columns: minmax(0, 1fr) 330px; } }
.cal-layout .card { margin: 0; }
.cal-side { display: grid; gap: 14px; }
.cal-card { padding: 0; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd div { text-align: center; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line); }
.cal-wd div.wk { color: var(--wood); }
.cal-day { display: flex; flex-direction: column; gap: 3px; min-height: 92px; padding: 4px 0 6px; color: var(--ink); text-decoration: none;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.wk { background: var(--soft); }
.cal-day.out { background: var(--bg); }
.cal-day.out .cal-num { color: var(--muted); font-weight: 400; }
.cal-day:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { display: grid; place-items: center; width: 26px; height: 26px; margin: 0 5px 1px; border-radius: 50%; font-size: .9rem; font-weight: 600; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-bar { display: block; height: 20px; margin-right: -1px; }
.cal-bar.confirmed { background: var(--bar-ok); color: var(--bar-ok-ink); }
.cal-bar.completed { background: var(--bar-done); color: var(--bar-done-ink); }
.cal-bar.draft { color: var(--bar-draft-ink);
  background: repeating-linear-gradient(45deg, var(--bar-draft), var(--bar-draft) 5px, var(--bar-draft-2) 5px, var(--bar-draft-2) 10px); }
.cal-bar.head { margin-left: 4px; border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.cal-bar.tail { margin-right: 4px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.cal-bar.clash { outline: 2px solid var(--err); outline-offset: -2px; }
.cal-lbl { display: block; position: relative; z-index: 1; width: calc(var(--span) * 100%); padding: 0 7px; font-size: .75rem; line-height: 20px;
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 12px; }
.cal-legend span { display: flex; align-items: center; gap: 6px; }
.cal-legend span:first-child { flex-basis: 100%; display: block; }
.cal-legend i.cal-bar { display: inline-block; width: 26px; height: 12px; margin: 0; border-radius: 6px; }
.cal-legend i.cal-bar:not(.confirmed):not(.draft):not(.completed) { border: 1px dashed var(--muted); }
.cal-dayp h2 { margin-bottom: .7rem; }
.cal-house { margin-bottom: 10px; }
.cal-house-name { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.cal-stay { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--soft); border-left: 4px solid var(--bar-ok);
  color: var(--ink); text-decoration: none; margin-bottom: 4px; }
.cal-stay.completed { border-left-color: var(--bar-done); }
.cal-stay.draft { border-left-color: var(--bar-draft); }
.cal-stay span { font-size: .85rem; color: var(--muted); }
.cal-stay .badge { justify-self: start; }
.cal-free { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 6px 10px;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--ok); font-weight: 600; }
.cal-moves { margin-top: 6px; }
.cal-item { display: block; padding: 8px 0 8px 10px; margin-bottom: 2px; border-left: 4px solid var(--bar-ok);
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.cal-item.completed { border-left-color: var(--bar-done); }
.cal-item.draft { border-left-color: var(--bar-draft); }
.cal-item:last-child { border-bottom: 0; }
.cal-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-d { display: block; font-weight: 600; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cal-item-sub { display: block; font-size: .84rem; color: var(--muted); }
@media (max-width: 640px) {
  .cal-head h1 { min-width: 0; flex: 1; font-size: 1.2rem; }
  .cal-acts { flex-basis: 100%; }
  .cal-day { min-height: 62px; gap: 3px; padding-top: 3px; }
  .cal-num { width: 24px; height: 24px; margin: 0 auto 1px; font-size: .82rem; }
  .cal-bar { height: 9px; }
  .cal-bar.head { margin-left: 3px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
  .cal-bar.tail { margin-right: 3px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
  .cal-lbl { display: none; }
  .cal-card { margin-left: -8px !important; margin-right: -8px !important; }
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; }
.kv dd .badge { white-space: normal; }
.login { max-width: 360px; margin: 12vh auto; }
.copybox { white-space: pre-wrap; overflow-wrap: anywhere;background: var(--soft); border-radius: 8px; padding: 10px; font-size: .92rem; }
@media (max-width: 640px) { h1 { font-size: 1.3rem; } .bar { gap: .5rem; } }
