/* =========================================================
   Mindspace — онлайн-запис і керування записом
   ========================================================= */
.book { padding-block: clamp(36px, 5vw, 64px) clamp(70px, 9vw, 120px); background: linear-gradient(180deg, var(--paper), #EFECE3 70%); }
.book__head { max-width: 780px; margin-bottom: clamp(26px, 3.6vw, 40px); }
.book__head .lead { margin-top: 16px; }

/* ---------- Кроки ---------- */
.stepper { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: calc(100% - 360px - 32px); }
.stepper li { position: relative; display: flex; align-items: center; gap: 10px; padding-top: 14px; font-size: .88rem; color: var(--ink-70); }
.stepper li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 3px; background: var(--line); }
.stepper li::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0; border-radius: 3px; background: var(--sage-d); transition: width .6s var(--ease); }
.stepper li.is-done::after, .stepper li[aria-current]::after { width: 100%; }
.stepper li[aria-current]::after { background: var(--sand-d); }
.stepper__n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; border: 1px solid var(--line); background: var(--paper); transition: background .4s, color .4s, border-color .4s; }
.stepper li.is-done .stepper__n { background: var(--sage-d); border-color: var(--sage-d); color: var(--paper); }
.stepper li[aria-current] { color: var(--ink); font-weight: 600; }
.stepper li[aria-current] .stepper__n { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Сітка: майстер + підсумок ---------- */
.book__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.wizard { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: clamp(22px, 3.4vw, 44px); box-shadow: 0 30px 60px -48px rgba(41, 53, 46, .5); min-height: 520px; }
.wizard.is-final { border-color: transparent; background: #fff; }

.wstep.is-active { animation: step-in .55s var(--ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 26px)); } }
.wstep__k { font-size: .86rem; font-weight: 700; letter-spacing: .04em; color: var(--sage-d); margin-bottom: 10px; }
.wstep__title { font-size: clamp(1.7rem, 2.6vw, 2.3rem); margin-bottom: 10px; outline: none; }
.wstep__hint { color: var(--ink-70); font-size: .95rem; margin: 0 0 22px; }
.wstep__nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.arr--back { transition: transform .45s var(--ease); }
.btn:hover .arr--back { transform: translateX(-4px); }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .arr { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; font-size: 0; animation: spin .8s linear infinite; }

/* ---------- 1. Послуги-радіо ---------- */
.svc-list { border: 0; margin: 18px 0 22px; padding: 0; display: grid; gap: 12px; min-width: 0; }
.svc { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "r main price" "r meta price"; gap: 4px 16px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; cursor: pointer; transition: border-color .3s, background .3s, transform .4s var(--ease), box-shadow .4s; }
.svc input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.svc__radio { grid-area: r; width: 22px; height: 22px; border: 1.5px solid var(--sage); border-radius: 50%; display: grid; place-items: center; transition: border-color .3s; }
.svc__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .35s var(--ease); }
.svc__main { grid-area: main; display: grid; gap: 2px; }
.svc__name { font: 500 1.18rem/1.25 var(--serif); }
.svc__short { font-size: .88rem; color: var(--ink-70); }
.svc__meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--ink-70); }
.svc__price { grid-area: price; font: 400 1.4rem/1 var(--serif); white-space: nowrap; }
.svc--first { background: linear-gradient(90deg, rgba(214, 182, 156, .16), transparent 60%); }
@media (hover: hover) { .svc:hover { border-color: var(--sage); transform: translateY(-2px); box-shadow: 0 16px 30px -26px rgba(41, 53, 46, .5); } }
.svc:has(input:checked) { border-color: var(--ink); background: var(--mist); }
.svc:has(input:checked) .svc__radio { border-color: var(--ink); }
.svc:has(input:checked) .svc__radio::after { transform: scale(1); }
.svc:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- 2. Календар + години ---------- */
.picker { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 28px; align-items: start; }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal__title { font-size: 1.3rem; }
.cal__nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 1.05rem; transition: background .3s, border-color .3s; }
.cal__nav:hover:not(:disabled) { background: var(--mist); border-color: var(--sage); }
.cal__nav:disabled { opacity: .3; cursor: default; }
.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow span { text-align: center; font-size: .74rem; font-weight: 700; letter-spacing: .06em; color: var(--ink-70); padding: 6px 0; }
.cal__day { position: relative; aspect-ratio: 1; min-height: 42px; border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 0; border: 1px solid transparent; background: none; font: inherit; }
.cal__day b { font-weight: 600; font-size: .98rem; line-height: 1.1; }
.cal__day small { font-size: .64rem; font-weight: 700; color: var(--sage-d); line-height: 1; }
.cal__day.is-off { color: rgba(41, 53, 46, .3); }
.cal__day.is-off b { font-weight: 400; text-decoration: line-through; text-decoration-color: rgba(41, 53, 46, .2); }
.cal__day.is-free { cursor: pointer; background: var(--mist); transition: background .25s, transform .3s var(--ease), border-color .25s; }
@media (hover: hover) { .cal__day.is-free:hover { background: #cfdacb; transform: translateY(-2px); } }
.cal__day.is-today::before { content: ""; position: absolute; top: 5px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--sand-d); }
.cal__day.is-sel { background: var(--ink); color: var(--paper); }
.cal__day.is-sel small { color: var(--sand); }
.cal__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; font-size: .8rem; color: var(--ink-70); }
.cal__legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--mist); display: inline-block; }
.dot--off { background: none; border: 1px solid var(--line); }
.picker.is-loading .cal__grid { opacity: .4; pointer-events: none; }

.times { background: var(--paper); border-radius: 18px; padding: 20px; min-height: 100%; }
.times__title { font-size: .9rem; color: var(--ink-70); margin: 0 0 14px; }
.times__title b { color: var(--ink); font-weight: 600; }
.times__empty { color: var(--ink-70); font-size: .95rem; margin: 0; }
.times__empty.is-error { color: #9a3b2f; }
.times__group + .times__group { margin-top: 16px; }
.times__label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--sage-d); margin-bottom: 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.chip { min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 1rem; cursor: pointer; transition: background .25s, border-color .25s, color .25s, transform .3s var(--ease); }
@media (hover: hover) { .chip:hover { border-color: var(--ink); transform: translateY(-2px); } }
.chip.is-sel { background: var(--ink); color: var(--paper); border-color: var(--ink); animation: pop .4s var(--ease); }
@keyframes pop { 50% { transform: scale(1.06); } }

/* ---------- 3. Поля ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.field input[type=text], .field input[type=email], .field textarea, .field select { width: 100%; min-height: 56px; padding: 14px 18px; border: 1px solid rgba(41, 53, 46, .22); border-radius: 14px; background: var(--paper); font-size: 1.02rem; transition: border-color .3s, background .3s, box-shadow .3s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--ink); background: #fff; box-shadow: 0 0 0 4px rgba(140, 156, 135, .25); }
.field__hint { font-size: .84rem; color: var(--ink-70); margin: 6px 0 0; }
.field__err { font-size: .86rem; color: #9a3b2f; margin: 6px 0 0; min-height: 0; }
.field__err:empty { display: none; }
.field.has-err input { border-color: #b4553f; background: #fdf6f3; }
.field--hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: grid !important; grid-template-columns: auto 1fr; gap: 12px; align-items: start; font-weight: 400 !important; font-size: .94rem !important; cursor: pointer; line-height: 1.5; }
.check input { position: absolute; opacity: 0; width: 22px; height: 22px; }
.check__box { width: 24px; height: 24px; border: 1.5px solid var(--sage); border-radius: 7px; display: grid; place-items: center; background: var(--paper); transition: background .25s, border-color .25s; margin-top: 1px; }
.check__box::after { content: ""; width: 11px; height: 6px; border-left: 2px solid var(--paper); border-bottom: 2px solid var(--paper); transform: rotate(-45deg) scale(0); transform-origin: center; transition: transform .3s var(--ease); margin-top: -2px; }
.check input:checked + .check__box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .check__box::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible + .check__box { outline: 2px solid var(--ink); outline-offset: 3px; }
.field.has-err .check__box { border-color: #b4553f; }

/* ---------- 4. Перевірка ---------- */
.review-list { margin: 18px 0 0; border-top: 1px solid var(--line); }
.review-list > div { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.review-list dt { font-size: .86rem; color: var(--ink-70); }
.review-list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.review-list--compact > div { grid-template-columns: 110px minmax(0, 1fr); padding: 11px 0; }
.edit { background: none; border: 0; padding: 6px 2px; font-size: .86rem; font-weight: 600; color: var(--sage-d); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.edit:hover { color: var(--ink); }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 22px 0 12px; padding: 18px 20px; border-radius: 16px; background: var(--mist); }
.total b { font: 400 1.9rem/1 var(--serif); }
.alert { margin: 0 0 18px; padding: 14px 18px; border-radius: 14px; background: #fbefe9; color: #7d2f22; border: 1px solid #efcdbf; font-size: .95rem; }

/* ---------- 5. Готово ---------- */
.wstep--done { text-align: left; }
.done-mark { width: 72px; height: 72px; margin-bottom: 18px; }
.done-mark circle { fill: var(--mist); stroke: var(--sage-d); stroke-width: 2; stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw .9s var(--ease) .1s forwards; }
.done-mark path { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 44; stroke-dashoffset: 44; animation: draw .6s var(--ease) .7s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.wstep--done .lead { margin-bottom: 8px; }
.done-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.mail-preview { margin-top: 26px; border: 1px dashed rgba(41, 53, 46, .25); border-radius: 16px; padding: 4px 18px; background: var(--paper); }
.mail-preview summary { cursor: pointer; padding: 12px 0; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.mail-preview__subj { font: 500 1.05rem var(--serif); margin: 4px 0 10px; }
.mail-preview pre { white-space: pre-wrap; font: .88rem/1.6 var(--sans); color: var(--ink-70); margin: 0 0 16px; }

/* ---------- Підсумок ---------- */
.summary { position: sticky; top: calc(var(--header) + 20px); background: var(--ink); color: var(--paper); border-radius: 26px; padding: 28px; }
.summary__k { font: 400 1.5rem/1.1 var(--serif); margin-bottom: 16px; }
.summary dl { margin: 0; }
.summary dl > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-d); font-size: .92rem; }
.summary dt { color: rgba(247, 245, 239, .55); }
.summary dd { margin: 0; color: rgba(247, 245, 239, .45); transition: color .4s; }
.summary dl > div.is-set dd { color: var(--paper); animation: flash .7s var(--ease); }
@keyframes flash { from { color: var(--sand); } }
.summary__total { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 0 6px; }
.summary__total span { color: rgba(247, 245, 239, .6); font-size: .92rem; }
.summary__total b { font: 400 2rem/1 var(--serif); color: var(--sand); }
.summary__notes { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; font-size: .86rem; color: rgba(247, 245, 239, .78); }
.summary__notes li { display: flex; gap: 10px; }
.summary__notes li::before { content: "✓"; color: var(--sand); }
.summary__demo { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line-d); font-size: .78rem; color: rgba(247, 245, 239, .55); }

/* ---------- Керування записом ---------- */
.manage { max-width: 860px; }
.manage-card { background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: clamp(22px, 3.4vw, 40px); }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--pending { background: #f6ecdf; color: #8a5a2b; }
.status--confirmed { background: var(--mist); color: #3e5a37; }
.status--cancelled { background: #f3e4e0; color: #8b3a2c; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.manage-panel { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }
.confirm-box { padding: 20px; border-radius: 16px; background: #fbefe9; border: 1px solid #efcdbf; }
.confirm-box p { margin-bottom: 14px; }
.btn--danger { --bg: #8b3a2c; --fg: #fff; }
.btn--danger::before { background: #6e2c21; }

/* ---------- Адаптивність ---------- */
@media (max-width: 1100px) {
  .book__grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
  .stepper { max-width: calc(100% - 300px - 22px); }
  .picker { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .book__grid { grid-template-columns: 1fr; }
  .stepper { max-width: none; }
  .summary { position: static; order: -1; padding: 18px 20px; border-radius: 20px; }
  .summary__k, .summary__notes, .summary__demo { display: none; }
  .summary dl { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .summary dl > div { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  .summary dl > div:nth-child(3) { display: none; }
  .summary__total { padding: 12px 0 0; }
  .summary__total b { font-size: 1.6rem; }
  [data-step-now="1"] .summary, [data-step-now="5"] .summary { display: none; }
}
@media (max-width: 640px) {
  .book { padding-top: 26px; }
  .stepper { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .stepper__l { display: none; }
  .stepper li[aria-current] .stepper__l { display: inline; position: absolute; left: 0; top: 46px; white-space: nowrap; }
  .stepper { margin-bottom: 44px; }
  .stepper li:nth-child(n+4)[aria-current] .stepper__l { left: auto; right: 0; }
  .wizard { border-radius: 20px; padding: 20px 16px; min-height: 0; }
  .svc { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "r main" "r meta" "r price"; padding: 16px; }
  .svc__price { font-size: 1.2rem; margin-top: 4px; }
  .times { padding: 16px 14px; }
  .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wstep__nav { position: sticky; bottom: 0; z-index: 5; margin: 26px -16px -20px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-radius: 0 0 20px 20px; }
  .wstep__nav .btn { min-height: 52px; padding: 0 18px; }
  .wstep__nav .btn:last-child { flex: 1; }
  .review-list > div { grid-template-columns: 1fr auto; }
  .review-list dt { grid-column: 1 / -1; }
  .review-list dd { grid-column: 1; }
  .review-list > div > :last-child { grid-column: 2; grid-row: 2; }
  .done-actions .btn { width: 100%; }
  .review-list--compact > div { grid-template-columns: 1fr; gap: 2px; }
  .review-list.review-list--compact > div > dd:last-child { grid-column: 1; grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .wstep.is-active { animation: none; }
  .done-mark circle, .done-mark path { stroke-dashoffset: 0; animation: none; }
}
.alert--ok { background: var(--mist); color: #2f4a2a; border-color: #c4d2bf; }
.manage .picker { margin-top: 8px; }
