/* Boardroom Booking — phone web app. Values come from tokens.css (artboards 9–15 ÷ 3). */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--c-bg); }
body {
  font-family: var(--font);
  color: var(--c-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

.app {
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
/* Leave room for the action sheet so the last slot can be reached */
body.has-sheet .app { padding-bottom: calc(var(--h-sheet) + 24px + env(safe-area-inset-bottom)); }

/* ---------- Icons (inline SVG, coloured with CSS `color`) ---------- */
.i { display: inline-flex; flex: none; width: 17px; height: 17px; }
.i svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* ---------- Header ---------- */
.header {
  position: relative;
  height: 80px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  display: flex; justify-content: center; align-items: flex-start;
}
.header__logo { margin-top: 20px; border: 0; background: none; padding: 0; }
.header__logo img { width: var(--logo-w); height: auto; }
.header__action {
  position: absolute; right: calc(var(--gutter) - 12px); top: calc(env(safe-area-inset-top) + 21px);
  width: 51px; height: 40px; border: 0; background: none; padding: 0;
  display: grid; place-items: center; color: #333;
}
.header__back {
  position: absolute; left: calc(var(--gutter) - 12px); top: calc(env(safe-area-inset-top) + 21px);
  width: 51px; height: 40px; border: 0; background: none; padding: 0;
  display: grid; place-items: center; color: #333;
}
.hicon { display: block; overflow: visible; }
.hicon--menu  { width: 27px; height: 18px; }
.hicon--close { width: 22px; height: 22px; }
.hicon--back  { width: 26px; height: 18px; }

/* ---------- Shared pieces ---------- */
.photo {
  width: calc(100% - 2 * var(--gutter));
  margin: 0 var(--gutter);
  aspect-ratio: 1000 / 250;
  border-radius: var(--r-card);
  object-fit: cover;
  object-position: center 55%;
  background: #eee;
}
.title-row {
  display: flex; align-items: center; gap: 10px;
  margin: 20px var(--gutter) 0;
  min-height: 40px;
}
.title-row .i--calendar { width: 25px; height: 26px; }
.title {
  margin: 0; flex: 1; min-width: 0;
  font-size: var(--fs-title); font-weight: var(--fw-bold); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.title-row .i--user { width: 21px; height: 25px; }
.title-row .i--user-edit { width: 29px; height: 27px; }
.amenities { display: flex; gap: 13px; color: var(--c-icon); }
.amenities .i { width: 17px; height: 17px; }

.rule       { border: 0; border-top: 1px solid var(--c-divider); margin: 0 8px; }
.rule-strip { border: 0; border-top: .5px solid var(--c-rule); margin: 0; }
.rule-dashed{ border: 0; border-top: 1px dashed var(--c-rule); margin: 0; opacity: .8; }

.muted {
  margin: 0 var(--gutter);
  font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--c-text-muted);
}

/* ---------- Buttons & fields ---------- */
.btn {
  height: var(--h-btn);
  border-radius: var(--r-btn);
  font-size: var(--fs-body); font-weight: var(--fw-bold);
  border: var(--stroke) solid var(--c-primary);
  display: grid; place-items: center; padding: 0 8px;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn--dark    { background: var(--c-primary); color: var(--c-primary-ink); }
.btn--outline { background: #fff; color: var(--c-ink); }
.btn--sheet   { height: var(--h-btn-sheet); border-radius: var(--r-btn-lg); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { display: block; margin: 0 var(--gutter); }
.field + .field { margin-top: 26px; }
.field__label {
  display: block; margin-bottom: 10px;
  font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--c-text-muted);
}
.field__input {
  width: 100%; height: var(--h-field);
  border: var(--stroke) solid var(--c-primary); border-radius: var(--r-field);
  background: #fff; text-align: center;
  font-size: var(--fs-body); font-weight: var(--fw-bold);
  padding: 0 16px; outline: none;
}
.field__input:focus { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--c-primary); }
.field__input[readonly] { background: #fff; }
.form-actions { margin: 26px var(--gutter) 0; }
.link-btn {
  display: block; margin: 22px auto 0; border: 0; background: none;
  font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--c-text-muted);
  text-decoration: underline; text-underline-offset: 3px;
}
.error { margin: 14px var(--gutter) 0; font-size: var(--fs-label); font-weight: var(--fw-medium); color: #b00020; text-align: center; }

/* ---------- Login (12) ---------- */
.login-box {
  margin: 18px var(--gutter) 0;
  aspect-ratio: 1015 / 492;
  border: var(--stroke) solid var(--c-primary);
  border-radius: var(--r-box);
  overflow: hidden;
}
.login-box img { width: 100%; height: 100%; object-fit: cover; }
.login-box--image { border: 0; border-radius: 0; }
.login .title-row { margin-top: 30px; margin-bottom: 14px; }
.login .rule { margin-bottom: 24px; }

/* ---------- Rooms list (9) ---------- */
.rooms { display: grid; gap: 24px; margin: 9px 13px 0; }
/* Boardroom card (Artboard 9 "Update"): 1100×… @3x, r50, 10px blur shadow.
   Card margin 13 + padding 17 = the usual 30px gutter, so inner content keeps its sizes. */
.room {
  --gutter: 0px;
  background: #fff;
  border-radius: 17px;
  box-shadow: 0 0 7px rgba(0, 0, 0, .6);
  padding: 15px 17px 17px;
}
.photo--card { aspect-ratio: 1000 / 400; border-radius: var(--r-btn-lg); object-position: center 45%; }
.room-meta { margin: 14px var(--gutter) 0; display: grid; gap: 8px; font-size: var(--fs-label); }
.room-meta > div { display: flex; align-items: center; gap: 4px; min-height: 17px; }
.room-meta dt { font-weight: var(--fw-bold); color: var(--c-ink); white-space: nowrap; }
.room-meta dd { margin: 0; font-weight: var(--fw-medium); color: var(--c-text-muted); }
.room-meta .amenities { margin-left: 4px; }
.muted b { color: var(--c-ink); font-weight: var(--fw-bold); }
.room__link { display: block; color: inherit; text-decoration: none; }
.room__bookings { margin-top: 27px; }
.room__bookings .rule { margin: 0 0 26px; }
.room .pills { margin-top: 14px; }
.pills { display: grid; gap: 12px; margin: 14px var(--gutter) 0; }

/* ---------- Booking pill + time slot ---------- */
.slot {
  width: 100%; min-height: var(--h-field);
  border: var(--stroke) solid var(--c-primary);
  border-radius: var(--r-field);
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: var(--fs-body); font-weight: var(--fw-bold);
  padding: 6px 12px;
  transition: background .15s, color .15s, transform .08s;
}
.slot:active { transform: scale(.99); }
.slot__sub { font-size: var(--fs-small); font-weight: var(--fw-light); letter-spacing: .01em; }
.slot--mine, .slot--selected, .pill { background: var(--c-primary); color: var(--c-primary-ink); }
.slot--mine { background: #000; border-color: #000; }
.slot--marked { background: #fff; color: var(--c-ink); border: 1.5px dashed var(--c-primary); }
.slot--marked .slot__time { text-decoration: line-through; }
.slot--taken {
  border-color: transparent; background: none; color: var(--c-disabled);
  text-decoration: line-through; cursor: default;
}
.slot--taken:active { transform: none; }
.pill { border-radius: var(--r-btn-lg); }
.pill .slot__time { white-space: pre; }

/* ---------- Room detail (10) ---------- */
.dates {
  /* Free-scrolling strip: --visible days fit across, the rest glide in */
  --visible: 7;
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc(100% / var(--visible));
  margin: 26px 8px 0; padding-bottom: 6px;
  overflow-x: auto; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dates::-webkit-scrollbar { display: none; }
.date {
  justify-self: center;
  width: 42px; height: 60px; border: 0; border-radius: var(--r-btn-lg);
  background: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.date__dow   { font-size: var(--fs-micro); }
.date__day   { font-size: var(--fs-body); font-weight: var(--fw-bold); line-height: 1; }
.date__month { font-size: var(--fs-micro); color: var(--c-text-faint); }
.date[aria-pressed="true"] { background: var(--c-primary); color: #fff; }
.date[aria-pressed="true"] .date__month { color: #fff; }
.slots-head { margin-top: 18px; }
.slots { display: grid; gap: 12px; margin: 14px var(--gutter) 0; }
.empty { margin: 30px var(--gutter); text-align: center; color: var(--c-text-muted); font-size: var(--fs-label); }

/* ---------- Bottom sheet (14, 15) ---------- */
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 20;
  width: 100%; max-width: 430px;
  transform: translate(-50%, 0);
  background: #fff;
  box-shadow: var(--shadow-sheet);
  padding: 30px 38px calc(30px + env(safe-area-inset-bottom));
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } }
.sheet.is-leaving { animation: sheet-down .2s ease-in forwards; pointer-events: none; }
@keyframes sheet-down { to { transform: translate(-50%, 100%); } }
.sheet__title { margin: 0 0 14px; font-size: var(--fs-title); font-weight: var(--fw-bold); }
.sheet__hint { margin: 14px 0 16px; font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--c-text-muted); }

/* Color-inverted sheet (Artboard 14 "popup"): black panel, white type, buttons flipped */
.sheet {
  background: #000;
  color: #fff;
}
.sheet .rule-dashed { border-top-color: #808080; opacity: 1; }
.sheet__hint { color: #9a9a9a; }
.sheet .btn--dark { background: #fff; color: #000; }
.sheet .btn--outline { background: none; color: #fff; border-color: #fff; }

/* ---------- Personal details panel (11) ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.25); animation: fade .2s; }
.profile {
  position: fixed; top: 0; left: 50%; z-index: 31;
  width: 100%; max-width: 430px; transform: translateX(-50%);
  background: #fff; padding-bottom: 32px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
  animation: panel-down .24s ease-out;
}
@keyframes panel-down { from { transform: translate(-50%, -100%); } }
.profile.is-leaving { animation: panel-up .22s ease-in forwards; pointer-events: none; }
@keyframes panel-up { to { transform: translate(-50%, -100%); } }
.scrim.is-leaving { animation: fade-out .22s ease-in forwards; pointer-events: none; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.profile .title-row { margin-top: 10px; margin-bottom: 14px; }
.profile .rule { margin-bottom: 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); z-index: 40;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  background: var(--c-primary); color: #fff;
  padding: 12px 18px; border-radius: var(--r-btn-lg);
  font-size: var(--fs-label); font-weight: var(--fw-medium);
  animation: fade .2s;
}

/* ---------- Booking confirmed tick (Artboard 9Tick: 250px disc @3x, 4px stroke, 40px blur shadow) ---------- */
.tick {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  pointer-events: none;
  animation: tick-life 1.6s ease forwards;
}
.tick__disc {
  width: 83px; height: 83px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 27px rgba(0, 0, 0, .75);
  display: grid; place-items: center;
  animation: tick-pop .35s cubic-bezier(.2, .9, .3, 1.25) both;
}
.tick__mark { width: 83px; height: 83px; overflow: visible; }
.tick__mark polyline {
  stroke-dasharray: 160; stroke-dashoffset: 160;
  animation: tick-draw .35s ease-out .18s forwards;
}
@keyframes tick-life { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tick-pop  { from { transform: scale(.6); } to { transform: scale(1); } }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Time slots entrance: slide up with a little bounce, staggered ---------- */
.slots--enter > * {
  animation: slot-in .55s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
/* Boardroom list entrance (same bounce, slightly slower stagger) */
.anim-in {
  animation: slot-in .6s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes slot-in {
  from { opacity: 0; transform: translateY(48px); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .tick__mark polyline { stroke-dashoffset: 0; } }
