/* Booking block (bk-). Tokens only; controls are the base k- classes. One authored moment: the confirmation
   (mark springs, heading sharpens, receipt prints; confetti only for a paid booking, from slots.js). */
.bk { --bk-gap: clamp(24px, 4vw, 56px); --bk-date: 56px; }
.bk-wrap { display: grid; gap: 32px; }
.bk-head { display: flex; flex-direction: column; gap: 12px; max-width: var(--w-prose); }
.bk-tz { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); }
.bk-empty { margin: 0; padding: 20px; border: 1px dashed var(--field); border-radius: var(--radius); color: var(--muted); }

/* ---- sessions: an agenda grouped by month, the whole row is the link ---------------------------------------- */
.bk[data-flow="sessions"] .bk-wrap { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--bk-gap); align-items: start; }
.bk[data-flow="sessions"] .bk-head { position: sticky; top: calc(var(--header-h) + 24px); }
.bk-agenda { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.bk-month-h { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bk-list { list-style: none; margin: 0; padding: 0; }
.bk-sess + .bk-sess { border-top: 1px solid var(--line); }
.bk-row { display: grid; grid-template-columns: var(--bk-date) minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 76px;
  padding: 14px 10px; margin: 0 -10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none;
  transition: background-color var(--d) var(--ease); }
.bk-date { width: var(--bk-date); height: 60px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.bk-dow { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.bk-dnum { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.bk-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-title { font-size: 17px; font-weight: 600; line-height: 1.3; }
.bk-meta { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bk-note { font-size: 14px; color: var(--muted); }
.bk-state { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.bk-cta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--brand); }
.bk-cta svg { transition: transform var(--d) var(--ease); }
.bk-left { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bk-sess[data-full] .bk-row { cursor: default; }
.bk-sess[data-full] .bk-date { background: var(--ground); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.bk-sess[data-full] .bk-title { color: var(--muted); }
.bk-sess[data-full] .bk-cta { display: none; }
.bk-sess[data-full] .bk-left { background: var(--ground); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.bk-sess { position: relative; }
.bk-wait { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 8px calc(var(--bk-date) + 16px); font-size: 15px; font-weight: 600; }
.bk-all { margin: 0; }
.bk-all .k-btn { align-self: flex-start; }

/* ---- slots: the questions on the left, the ticket on the right ------------------------------------------- */
.bk-flow { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 4fr); gap: var(--bk-gap); align-items: start; }
.bk-form { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
.bk-step { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; transition: opacity var(--d) ease; }
.bk-step[disabled] { opacity: .55; }
.bk-legend { padding: 0; margin-bottom: 14px; font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.bk-step-err:not([hidden]) { margin-top: -2px; }
.bk-hint { margin: 0; font-size: 15px; color: var(--muted); }

.bk-svcs { display: flex; flex-direction: column; gap: 8px; }
.bk-svc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 64px; padding: 14px 16px;
  border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  transition: border-color var(--d) var(--ease), background-color var(--d) var(--ease), box-shadow var(--d) var(--ease); }
.bk-svc input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
.bk-svc:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
.bk-svc:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
.bk-svc input:focus-visible { outline: none; }
.bk-svc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-svc-name { font-weight: 600; }
.bk-svc-text { font-size: 14px; color: var(--muted); }
.bk-svc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 14px; color: var(--muted); }
.bk-svc-meta span:last-child { font-size: 16px; font-weight: 600; color: var(--ink); }

.bk-days { display: flex; flex-direction: column; gap: 8px; }
.bk-days-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bk-range { margin: 0; font-weight: 600; }
.bk-pager { display: flex; gap: 6px; }
.bk-pg { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--field); background: var(--surface); color: var(--ink); display: grid; place-items: center;
  transition: background-color var(--d-fast) ease, transform .12s var(--ease); }
.bk-pg:active:not(:disabled) { transform: scale(.94); }
.bk-pg:disabled { opacity: .35; cursor: not-allowed; }
.bk-week, .bk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.bk-week span { text-align: center; font-size: 13px; font-weight: 500; color: var(--muted); }
.bk-day { position: relative; height: 48px; min-width: 0; padding: 0; border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font-size: 16px; font-weight: 600;
  transition: background-color var(--d) var(--ease), border-color var(--d) var(--ease), color var(--d) var(--ease); }
.bk-day:disabled { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; cursor: default; }
.bk-day[data-past] { opacity: .45; }
.bk-day[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.bk-day[data-today]::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.bk-day[data-ph] { display: block; border-color: transparent; background: var(--placeholder); animation: bk-wait 1s ease-in-out infinite alternate; }
.bk-chips { gap: 8px; }
.bk-time { min-width: 80px; justify-content: center; }

.bk-step textarea { min-height: 96px; }
.bk-popia { margin: 0; font-size: 14px; color: var(--muted); }

.bk-ticket { position: sticky; top: calc(var(--header-h) + 24px); display: flex; flex-direction: column; gap: 16px; padding: 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.bk-ticket-h { font-size: 17px; font-weight: 600; letter-spacing: 0; }
.bk-tl { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.bk-tl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.bk-tl dt { font-size: 14px; color: var(--muted); }
.bk-tl dd { margin: 0; text-align: right; font-weight: 600; }
.bk-tl dd[data-empty] { font-weight: 500; color: var(--muted); }
.bk-tl-total { padding-top: 12px; border-top: 1px dashed var(--field); }
.bk-tl-total dd:not([data-empty]) { font-size: 20px; font-weight: 700; }
.bk-clock { margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.bk-clock[data-low] { background: var(--danger-soft); color: var(--danger); }
.bk-bar { display: flex; flex-direction: column; gap: 10px; }
.bk-sum { display: none; margin: 0; }
.bk-go { width: 100%; }
.bk-change { min-height: 44px; margin: -10px -6px -10px auto; padding: 0 6px; border: 0; background: none; color: var(--brand); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---- the confirmation ---------------------------------------------------------------------------------------- */
.bk-done { grid-column: 1 / -1; width: 100%; max-width: var(--w-narrow); margin: 0 auto; display: flex; flex-direction: column; gap: 24px; outline: none; }
.bk-done-head { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.bk-done-h { font-size: var(--t-h1); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; animation: k-focus .7s .4s var(--ease) backwards; }
.bk-done-lead { max-width: 46ch; color: var(--muted); }
.bk-done-card { padding: 20px 24px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); animation: k-print .9s .7s var(--ease) backwards; }
.bk-done[data-kind="free"] .k-mark::before, .bk-done[data-kind="free"] .k-mark::after { display: none; } /* free: the spring, no ripples, no confetti */
.bk-done:not([data-kind="paid"]):not([data-kind="free"]) .bk-done-h { animation: none; }
.bk-receipt { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.bk-r-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.bk-r-row dt { padding-top: 2px; font-size: 14px; color: var(--muted); }
.bk-r-row dd { margin: 0; font-weight: 600; }
.bk-r-total { padding-top: 12px; border-top: 1px dashed var(--field); }
.bk-r-total dd { font-size: 20px; font-weight: 700; }
.bk-r-ref dd code { overflow-wrap: anywhere; }
.bk-cal { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bk-cal-h { margin: 0; font-weight: 600; }
.bk-cal .k-chips { justify-content: center; }
.bk-cal .k-chip { text-decoration: none; }
.bk-done-note { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.bk-confetti { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; }
.bk-confetti i { position: absolute; width: 8px; height: 12px; margin: -6px 0 0 -4px; border-radius: 2px; }

/* the server's small page (no-JS result, the cancel link) */
.bk-page { display: flex; flex-direction: column; gap: 20px; padding-top: 48px; padding-bottom: 64px; }
.bk-page > h1 { text-align: center; }
.bk-page > .k-mark { align-self: center; }
.bk-page > .bk-receipt { padding: 20px 24px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.bk-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bk-rs { display: flex; flex-direction: column; gap: 20px; }
.bk-rs-day { margin: 0; padding: 0; border: 0; min-width: 0; }
.bk-rs-day legend { padding: 0; margin-bottom: 10px; font-weight: 600; }

@keyframes bk-wait { to { opacity: .55; } }

@media (hover: hover) and (pointer: fine) {
  .bk-row[href]:hover { background: var(--surface); }
  .bk-row[href]:hover .bk-cta svg { transform: translateX(3px); }
  .bk-svc:hover { border-color: var(--brand); }
  .bk-day:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--brand); }
  .bk-pg:hover:not(:disabled) { background: var(--line); }
}

@media (max-width: 720px) {
  .bk { --bk-date: 48px; }
  .bk[data-flow="sessions"] .bk-wrap, .bk-flow { grid-template-columns: minmax(0, 1fr); }
  .bk[data-flow="sessions"] .bk-head { position: static; }
  .bk-row { grid-template-columns: var(--bk-date) minmax(0, 1fr); row-gap: 8px; }
  .bk-state { grid-column: 2; justify-content: space-between; }
  .bk-date { height: 56px; }
  .bk-dnum { font-size: 21px; }
  .bk-form { gap: 32px; }
  .bk-svc { grid-template-columns: auto minmax(0, 1fr); }
  .bk-svc-meta { grid-column: 2; flex-direction: row; align-items: baseline; gap: 10px; }
  .bk-day { height: 44px; }
  .bk-week, .bk-grid { gap: 4px; }
  /* the ticket becomes the sticky action bar */
  .bk-ticket { position: sticky; top: auto; bottom: 0; z-index: 2; gap: 10px; margin: 0 calc(-1 * var(--pad)); padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; }
  .bk-ticket-h, .bk-tl { display: none; }
  .bk-bar { flex-direction: row; align-items: center; gap: 12px; }
  .bk-sum { display: block; flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
  .bk-go { width: auto; flex: 0 0 auto; padding: 0 20px; }
  .bk-done-card { padding: 18px 20px; }
  .bk-r-row { grid-template-columns: 80px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .bk-done-h, .bk-done-card { animation: k-fade .3s ease both; }
  .bk-day[data-ph] { animation: none; }
  .bk-row, .bk-svc, .bk-day, .bk-step { transition-property: background-color, border-color, color, opacity; }
  .bk-cta svg { transition: none; }
  .bk-pg:active:not(:disabled) { transform: none; }
}

/* admin: the meeting link field in the Bookings tab */
.bk-link input { min-width: min(100%, 16em); flex: 1 1 14em; }
