:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f6fed; --accent-soft: #e6eefe; --accent-text: #ffffff;
  --ok: #1f9d55; --danger: #d43c3c; --booked: #f3e8ff; --booked-text: #6b2fb3; --busy: #eceef2;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151b; --card: #1b2029; --text: #e7eaf0; --muted: #98a0b3; --line: #2c3340;
          --accent: #6b9bff; --accent-soft: #24324f; --accent-text: #0d1220;
          --ok: #4cc785; --danger: #ff6b6b; --booked: #33264a; --booked-text: #d8b9ff; --busy: #252b36; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Rubik, Arial, sans-serif; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; line-height: 1.25; color: var(--text); text-decoration: none; padding: 6px 0; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.tagline { font-size: .85rem; color: var(--muted); }
.tagline-note { color: var(--accent); font-weight: 500; }
.nav { display: flex; gap: 16px; align-items: center; }
.nav a { color: var(--text); text-decoration: none; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 380px; margin: 40px auto; }
.center { text-align: center; } .row.center { justify-content: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; } .wrapy { flex-wrap: wrap; gap: 12px; }
.muted { color: var(--muted); } .ok { color: var(--ok); } .big { font-size: 1.3rem; font-weight: 600; }
.alert { background: #fdecec; color: #8a1f1f; border-radius: 8px; padding: 10px 14px; }
@media (prefers-color-scheme: dark) { .alert { background: #3a1d1d; color: #ffc9c9; } }
label { display: block; margin-bottom: 12px; font-weight: 500; }
input, textarea, select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.row input, .tools input { display: inline-block; width: auto; margin: 0; }
input.num { width: 70px; }
button, .button { display: inline-block; font: inherit; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; }
button:disabled { opacity: .4; cursor: default; }
.primary, .button { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.ghost, .button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.small { padding: 5px 10px; font-size: .9rem; }
.danger-link { background: none; border: none; color: var(--danger); padding: 6px 0; margin-top: 10px; text-decoration: underline; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
.check { font-size: 2.6rem; color: var(--ok); }
.chosen { font-weight: 600; color: var(--accent); }
code { background: var(--bg); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.label { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* client: days + times */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 10px; }
.day .wd { font-size: .85rem; color: var(--muted); } .day .dt { font-weight: 600; } .day .n { font-size: .8rem; color: var(--accent); }
.day.sel { background: var(--accent-soft); border-color: var(--accent); }
.day.off { opacity: .45; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.time { padding: 10px 0; font-weight: 600; }
.time:hover, .day:not(:disabled):hover { border-color: var(--accent); }
@media (max-width: 520px) { .days { grid-template-columns: repeat(4, 1fr); } }

/* admin grid */
/* the whole week (7 days) always fits the width — no sideways scrolling, also on a phone */
.grid-wrap { width: 100%; }
.grid { border-collapse: separate; border-spacing: 3px; width: 100%; table-layout: fixed; user-select: none; touch-action: none; }
.grid th { font-weight: 500; font-size: .85rem; color: var(--muted); padding: 2px 0; white-space: nowrap; overflow: hidden; }
.grid th:first-child { width: 46px; }
.grid td { height: 28px; min-width: 0; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); cursor: pointer;
  font-size: .75rem; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.grid td.on { background: var(--accent); border-color: var(--accent); }
.grid td.busy:not(.on) { background: repeating-linear-gradient(45deg, var(--busy), var(--busy) 4px, transparent 4px, transparent 8px); }
.grid td.on.busy { opacity: .55; }
.grid td.booked { background: var(--booked); color: var(--booked-text); border-color: transparent; cursor: default; font-weight: 600; }
.grid td.past { opacity: .35; cursor: default; }
.tools .tool { padding: 10px 0; border-bottom: 1px solid var(--line); } .tools .tool:last-child { border: none; }
.chip { display: inline-flex; gap: 4px; align-items: center; font-weight: 400; margin: 0; }
.chip input { width: auto; margin: 0; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { text-align: start; padding: 8px; border-bottom: 1px solid var(--line); }
table.list tr.cancelled td { color: var(--muted); text-decoration: line-through; }
.notice { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 10px 14px; }
p.center { margin-top: 8px; }
@media (max-width: 600px) {
  .wrap { padding: 0 8px; }
  .card { padding: 12px 8px; }
  .grid { border-spacing: 2px; }
  .grid th { font-size: .72rem; }
  .grid th:first-child { width: 36px; }
  .grid td { height: 30px; font-size: .62rem; border-radius: 4px; }
}
/* booking details dialog */
.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
  padding: 20px; width: min(420px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal h2 { margin: 0 0 4px; }
.modal .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.modal .actions > * { flex: 1 1 auto; text-align: center; }
.modal .close { width: 100%; margin-top: 4px; }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.grid td.booked { cursor: pointer; }
body.moving .grid td:not(.booked):not(.past):hover { outline: 2px solid var(--accent); }
#move-bar { margin-bottom: 10px; }
.rsvp { font-weight: 600; } .rsvp[data-status="accepted"] { color: var(--ok); }
.rsvp[data-status="declined"] { color: var(--danger); } .rsvp[data-status="needsAction"] { color: var(--muted); }
.grid td.booked.declined { outline: 2px solid var(--danger); }
