:root {
  --teal: #1f6f72; --teal-dark: #17565a; --teal-soft: #e4f0ee; --teal-line: #b9d6d2;
  --ochre: #c4841d; --ochre-soft: #fbf0db; --ochre-dark: #94620f;
  --ink: #22302f; --muted: #647471; --line: #dfe5e1; --bg: #faf7f1; --card: #fff;
  --red: #b3412f; --red-soft: #fbe9e5; --plum: #6b4e7d; --plum-soft: #efe8f3;
  --radius: 10px; --shadow: 0 1px 2px rgba(34,48,47,.06), 0 4px 14px rgba(34,48,47,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
a { color: var(--teal); }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--teal); text-decoration: none; display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand i { width: 12px; height: 26px; border-radius: 3px; background: linear-gradient(var(--teal) 0 62%, var(--ochre) 62%); display: inline-block; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button { font: inherit; font-size: .95rem; color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 8px; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--teal-soft); }
.nav a.on { color: var(--teal); font-weight: 600; background: var(--teal-soft); }
.demo-banner { background: var(--ochre); color: #fff; text-align: center; padding: 6px 12px; font-size: .9rem; font-weight: 600; }

/* controls */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--teal); background: var(--teal); color: #fff; border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: var(--teal-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--teal); }
.btn.ghost:hover { background: var(--teal-soft); }
.btn.ochre { background: var(--ochre); border-color: var(--ochre); } .btn.ochre:hover { background: var(--ochre-dark); }
.btn.danger { background: #fff; color: var(--red); border-color: #e3b8b0; } .btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 10px; font-size: .875rem; } .btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); text-decoration: underline; cursor: pointer; }
label { display: block; font-size: .875rem; font-weight: 600; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #c9d3cf; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1 1 140px; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: .95rem; margin: 0 12px 6px 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--teal); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.notice { background: var(--ochre-soft); border: 1px solid #ecd3a0; border-radius: 8px; padding: 10px 12px; font-size: .92rem; margin-bottom: 12px; }
.notice.err { background: var(--red-soft); border-color: #e9bdb4; color: #7c2a1c; }
.notice.ok { background: var(--teal-soft); border-color: var(--teal-line); }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--teal-soft); color: var(--teal-dark); white-space: nowrap; }
.pill.ochre { background: var(--ochre-soft); color: var(--ochre-dark); } .pill.grey { background: #eceeed; color: #55615f; }
.pill.red { background: var(--red-soft); color: var(--red); } .pill.plum { background: var(--plum-soft); color: var(--plum); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
.tablewrap { overflow-x: auto; }

/* toast + modal */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; max-width: 92vw; box-shadow: var(--shadow); }
#toast.err { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(34,48,47,.45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px 14px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 680px; }
.modal h2 { margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* booking page */
.hero { padding: 28px 0 8px; }
.hero p { max-width: 62ch; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; padding-bottom: 60px; }
.daybar { display: flex; align-items: center; gap: 8px; margin: 14px 0 16px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; flex: 1; }
.day { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 2px; text-align: center; cursor: pointer; font: inherit; color: var(--ink); line-height: 1.2; }
.day b { display: block; font-size: 1.1rem; } .day span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.day:hover { border-color: var(--teal); }
.day.on { background: var(--teal); border-color: var(--teal); color: #fff; } .day.on span { color: #d5e9e6; }
.day:disabled { opacity: .4; cursor: not-allowed; }
.day .dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--ochre); margin: 3px auto 0; visibility: hidden; }
.day.has .dot { visibility: visible; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.1rem; color: var(--teal); flex: none; }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }
.datehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.datehead input { width: auto; }
.room { margin-bottom: 14px; }
.room-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.timeline { position: relative; height: 10px; border-radius: 6px; background: var(--teal-soft); margin: 8px 0 4px; overflow: hidden; }
.timeline i { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, #9fb0ac 0 5px, #b4c2bf 5px 10px); }
.timeline i.mine { background: var(--ochre); }
.tl-labels { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-bottom: 10px; }
.slotgroup { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: start; padding: 7px 0; border-top: 1px dashed #e6ebe8; }
.slotgroup > span { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 9px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { font: inherit; border: 1.5px solid var(--teal-line); background: #fff; color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; text-align: left; line-height: 1.25; min-width: 132px; }
.slot b { display: block; font-size: .93rem; } .slot small { color: var(--muted); font-size: .8rem; }
.slot:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-soft); }
.slot.on, .slot.on:hover:not(:disabled) { background: var(--teal); border-color: var(--teal); color: #fff; } .slot.on small { color: #d5e9e6; }
.slot:disabled { background: #f1f3f2; border-color: #e3e7e5; color: #98a4a1; cursor: not-allowed; }
.slot:disabled b { text-decoration: line-through; } .slot:disabled small { color: #a7b1ae; }
.basket { position: sticky; top: 78px; }
.basket ul { list-style: none; margin: 0 0 10px; padding: 0; }
.basket li { display: flex; gap: 8px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #edf0ee; font-size: .92rem; }
.basket li button { border: 0; background: none; color: var(--red); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1rem; margin: 10px 0 14px; }
.mobilebar { display: none; }

/* admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 18px 0; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); }
.tabs button.on { color: var(--teal); border-bottom-color: var(--teal); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--teal); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; font-size: .9rem; padding: 7px 12px; border: 0; background: #fff; color: var(--teal); cursor: pointer; }
.seg button.on { background: var(--teal); color: #fff; }
.cal { display: grid; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.cal-head { position: sticky; top: 0; background: #fff; font-weight: 600; padding: 8px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid #edf0ee; font-size: .92rem; }
.cal-axis { position: relative; border-right: 1px solid var(--line); }
.cal-axis span { position: absolute; right: 6px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); }
.cal-col { position: relative; border-left: 1px solid #edf0ee; background-image: linear-gradient(#edf0ee 1px, transparent 1px); background-size: 100% 60px; cursor: cell; min-width: 130px; }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: .78rem; line-height: 1.25; overflow: hidden; cursor: pointer; border-left: 4px solid var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.ev b { display: block; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.admin { border-left-color: var(--ochre); background: var(--ochre-soft); color: var(--ochre-dark); }
.ev.recurring { border-left-color: var(--plum); background: var(--plum-soft); color: var(--plum); }
.ev.block { border-left-color: #7d8886; background: repeating-linear-gradient(135deg, #eceeed 0 6px, #e2e6e4 6px 12px); color: #4c5856; }
.ev.pending { border-style: dashed; border-width: 1px 1px 1px 4px; border-color: var(--teal); opacity: .75; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.week { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); table-layout: fixed; min-width: 900px; }
.week th { text-align: center; cursor: pointer; } .week th.today { color: var(--teal); }
.week td { border-left: 1px solid #edf0ee; padding: 5px; height: 74px; cursor: cell; }
.week td:first-child, .week th:first-child { width: 110px; font-weight: 600; cursor: default; border-left: 0; }
.chip { display: block; font-size: .72rem; line-height: 1.25; padding: 3px 5px; border-radius: 5px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.chip.admin { border-left-color: var(--ochre); background: var(--ochre-soft); color: var(--ochre-dark); }
.chip.recurring { border-left-color: var(--plum); background: var(--plum-soft); color: var(--plum); }
.chip.block { border-left-color: #7d8886; background: #eceeed; color: #4c5856; }
.offer-table input[type=text], .offer-table input[type=time], .offer-table input[type=number], .offer-table select { padding: 5px 7px; font-size: .9rem; }
.offer-table td { padding: 5px 6px; vertical-align: middle; }
.daypick { display: inline-flex; gap: 2px; }
.daypick label { margin: 0; cursor: pointer; }
.daypick input { position: absolute; opacity: 0; pointer-events: none; }
.daypick span { display: inline-block; width: 24px; height: 26px; line-height: 26px; text-align: center; border-radius: 5px; font-size: .75rem; font-weight: 600; background: #eef1ef; color: #8a9693; }
.daypick input:checked + span { background: var(--teal); color: #fff; }
.daypick input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 1px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat b { display: block; font-size: 1.3rem; font-family: var(--serif); }
.stat span { font-size: .8rem; color: var(--muted); }
details.room-edit { margin-bottom: 12px; }
details.room-edit > summary { cursor: pointer; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; list-style-position: inside; }
details.room-edit[open] > summary { margin-bottom: 14px; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: .95rem; margin-bottom: 12px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .basket { position: static; }
  .mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--teal); color: #fff; padding: 10px 16px; justify-content: space-between; align-items: center; z-index: 40; font-weight: 600; }
  .mobilebar a { color: #fff; background: var(--ochre); padding: 7px 14px; border-radius: 8px; text-decoration: none; }
  .slotgroup { grid-template-columns: 1fr; gap: 2px; } .slotgroup > span { padding-top: 0; }
  .slot { min-width: 0; flex: 1 1 130px; }
  .day b { font-size: 1rem; }
}
@media (max-width: 480px) { .wrap { padding: 0 12px; } .brand { font-size: 1rem; } .day span { font-size: .62rem; } }

.chip b { display: block; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { body { padding-bottom: 56px; } }
