/* Calendar. Booking colours: private = red, talk to me = orange, shared = mustard, collective event = plum,
   and every free hour is an inviting grassy green ("open"). */
:root {
  --open: #dcedc6;
  --open-line: #c8e0ad;
  --private: #d6544a;
  --talk: #ee9446;
  --shared: #e9c25a;
  --collective: #8e6bbf; /* plum, for meetings and sharings */
}

.badge.playground { background: #f9e7c4; }

.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; background: var(--bg); border-radius: 999px; }
.seg button {
  font: inherit; font-size: .9rem; border: none; background: none; color: var(--text);
  padding: .3rem .8rem; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }


/* Toolbar */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: .9rem 0 .8rem; }
.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-nav .range { margin-left: .4rem; font-size: 1.1rem; }
.btn.plus { width: 2.3rem; height: 2.3rem; padding: 0; font-size: 1.4rem; line-height: 1; border-radius: 50%; }
.btn.round { width: 2.2rem; height: 2.2rem; padding: 0; border-radius: 50%; font-size: 1.2rem; line-height: 1; }
.cal-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Small pop-up menus in the toolbar (rooms, colour key) */
.pop { position: relative; }
.pop summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pop summary::-webkit-details-marker { display: none; }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; min-width: 13rem;
  background: var(--surface); border-radius: 18px; padding: .7rem 1rem; box-shadow: 0 12px 30px -10px rgb(80 40 20 / .35);
}
.pop-panel p { margin: .3rem 0; font-size: .9rem; white-space: nowrap; }
.pop-panel label.check { margin: .35rem 0; white-space: nowrap; }
.sw { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; vertical-align: -2px; margin-right: .35rem; }
.sw.open { background: var(--open); border: 1px solid var(--open-line); }
.sw.private { background: var(--private); }
.sw.talk { background: var(--talk); }
.sw.shared { background: var(--shared); }
.sw.collective { background: var(--collective); }

/* Time grid: every day has one column per visible room */
.cal-wrap { background: var(--surface); border-radius: var(--round); box-shadow: var(--shadow); overflow: hidden; }
.cal-scroll { max-height: 70vh; overflow: auto; overscroll-behavior: contain; }
.cal-grid {
  display: grid; position: relative;
  width: max-content; min-width: 100%; /* so the hour labels stay pinned when scrolling sideways */
  grid-template-columns: 3.4rem repeat(var(--cols), minmax(5.2rem, 1fr));
}
.corner, .day-head, .room-head { position: sticky; background: var(--surface); z-index: 3; }
.corner { left: 0; z-index: 4; }
.corner, .day-head { top: 0; height: 2.2rem; }
.corner.sub, .room-head { top: 2.2rem; height: 1.7rem; }
.day-head { display: flex; align-items: center; justify-content: center; gap: .3rem; font-size: .9rem; border-left: 3px solid var(--bg); }
.day-head b { font-size: 1.05rem; }
.day-head.is-today b { background: var(--core); border-radius: 999px; padding: 0 .45rem; }
.room-head { display: grid; place-items: center; font-size: .75rem; color: var(--muted); border-bottom: 2px solid var(--line); }
.room-head.first { border-left: 3px solid var(--bg); }

.hours { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.hours span { display: block; height: var(--hour); font-size: .72rem; color: var(--muted); padding: 0 .4rem; transform: translateY(-.5em); text-align: right; }
.hours span:first-child { transform: none; }

.col {
  position: relative; height: calc(24 * var(--hour)); cursor: pointer;
  background: repeating-linear-gradient(to bottom, var(--open) 0 calc(var(--hour) - 1px), var(--open-line) calc(var(--hour) - 1px) var(--hour));
  border-left: 1px solid var(--surface);
}
.col.first { border-left: 3px solid var(--bg); }
.col:hover { filter: brightness(1.02); }

.bk {
  position: absolute; left: 3px; right: calc(3px + var(--lanes, 0) * 1.25rem); z-index: 1;
  display: flex; flex-direction: column; gap: .05rem; overflow: hidden; text-align: left;
  padding: .25rem .45rem; border: none; border-radius: 14px; font: inherit; font-size: .78rem; line-height: 1.2;
  color: var(--text); cursor: pointer; box-shadow: 0 4px 12px -6px rgb(80 40 20 / .35);
}
.bk b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk.private { background: var(--private); color: #fff; }
.bk.talk { background: var(--talk); }
.bk.shared { background: var(--shared); }
.bk.collective { background: var(--collective); color: #fff; }
.bk.mine { outline: 3px solid var(--surface); outline-offset: -3px; }
.bk.ghost { background: rgb(255 255 255 / .55); border: 2px dashed var(--text); box-shadow: none; pointer-events: none; z-index: 2; }
.bk.ghost.private { background: color-mix(in srgb, var(--private) 70%, transparent); color: #fff; }
.bk.ghost.talk { background: color-mix(in srgb, var(--talk) 70%, transparent); }
.bk.ghost.shared { background: color-mix(in srgb, var(--shared) 70%, transparent); }
.bk.ghost.collective { background: color-mix(in srgb, var(--collective) 70%, transparent); color: #fff; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; pointer-events: none; }

/* Month */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; padding: 6px; }
.month-head { text-align: center; font-size: .8rem; color: var(--muted); padding: .3rem 0; }
.month-day {
  display: flex; flex-direction: column; gap: 2px; min-height: 5.5rem; padding: .3rem; overflow: hidden;
  border: none; border-radius: 14px; background: var(--open); font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.month-day.other { opacity: .45; }
.month-day.is-today .num { background: var(--core); border-radius: 999px; padding: 0 .4rem; }
.month-day .num { font-weight: 600; font-size: .9rem; align-self: flex-start; }
.dots { display: flex; flex-wrap: wrap; gap: 3px; }
.mdot { width: .5rem; height: .5rem; border-radius: 50%; }
.mdot.private { background: var(--private); }
.mdot.talk { background: var(--talk); }
.mdot.shared { background: var(--shared); }
.mdot.collective { background: var(--collective); }
.mdot.due { border-radius: 2px; background: var(--cat); }
.pip { font-size: .7rem; border-radius: 8px; padding: 0 .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip.private { background: var(--private); color: #fff; }
.pip.talk { background: var(--talk); }
.pip.shared { background: var(--shared); }
.pip.collective { background: var(--collective); color: #fff; }
.more { font-size: .7rem; color: var(--muted); }

/* Booking form and details */
.booking-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.booking-form .when { background: var(--bg); padding: .6rem .9rem; border-radius: 18px; }
.label { font-weight: 500; margin: .2rem 0 .5rem; }
.modes { display: grid; gap: .4rem; margin-bottom: 1rem; }
.mode {
  display: flex; align-items: center; gap: .7rem; margin: 0; padding: .45rem .7rem; cursor: pointer;
  border-radius: 18px; border: 2px solid transparent; background: var(--bg); font-weight: 400;
}
.mode input { position: absolute; opacity: 0; width: 1px; }
.mode .blob { width: 2rem; height: 2rem; flex: none; }
.mode.private .blob { background: var(--private); }
.mode.talk .blob { background: var(--talk); }
.mode.shared .blob { background: var(--shared); }
.mode.collective .blob { background: var(--collective); }
.mode small { display: block; color: var(--muted); }
.mode:has(input:checked) { border-color: var(--text); background: var(--surface); }
.mode:has(input:focus-visible) { outline: 2px solid var(--core); }
.overlap-box { background: var(--bg); border-radius: 18px; padding: .6rem .9rem; margin-bottom: .75rem; }
.overlaps { margin: .3rem 0 0; padding: 0; list-style: none; display: grid; gap: .25rem; }
.overlaps li.clash { color: var(--danger); }
.calm { color: var(--ok); }
.warn { color: var(--danger); }
.chip { display: inline-block; padding: .1rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; }
.chip.private { background: var(--private); color: #fff; }
.chip.talk { background: var(--talk); }
.chip.shared { background: var(--shared); }
.chip.collective { background: var(--collective); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50;
  max-width: min(92vw, 30rem); padding: .7rem 1.2rem; border-radius: 20px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow); text-align: center;
}

@media (max-width: 640px) {
  .cal-grid { grid-template-columns: 2.8rem repeat(var(--cols), minmax(4.6rem, 1fr)); }
  .booking-form .two { grid-template-columns: 1fr; }
  .month-day { min-height: 4rem; }
  .pip { font-size: .6rem; }
}

/* Phone "Days" view: each day is exactly one screen wide and snaps into place */
.cal-scroll.roll { scroll-snap-type: x mandatory; }
.cal-grid.roll { grid-template-columns: 2.8rem repeat(var(--cols), calc(var(--dayw, 80vw) / var(--rooms))); }
.cal-grid.roll .col.first { scroll-snap-align: start; }

/* Tasks due on a day: a row at the top of each day (and small pips in the month view) */
.sw.due { background: #fff; border: 2px solid var(--muted); border-radius: 4px; }
.corner.tasks-corner, .day-tasks { position: sticky; top: 3.9rem; z-index: 3; background: var(--surface); border-bottom: 2px solid var(--line); }
.corner.tasks-corner { left: 0; z-index: 4; display: grid; place-items: center; font-size: .7rem; color: var(--muted); }
.day-tasks { display: flex; flex-wrap: wrap; align-content: flex-start; gap: .25rem; padding: .3rem; min-height: 2.1rem; border-left: 3px solid var(--bg); }
.task-chip {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; overflow: hidden;
  padding: .1rem .55rem; border-radius: 8px; border: none; border-left: 4px solid var(--cat);
  background: color-mix(in srgb, var(--cat) 30%, var(--surface)); color: var(--text);
  font: inherit; font-size: .75rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
}
.task-chip span { flex: none; }
.task-chip.needs-someone { outline: 1.5px dashed var(--muted); outline-offset: -1.5px; }
.pip.due { background: color-mix(in srgb, var(--cat) 35%, var(--surface)); border-left: 3px solid var(--cat); }
.badge.playground { margin-right: .3rem; }

/* "I'll be there (stays open)": slim green capsules on the right edge of a room's column.
   They never block the room; real bookings just make a little space for them. */
:root { --here: #6fae74; }
.here {
  position: absolute; right: calc(3px + var(--lane) * 1.25rem); width: 1.1rem; z-index: 2; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .25rem 0 0; border: none; border-radius: 999px;
  background: var(--here); color: #fff; font: inherit; font-size: .55rem; font-weight: 700; letter-spacing: -.02em;
  cursor: pointer; box-shadow: 0 2px 6px -3px rgb(40 80 40 / .5);
}
.here.mine { outline: 2px solid var(--surface); outline-offset: -2px; }
.sw.coming { background: var(--here); border-radius: 999px; width: .55rem; height: 1rem; }
.mode.open .blob { background: var(--here); }
.chip.open { background: var(--here); color: #fff; }
.pip.open { background: color-mix(in srgb, var(--here) 30%, var(--surface)); }
.mdot.open { background: var(--here); }
.details .warn, .overlap-box .warn { margin: 0 0 .5rem; font-weight: 500; }

/* A small white dot on the check-in capsule for each guest */
.here .g { display: block; width: .4rem; height: .4rem; border-radius: 50%; background: #fff; opacity: .9; }
.here small { font-size: .5rem; }

/* Guest counter in the booking form (only for check-ins) */
.guests-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  margin: -.3rem 0 1rem; padding: .6rem .8rem; border-radius: 18px; background: color-mix(in srgb, var(--here) 15%, var(--surface)); }
.guests-row small { display: block; }
.stepper { display: inline-flex; align-items: center; gap: .4rem; }
.stepper input { width: 3.2rem; margin: 0; text-align: center; padding: .35rem; }

/* Who's away: grey chips at the top of each day, and a timeline in the Away pop-up */
.away-chip { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 8px; font-size: .72rem; font-weight: 500;
  background: #ece6de; color: var(--muted); white-space: nowrap; }
.sw.away { background: #d8cfc4; border-radius: 4px; }
.mdot.away { background: #b9ada1; border-radius: 2px; }
.pip.away { background: #ece6de; color: var(--muted); }
.away-dialog h3 { margin-top: 1.4rem; }
.timeline-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .6rem; align-items: center; margin-bottom: .4rem; }
.tl-weeks { display: grid; grid-template-columns: repeat(8, 1fr); font-size: .7rem; color: var(--muted); }
.tl-name { font-size: .85rem; font-weight: 500; }
.tl-row { position: relative; height: 1.1rem; border-radius: 999px; background: var(--bg);
  background-image: repeating-linear-gradient(90deg, transparent 0 calc(100% / 8 - 1px), var(--line) calc(100% / 8 - 1px) calc(100% / 8)); }
.tl-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 999px; background: #b9ada1;
  left: calc(var(--from) / var(--days) * 100%); width: calc(var(--len) / var(--days) * 100%); min-width: 6px; }
.away-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.away-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: var(--bg); border-radius: 14px; padding: .4rem .7rem; }
