/* Booking page: toolbar, floor plan, week of slots and the booking form. */

.book .page-head { align-items: baseline; justify-content: flex-start; gap: 6px 20px; margin-bottom: 16px; }
.book .page-head p { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 22px; padding: 16px 20px; }
.f-day { flex: 2 1 300px; }
.f-start { flex: 0 1 110px; }
.f-length { flex: 0 1 150px; }
.f-people { flex: 0 0 140px; }
.f-type { flex: 1 1 auto; }
.day-row { display: flex; align-items: center; gap: 18px; }
.day-row .input { flex: 1; min-width: 140px; }
.toolbar .tabs { height: 40px; align-items: center; }

/* ---------- Layout ----------
   Row 1: the plan and the side panel share a height; the side panel never sets it.
   Row 2: the booking form spans both, with its columns lined up under them. */
.book-grid {
  --plan-col: minmax(0, 1.45fr);
  --side-col: minmax(360px, 1fr);
  display: grid;
  grid-template-columns: var(--plan-col) var(--side-col);
  grid-template-areas: "plan side" "confirm confirm";
  gap: 20px;
  margin-top: 20px;
}
.plan-panel { grid-area: plan; }
.side { grid-area: side; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.side-fill { flex: 1 1 auto; height: 0; min-height: 0; }
.space-select { display: none; }

/* ---------- Floor plan ---------- */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--hair); }
.plan-head .tab { font-family: var(--display); font-size: 16px; }
.plan-hint { font-size: 13px; color: var(--subtle); }
.plan-wrap { padding: 12px 16px 6px; }
.plan { display: block; width: 100%; height: auto; aspect-ratio: 830 / 544; max-height: max(340px, calc(100vh - 430px)); }

.plan text { text-anchor: middle; dominant-baseline: central; }
.plan .interior { fill: var(--surface); }
.plan .wall { fill: none; stroke: var(--rule); stroke-width: 3px; stroke-linejoin: miter; stroke-linecap: square; vector-effect: non-scaling-stroke; }
.plan .part { fill: none; stroke: var(--rule); stroke-width: 1.25px; stroke-linecap: square; vector-effect: non-scaling-stroke; }
.plan .edge { fill: none; stroke: var(--subtle); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .fold { fill: none; stroke: var(--rule); stroke-width: 1px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.plan .door-leaf { fill: none; stroke: var(--rule); stroke-width: 1.25px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.plan .door-swing { fill: none; stroke: var(--subtle); stroke-width: .75px; vector-effect: non-scaling-stroke; }
.plan .doors { pointer-events: none; }
.plan .ctx { fill: var(--faint); }
.plan .ctx.outside { stroke: var(--hair); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .ctx-line { fill: none; stroke: var(--hair); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .ctx-label { font: 700 8px var(--body); letter-spacing: .1em; fill: var(--subtle); }
.plan .zone { font: 700 8.5px var(--body); letter-spacing: .12em; fill: var(--muted); }
.plan .halo { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.plan .ctx-label.halo { stroke: var(--faint); }
.plan .hatch-line { stroke: var(--busy); stroke-width: 1.2px; }

/* Floors cross-fade in place: the same frame, the same scale. */
.plan .floor { opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility 0s linear .28s; }
.plan[data-floor="second"] .floor[data-floor="second"],
.plan[data-floor="mezzanine"] .floor[data-floor="mezzanine"] { opacity: 1; visibility: visible; transition: opacity .28s ease, visibility 0s; }
.plan .ghost { opacity: 0; transition: opacity .28s ease; pointer-events: none; }
.plan[data-floor="mezzanine"] .ghost { opacity: 1; }
.plan .ghost-floor { fill: color-mix(in srgb, var(--faint) 60%, transparent); stroke: var(--hair); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .ghost-label { font: 700 8.5px var(--body); letter-spacing: .12em; fill: var(--subtle); }

/* Stairs connect the floors: select them to go up or down. */
.plan .stairs { cursor: pointer; outline: none; }
.plan .stairs-bg { fill: var(--faint); stroke: var(--rule); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .treads { fill: none; stroke: var(--busy); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .stairs-label { font: 700 8.5px var(--body); letter-spacing: .08em; fill: var(--ink); stroke: var(--faint); }
.plan .stairs:hover .stairs-bg, .plan .stairs:focus-visible .stairs-bg { fill: var(--mist); stroke: var(--blue-ink); stroke-width: 2px; }
.plan .stairs:hover .stairs-label, .plan .stairs:focus-visible .stairs-label { fill: var(--blue-ink); stroke: var(--mist); }

.plan .scale-line { fill: none; stroke: var(--muted); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan .scale-label { font: 400 9px var(--body); fill: var(--muted); }

.space { cursor: pointer; outline: none; }
.space text { pointer-events: none; }
.space .shape { fill: var(--mist); stroke: var(--blue-ink); stroke-width: 1.25px; vector-effect: non-scaling-stroke; transition: fill .15s ease; }
.space .hatch { display: none; pointer-events: none; }
.space .chair { fill: var(--surface); stroke: var(--subtle); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.space .lbl { font-family: var(--display); font-size: 11px; fill: var(--ink); }
.space .sub { font: 400 9px var(--body); fill: var(--muted); }
.space.desk .lbl, .space.pod .lbl { font: 700 9.5px var(--body); }

.space:hover .shape { fill: color-mix(in srgb, var(--blue) 24%, var(--surface)); }
.space:focus-visible .shape { stroke: var(--blue-ink); stroke-width: 3px; }
.space[data-state="busy"] .shape { fill: var(--faint); stroke: var(--busy); }
.space[data-state="busy"] .hatch { display: inline; }
.space[data-state="busy"] .lbl, .space[data-state="busy"] .sub { fill: var(--muted); }
.space[data-state="unfit"] .shape, .space[data-state="closed"] .shape { fill: var(--surface); stroke: var(--hair); }
.space[data-state="unfit"] .lbl, .space[data-state="closed"] .lbl, .space[data-state="unfit"] .sub { fill: var(--subtle); }
.space[data-state="off"] { opacity: .25; pointer-events: none; }
.space[data-selected] .shape { fill: var(--blue); stroke: var(--blue); }
.space[data-selected] .hatch { display: none; }
.space[data-selected] .lbl, .space[data-selected] .sub { fill: #FFFFFF; }
.space[data-selected][data-state="busy"] .shape { stroke: var(--red); stroke-width: 2.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--hair); font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { width: 18px; height: 12px; border: 1px solid; }
.swatch.free { background: var(--mist); border-color: var(--blue-ink); }
.swatch.busy { background: repeating-linear-gradient(135deg, var(--busy) 0 1px, var(--faint) 1px 4px); border-color: var(--busy); }
.swatch.sel { background: var(--blue); border-color: var(--blue); }
.swatch.unfit { background: var(--surface); border-color: var(--hair); }

/* ---------- Quick picks ---------- */
.quick-head { display: grid; gap: 6px; padding: 20px 20px 8px; }
.quick-body { overflow-y: auto; padding: 4px 20px 20px; display: grid; gap: 14px; align-content: start; }
.quick-group h3 { font-size: 14px; margin-bottom: 8px; color: var(--muted); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { padding: 5px 10px; border: 1px solid var(--blue-ink); color: var(--blue-ink); font-size: 14px; }
.pick:hover, .pick:focus-visible { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }

/* ---------- Space header ---------- */
.space-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 16px 20px 12px; border-bottom: 1px solid var(--hair); }
.space-head h2 { font-size: 22px; }
.space-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.eyebrow { font: 700 12px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.facts { margin-top: 4px; font-size: 14px; color: var(--muted); }
.live { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid var(--hair); font-size: 14px; }
.live.free .dot { color: var(--blue-ink); }
.live.busy .dot { color: var(--red); }
.live.closed .dot { color: var(--subtle); }

.week-nav { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-bottom: 1px solid var(--hair); }
.week-nav .btn { min-width: 34px; padding: 0; font-size: 16px; }
.week-nav > span { font-family: var(--display); font-size: 15px; margin-left: 4px; white-space: nowrap; }
.week-nav .week-hint { flex: 1; min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; font-family: var(--body); font-size: 13px; color: var(--subtle); text-align: right; }
@media (max-width: 1359px) { .week-nav .week-hint { display: none; } }

/* ---------- Week of 15-minute slots ---------- */
.slots { display: flex; flex-direction: column; }
.wk-head { display: grid; grid-template-columns: 46px repeat(7, 1fr); border-bottom: 1px solid var(--hair); }
.wk-head.compact { grid-template-columns: repeat(7, 1fr); }
.wk-day { padding: 7px 0 5px; text-align: center; font-size: 12px; line-height: 1.2; color: var(--muted); border-bottom: 2px solid transparent; }
.wk-day b { display: block; font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--ink); }
.wk-day.today, .wk-day.today b { color: var(--blue-ink); }
.wk-day[aria-pressed="true"] { border-bottom-color: var(--red); }
.wk-day:hover:not(:disabled) { background: var(--mist); }
.wk-day:disabled { opacity: .4; cursor: default; }

.week-scroll { flex: 1 1 auto; height: 0; min-height: 200px; overflow-y: auto; overscroll-behavior: contain; }
.week-grid { --row: 11px; display: grid; grid-template-columns: 46px repeat(var(--cols), 1fr); padding: 8px 0 10px; }
.wk-gutter { position: relative; height: calc(var(--rows) * var(--row)); }
.wk-gutter span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.wk-col {
  position: relative;
  height: calc(var(--rows) * var(--row));
  border-left: 1px solid var(--hair);
  background-image:
    linear-gradient(to bottom, var(--hair) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--hair) 40%, transparent) 1px, transparent 1px);
  background-size: 100% calc(var(--row) * 4), 100% var(--row);
  cursor: crosshair;
  touch-action: pan-y;
  user-select: none;
}
.wk-col:last-child { border-right: 1px solid var(--hair); }
.wk-past { position: absolute; inset: 0 0 auto 0; z-index: 1; pointer-events: none; background: color-mix(in srgb, var(--surface) 60%, transparent) repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--hair) 55%, transparent) 6px 7px); }
.blk {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 1px 4px 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 10.5px;
  line-height: 11px;
  color: var(--muted);
  background: var(--faint);
  border-left: 3px solid var(--busy);
  cursor: default;
}
.blk.mine { background: var(--mist); border-left-color: var(--blue-ink); color: var(--ink); }
.blk.draft { z-index: 2; pointer-events: none; color: #FFFFFF; background: var(--blue); border-left-color: var(--blue); font-weight: 700; }
.blk.draft.bad { background: var(--alert-fill); border-left-color: var(--alert-fill); }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: var(--red); z-index: 3; pointer-events: none; }
.wk-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- Desks: half days ---------- */
.desk-weeks { overflow-y: auto; padding-bottom: 14px; }
.desk-grid { display: grid; grid-template-columns: 96px repeat(7, 1fr); grid-auto-rows: auto; padding: 0 0 6px; }
.desk-grid + .desk-grid { border-top: 1px solid var(--hair); margin-top: 8px; }
.desk-grid .wk-day { border-bottom: 1px solid var(--hair); }
.desk-grid .wk-day[aria-pressed="true"] { border-bottom: 2px solid var(--red); }
.desk-week-label { display: flex; align-items: flex-end; padding: 0 10px 7px 20px; font-size: 12px; color: var(--subtle); border-bottom: 1px solid var(--hair); }
.desk-row { display: contents; }
.desk-row-label { display: flex; flex-direction: column; justify-content: center; padding: 0 10px 0 20px; font-size: 13px; }
.desk-row-label small { color: var(--subtle); font-size: 11px; }
.desk-cell { height: 58px; margin: 8px 3px 0; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--blue-ink); background: var(--mist); color: var(--blue-ink); overflow: hidden; }
.desk-cell span { padding: 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.desk-cell:hover:not(:disabled) { background: color-mix(in srgb, var(--blue) 24%, var(--surface)); }
.desk-cell[data-state="selected"] { background: var(--blue); border-color: var(--blue); color: #FFFFFF; font-weight: 700; }
.desk-cell[data-state="busy"] { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--busy) 50%, transparent) 0 1px, var(--faint) 1px 5px); border-color: var(--busy); color: var(--muted); cursor: default; }
.desk-cell[data-state="conflict"] { background: var(--alert-fill); border-color: var(--alert-fill); color: #FFFFFF; font-weight: 700; }
.desk-cell[data-state="mine"] { background: var(--mist); border: 2px solid var(--blue-ink); color: var(--ink); cursor: default; }
.desk-cell[data-state="past"] { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--hair) 70%, transparent) 6px 7px); border-color: transparent; cursor: default; }

/* ---------- Booking form ----------
   A subgrid on the page's columns: what you're booking sits under the plan,
   the button sits under the week. */
.confirm {
  grid-area: confirm;
  display: grid;
  grid-template-columns: subgrid;
  column-gap: 20px;
  align-items: start;
}
.confirm-edit { grid-column: 1 / -1; margin: 16px 20px 0; }
.confirm-main { display: grid; grid-template-columns: minmax(210px, 0.8fr) minmax(0, 1.6fr); gap: 24px; padding: 20px; align-items: start; }
.c-summary { display: grid; gap: 2px; }
.c-space { font-family: var(--display); font-size: 20px; line-height: 1.2; }
.when-big { margin-top: 6px; font-family: var(--display); font-size: 15px; color: var(--muted); }
.when-big strong { display: block; margin-top: 2px; font-weight: 400; font-size: 26px; line-height: 1.15; color: var(--ink); white-space: nowrap; }
.when-big small { display: block; margin-top: 2px; font-family: var(--body); font-size: 14px; color: var(--muted); }
.c-details { padding-left: 24px; border-left: 1px solid var(--hair); min-height: 100%; }
.c-note { max-width: 46ch; }
.c-action { display: grid; gap: 12px; padding: 20px 20px 20px 24px; border-left: 1px solid var(--hair); align-self: stretch; align-content: end; }
.done .c-details { align-self: center; }
.sessions .tab { font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 110px; gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.chips-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 4px 6px; border: 1px solid var(--rule); background: var(--surface); cursor: text; }
.chips-input:focus-within { outline: 2px solid var(--blue-ink); }
.chips-input input { flex: 1; min-width: 150px; height: 30px; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 2px 2px 8px; border: 1px solid var(--blue-ink); color: var(--blue-ink); font-size: 13px; max-width: 100%; }
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip button { width: 22px; height: 22px; display: grid; place-items: center; font-size: 15px; }
.chip button:hover { background: var(--blue); color: var(--on-blue); }
.field-error { margin-top: 6px; font-size: 13px; color: var(--red); }
.confirm-note { font-size: 13px; color: var(--subtle); }

/* ---------- My bookings ---------- */
.mine-tabs { margin-bottom: 14px; }
.booking-list { display: grid; }
.booking-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--hair); }
.booking-row:last-of-type { border-bottom: 0; }
.date-block { display: grid; justify-items: center; padding: 6px 0; border: 1px solid var(--rule); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); line-height: 1.2; }
.date-block b { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: 0; color: var(--ink); line-height: 1.1; }
.booking-main h2 { font-size: 19px; }
.booking-when { margin-top: 2px; }
.booking-main .muted { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.booking-actions { display: flex; align-items: center; gap: 8px; }
.booking-buttons { display: flex; gap: 8px; }
.booking-row.cancelled .booking-main h2, .booking-row.cancelled .booking-when { color: var(--subtle); text-decoration: line-through; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
  .book-grid { grid-template-columns: 1fr; grid-template-areas: "plan" "side" "confirm"; }
  .plan { max-height: none; }
  .side { overflow: visible; }
  .side-fill { height: auto; }
  .week-scroll { height: 420px; flex: none; }
  .confirm { grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); }
  .confirm-main { grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.5fr); }
}

@media (max-width: 819px) {
  .page { padding-top: 16px; }
  .book .page-head { display: grid; gap: 4px; }
  .toolbar { padding: 14px 16px; gap: 14px; }
  .f-day { flex-basis: 100%; }
  .f-start, .f-length { flex: 1 1 120px; }
  .f-people { flex: 1 1 130px; }
  .f-type { flex: 1 1 100%; }
  .plan-panel { display: none; }
  .space-select { display: flex; }
  .book-grid { gap: 16px; margin-top: 16px; grid-template-areas: "select" "side" "confirm"; }
  .space-select { grid-area: select; }
  .space-head { padding: 16px; }
  .space-head-side { align-items: flex-start; flex-direction: row-reverse; justify-content: space-between; width: 100%; }
  .week-nav { padding: 8px 16px; }
  .week-nav .week-hint { display: none; }
  .week-grid { --row: 15px; grid-template-columns: 52px 1fr; }
  .week-scroll { height: 440px; }
  .blk { font-size: 12px; line-height: 13px; }
  .desk-grid { grid-template-columns: 74px repeat(7, 1fr); }
  .desk-row-label, .desk-week-label { padding-left: 12px; font-size: 12px; }
  .desk-cell { height: 50px; margin: 6px 2px 0; font-size: 11px; }
  .confirm { grid-template-columns: 1fr; }
  .confirm-main { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .c-details { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--hair); }
  .c-action { padding: 0 16px 16px; border-left: 0; }
  .form-grid { grid-template-columns: 1fr 96px; }
  .when-big strong { font-size: 22px; }
  .booking-row { grid-template-columns: 56px minmax(0, 1fr); gap: 12px 14px; padding: 14px 16px; }
  .booking-actions { grid-column: 2; }
}
