/* ==========================================================
   TO Solutions — "Book a free audit" booking modal
   Uses tokens from styles.css (--accent, --highlight, --line…)
   ========================================================== */
.bk {
  width: min(640px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 48px));
  padding: 0; border: 0; border-radius: var(--radius, 22px);
  background: var(--paper, #fff); color: var(--text, #2d2d2d);
  box-shadow: 0 40px 120px rgba(0,0,0,.45);
  font-family: var(--font-body);
  overflow: hidden;
}
.bk[open] { display: flex; flex-direction: column; animation: bkIn .28s cubic-bezier(.2,.8,.2,1);
  position: fixed; inset: 0; margin: auto; height: fit-content; } /* explicit centring, not left to the UA */
/* No backdrop-filter here: on iPad WebKit a blurred ::backdrop can end up painted over the dialog
   itself (page goes blurry, form never appears). A solid scrim is reliable everywhere. */
.bk::backdrop { background: rgba(0,0,0,.72); animation: bkFade .28s ease; }
@keyframes bkIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bkFade { from { opacity: 0; } to { opacity: 1; } }
html.bk-lock { overflow: hidden; }
.bk:not([open]) { display: none; } /* also hides it in browsers without <dialog> support */
/* The booking overlay (used everywhere; see booking.js): fixed above the header (z 60). */
.bk.bk-fallback { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 1001; }
.bk-scrim { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.72); animation: bkFade .28s ease; }

.bk-form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.bk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* spam trap, see index.html */

/* header */
.bk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 26px 28px 0; }
.bk-progress { flex: 1; }
.bk-count { margin: 0 0 10px; font: 600 13px var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2, #595959); }
.bk-bar { height: 4px; border-radius: 99px; background: var(--line, #e0e0e0); overflow: hidden; }
.bk-bar span { display: block; height: 100%; width: 25%; background: var(--accent, #3F00FF); border-radius: inherit; transition: width .35s ease; }
.bk-close {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; margin: -8px -10px 0 0;
  border: 0; border-radius: 12px; background: transparent; color: #000; cursor: pointer;
  transition: background-color .2s;
}
.bk-close:hover { background: var(--tint, #f5f5f5); }
.bk-close svg { width: 22px; height: 22px; }

/* body */
.bk-body { padding: 18px 28px 8px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.bk-step[hidden] { display: none; }
.bk-title { margin: 0 0 6px; font: 500 clamp(26px, 4vw, 32px)/1.1 var(--font-display); letter-spacing: -.035em; color: #000; }
.bk-lead { margin: 0 0 22px; color: var(--ink-2, #595959); font-size: 15px; line-height: 1.5; }

.bk-group { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.bk-legend, .bk-label { display: block; margin: 0 0 10px; padding: 0; font: 600 15px var(--font-body); color: #000; }
.bk-opt { font-weight: 400; color: var(--ink-3, #767676); }
.bk-field { margin: 0 0 18px; }
.bk-hint { margin: -4px 0 10px; font-size: 13px; color: var(--ink-2, #595959); }

/* chips (visually-hidden native inputs) */
.bk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-chips.bk-dates { display: grid; grid-template-columns: repeat(5, 1fr); }
.bk-chips.bk-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.bk-chip { position: relative; }
.bk-chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.bk-chip span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--line, #e0e0e0);
  background: #fff; color: #000; font: 500 15px var(--font-body); text-align: center; line-height: 1.2;
  transition: background-color .15s, color .15s, border-color .15s; user-select: none;
}
.bk-chip span small { font-size: 12px; font-weight: 500; color: var(--ink-2, #595959); }
.bk-dates .bk-chip span { padding: 10px 6px; }
.bk-times .bk-chip span { padding: 10px 6px; font-variant-numeric: tabular-nums; }
.bk-chip input:hover + span { border-color: #000; }
.bk-chip input:checked + span { background: #000; border-color: #000; color: #fff; }
.bk-chip input:checked + span small { color: rgba(255,255,255,.72); }
.bk-chip input:focus-visible + span { outline: 3px solid var(--accent, #3F00FF); outline-offset: 2px; }

/* inputs */
.bk-input {
  display: block; width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--line, #e0e0e0); border-radius: 12px; background: #fff; color: #000;
  font: 400 16px var(--font-body); transition: border-color .15s, box-shadow .15s;
}
textarea.bk-input { min-height: 96px; resize: vertical; line-height: 1.45; }
select.bk-input {
  appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.bk-input:hover { border-color: #000; }
.bk-input:focus-visible { outline: none; border-color: var(--accent, #3F00FF); box-shadow: 0 0 0 3px var(--accent-tint, #EFEAFF); }
.bk-input[aria-invalid="true"] { border-color: #c4282a; }
.bk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.bk-error { margin: 8px 0 0; font-size: 13.5px; font-weight: 500; color: #b3261e; }
.bk-error:empty { display: none; }

/* consent */
.bk-consent { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 15px; color: #000; line-height: 1.45; }
.bk-consent input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 1.5px solid #000; border-radius: 6px; background: #fff; cursor: pointer; display: grid; place-items: center; }
.bk-consent input:checked { background: #000; }
.bk-consent input:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.bk-consent input:focus-visible { outline: 3px solid var(--accent, #3F00FF); outline-offset: 2px; }
.bk-consent input[aria-invalid="true"] { border-color: #c4282a; }
.bk-privacy { margin: 10px 0 0 34px; font-size: 13px; color: var(--ink-2, #595959); line-height: 1.5; }
.bk-privacy a { color: var(--accent, #3F00FF); text-decoration: underline; }

.bk-cal {
  display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 18px; font-weight: 600; font-size: 15px;
  color: var(--accent, #3F00FF); text-decoration: underline; text-underline-offset: 3px;
}
.bk-cal svg { width: 18px; height: 18px; }

/* footer */
.bk-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 28px 24px; border-top: 1px solid var(--line, #e0e0e0); background: #fff; }
.bk-foot .btn svg { width: 1.1em; height: 1.1em; }
.bk-back { background: transparent; border-color: #000; color: #000; }
.bk-back svg { transform: rotate(180deg); }
.bk-back[hidden] { display: none; }
.bk-foot .bk-next { margin-left: auto; }
.bk-next { background: #000; color: #fff; }
.bk-submit { background: var(--accent, #3F00FF); color: #fff; border-color: var(--accent, #3F00FF); }
.bk-foot button[disabled] { opacity: .65; cursor: progress; transform: none; }
.bk-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: bkSpin .7s linear infinite; }
@keyframes bkSpin { to { transform: rotate(360deg); } }
.bk-status { margin: 0 28px; font-size: 14px; font-weight: 500; color: #b3261e; }
.bk-status { padding-top: 12px; }
.bk-status:empty { display: none; }

/* success */
.bk-done { text-align: center; padding: 26px 8px 18px; }
.bk-done-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; background: var(--highlight, #00E676); color: #000; }
.bk-done-icon svg { width: 34px; height: 34px; }
.bk-done .bk-lead { max-width: 420px; margin: 8px auto 24px; }
.bk-done .bk-mailnote { font-size: 13px; color: var(--ink-2, #595959); margin: -8px auto 22px; max-width: 420px; }
.bk-done .bk-mailnote a { color: var(--accent, #3F00FF); text-decoration: underline; }

.bk-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 auto 14px; }
.bk-done-actions .btn svg { width: 1.1em; height: 1.1em; }
.bk-done-actions .btn[hidden] { display: none; }
.bk-copy { background: transparent; border-color: #000; color: #000; }
.bk-direct { margin: 0 auto 6px; font-size: 15px; color: #000; }
.bk-direct a { color: var(--accent, #3F00FF); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; word-break: break-all; }
.bk-copy-status { margin: 0 auto 14px; min-height: 1.4em; font-size: 14px; font-weight: 500; color: var(--ink-2, #595959); }
.bk-summary { max-width: 460px; margin: 0 auto 16px; font-size: 14px; text-align: left; white-space: pre-wrap; }
.bk-summary[hidden] { display: none; }
.bk-done-close { background: transparent; color: #000; text-decoration: underline; text-underline-offset: 3px; }

.bk.is-done .bk-progress { visibility: hidden; }
.bk.is-done .bk-foot { display: none; }

/* mobile: full-screen sheet */
@media (max-width: 599px) {
  .bk {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0;
    border-radius: 0; inset: 0;
  }
  .bk[open] { animation-name: bkSheet; height: 100dvh; margin: 0; } /* full-screen sheet on phones */
  .bk-head { padding: 18px 16px 0; }
  .bk-body { padding: 16px 16px 8px; }
  .bk-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .bk-status { margin: 0 16px; }
  .bk-row { grid-template-columns: 1fr; }
  .bk-chips.bk-dates { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .bk-dates .bk-chip span { padding: 8px 2px; font-size: 14px; }
  .bk-chips.bk-times { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .bk-foot .btn { flex: 1; }
}
@keyframes bkSheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .bk[open], .bk::backdrop { animation: none; }
  .bk-bar span, .bk-chip span, .bk-input { transition: none; }
  .bk-spinner { animation-duration: 2s; }
}

.bk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.bk-cal[hidden] { display: none; }
