/* «Запись в три шага» (app/site_sheet.py, site/assets/company-sheet.js; pattern.md §4, the booking concept of
   15.11.2026): the page's chat panel as a sheet — the header, a hairline stepper with its progress, the summary line in
   mono, step 1's service rows, step 2's people, two weeks of days with their free windows as unit squares and the
   day's times by part of the day, step 3 the dialog's own questions as a form under the receipt, «Вы записаны» as the
   journal's record. The company's deep colour chooses, its bright one is the one ask; in chat mode (data-mode="chat")
   the panel is the chat it always was. */
.chat-panel[data-sheet] {
  --bs-deep: var(--s-pick, #2c4c3b); --bs-deep-ink: var(--s-pick-ink, #fff); --bs-deep-text: var(--s-link, #2c4c3b);
  --bs-fill: var(--s-accent, #c8f46c); --bs-fill-ink: var(--s-accent-ink, #17201a);
  --bs-ink: var(--s-ink, #141815); --bs-muted: var(--s-muted, #585e59);
  --bs-hair: color-mix(in srgb, var(--bs-ink) 10%, transparent); --bs-hair-strong: color-mix(in srgb, var(--bs-ink) 20%, transparent);
  --bs-warm: color-mix(in srgb, var(--bs-ink) 5%, var(--s-bg, #f6f6f2)); --bs-sheet: var(--s-surface, #fff);
  --bs-ease: cubic-bezier(.22, 1, .36, 1);
  width: min(480px, 100vw); background: var(--s-bg, #f6f6f2);
}
.chat-panel[data-sheet] .chat-top { background: var(--bs-sheet); color: var(--bs-ink); --s-ink: var(--bs-ink); --s-muted: var(--bs-muted);
  --s-line: var(--bs-hair); border-bottom-color: var(--bs-hair); }
.chat-panel[data-sheet] .chat-top .chat-title { font-family: var(--s-display, var(--sans)); font-weight: var(--s-display-weight, 800);
  text-transform: var(--s-display-case, none); color: var(--bs-deep-text); letter-spacing: -.01em; }
.chat-panel[data-sheet] .chat-avatar { border-radius: 8px; background: var(--bs-deep); color: var(--bs-deep-ink); }
.chat-panel[data-sheet] .chat-state { font-size: 12.5px; color: var(--bs-muted); }
.chat-panel[data-sheet] .chat-state .dot { background: #2f9e62; }

/* The sheet's own parts are the sheet's only; the chat's own parts step aside before step 3. */
.chat-panel[data-sheet]:not([data-mode="sheet"]) :is(.bs-steps, .bs-summary, .bs-pane, .bs-foot, .bs-head3) { display: none !important; }
.chat-panel[data-mode="sheet"]:is([data-step="1"], [data-step="2"]) :is(#chat, #status, #form, .chat-note, .chat-stand) { display: none; }
.chat-panel[data-mode="sheet"] .chat-note { display: none; }
/* Step 3 begins under what the chat said before (company-sheet.js begin): the earlier conversation is the chat's. */
.chat-panel[data-mode="sheet"] #chat > :not(.bs-head3, .bs-head3 ~ *) { display: none; }

/* --- the stepper and the summary line -------------------------------------------------------------------------------- */
.bs-steps { flex: none; padding: 10px 20px 0; background: var(--bs-sheet); }
.bs-steps ol { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; list-style: none; }
.bs-steps button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--bs-muted); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.bs-steps button b { font-family: var(--mono); font-size: 12px; font-weight: 600; color: inherit; }
.bs-steps button[aria-current] { color: var(--bs-ink); }
.bs-steps button[aria-current] b, .bs-steps button.passed b { color: var(--bs-deep-text); }
.bs-steps button.passed { color: var(--bs-ink); }
.bs-steps button:disabled { cursor: default; }
.bs-track { display: block; height: 2px; margin: 4px 0 0; background: var(--bs-hair); }
.bs-track i { display: block; height: 100%; width: calc(var(--bs-progress, .3333) * 100%); background: var(--bs-deep); transition: width .28s var(--bs-ease); }
.bs-summary { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 20px;
  border-bottom: 1px solid var(--bs-hair); background: var(--bs-sheet); font-family: var(--mono); font-size: 12px; line-height: 1.45; color: var(--bs-ink); }
.bs-summary[hidden] { display: none; }
.bs-summary b { flex: none; font-weight: 600; white-space: nowrap; }

/* --- the panes ---------------------------------------------------------------------------------------------------- */
.bs-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 24px; }
.bs-pane[hidden] { display: none; }
.bs-kicker { margin: 0 0 6px; font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--bs-deep-text); }
.bs-title { margin: 0 0 16px; font-family: var(--sans); font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -.025em; color: var(--bs-ink); outline: none; }
.bs-sub { display: flex; justify-content: space-between; gap: 12px; margin: 18px 0 8px; font-family: var(--mono); font-size: 12px; color: var(--bs-muted); }
.bs-sub[hidden] { display: none; }
.bs-cats, .bs-whos { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; padding: 4px; border: 1px solid var(--bs-hair); border-radius: var(--control-radius, 8px); background: var(--bs-sheet); }
.bs-whos { border-radius: 12px; }
.bs-whos[hidden] { display: none; }
.bs-cat, .bs-who { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 4px 12px; border: 0; border-radius: var(--control-radius, 8px); background: transparent;
  color: var(--bs-muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .28s var(--bs-ease), color .28s var(--bs-ease); }
.bs-cat i { width: 9px; height: 9px; border-radius: 50%; background: var(--bs-hair-strong); }
.bs-cat[aria-pressed="true"] i { background: var(--bs-deep); }
.bs-cat[aria-pressed="true"], .bs-who[aria-pressed="true"] { background: var(--bs-warm); color: var(--bs-ink); }
.bs-who[hidden] { display: none; }
.bs-ava { display: inline-grid; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: 50%; background: var(--bs-warm);
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--bs-ink); }
.bs-ava img { width: 100%; height: 100%; object-fit: cover; }
.bs-svcs { display: flex; flex-direction: column; border-top: 1px solid var(--bs-hair); }
.bs-svc { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 22px; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 6px;
  border: 0; border-bottom: 1px solid var(--bs-hair); background: transparent; color: var(--bs-ink); font: inherit; text-align: left; cursor: pointer;
  transition: background .2s var(--bs-ease); }
.bs-svc[hidden] { display: none; }
.bs-svc:hover { background: var(--bs-warm); }
.bs-svc[aria-pressed="true"] { background: color-mix(in srgb, var(--bs-deep) 7%, var(--bs-sheet)); box-shadow: inset 2px 0 0 var(--bs-deep); }
.bs-thumb { display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; border: 1px solid var(--bs-hair); border-radius: 8px; background: var(--bs-warm); }
.bs-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bs-thumb b { font-size: 16px; font-weight: 800; color: var(--bs-deep-text); }
.bs-svc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bs-svc-name { font-size: 15px; font-weight: 700; line-height: 1.3; }
.bs-svc-meta { font-family: var(--mono); font-size: 12px; color: var(--bs-muted); }
.bs-svc-price { font-family: var(--mono); font-size: 13.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bs-tick { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--bs-hair-strong); border-radius: 50%; color: transparent; }
.bs-svc[aria-pressed="true"] .bs-tick { border-color: var(--bs-deep); background: var(--bs-deep); color: var(--bs-deep-ink); }

/* Two weeks of days: a week a row, each day's free windows as unit squares (pattern.md «Unit matrix»: one square, one
   window; eight at most, the count in mono under them). */
.bs-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.bs-days[aria-busy="true"] { opacity: .55; }
.bs-day { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 76px; padding: 7px 2px 6px; border: 1px solid var(--bs-hair);
  border-radius: 12px; background: var(--bs-sheet); color: var(--bs-ink); font: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
.bs-day span { font-family: var(--mono); font-size: 11px; color: var(--bs-muted); }
.bs-day b { font-family: var(--mono); font-size: 15px; font-weight: 600; line-height: 1.1; }
.bs-day small { font-family: var(--mono); font-size: 10.5px; color: var(--bs-muted); }
.bs-day:disabled { cursor: default; background: transparent; color: color-mix(in srgb, var(--bs-ink) 45%, transparent); }
.bs-day.off { border-style: dashed; }
.bs-day:not(:disabled):hover { border-color: var(--bs-hair-strong); }
.bs-day[aria-pressed="true"] { border-color: var(--bs-deep); box-shadow: inset 0 0 0 1px var(--bs-deep); }
.bs-units { display: grid; grid-template-columns: repeat(4, 5px); gap: 2px; min-height: 12px; align-content: start; }
.bs-units u { width: 5px; height: 5px; border-radius: 1px; background: var(--bs-deep); }
.bs-day-sub .bs-day-count { font-variant-numeric: tabular-nums; }
.bs-part { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--bs-hair); }
.bs-part p { margin: 12px 0 0; font-family: var(--mono); font-size: 12px; color: var(--bs-muted); }
.bs-part > div { display: flex; flex-wrap: wrap; gap: 6px; }
.bs-time { min-width: 72px; min-height: 44px; padding: 0 12px; border: 1px solid var(--bs-hair-strong); border-radius: var(--control-radius, 8px); background: var(--bs-sheet);
  color: var(--bs-ink); font-family: var(--mono); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .28s var(--bs-ease), color .28s var(--bs-ease); }
.bs-time:hover { background: var(--bs-warm); }
.bs-time[aria-pressed="true"] { border-color: var(--bs-deep); background: var(--bs-deep); color: var(--bs-deep-ink); }
.bs-empty, .bs-error { margin: 12px 0 0; font-size: 14px; color: var(--bs-muted); }
.bs-error:empty { display: none; }
.bs-link { min-height: 44px; padding: 0; border: 0; background: none; color: var(--bs-deep-text); font: inherit; font-weight: 700; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--bs-deep) 35%, transparent); text-underline-offset: 3px; cursor: pointer; }

/* --- step 3: the receipt, then the dialog's questions drawn as a form ---------------------------------------------- */
.chat-panel[data-mode="sheet"] #chat { padding: 18px 20px 12px; gap: 12px; }
.bs-head3 .bs-title { margin-bottom: 12px; }
.bs-receipt { margin: 0 0 10px; border-top: 1px solid var(--bs-hair); }
.bs-receipt div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--bs-hair); font-size: 14px; }
.bs-receipt dt { color: var(--bs-muted); }
.bs-receipt dd { margin: 0; font-weight: 600; text-align: right; }
.bs-receipt .bs-total dd { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.bs-hint { margin: 0; font-size: 13px; color: var(--bs-muted); }
.chat-panel[data-mode="sheet"] .chat-message { max-width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 15px; }
.chat-panel[data-mode="sheet"] .chat-message .chat-title { font-size: 15px; font-weight: 800; color: var(--bs-ink); }
.chat-panel[data-mode="sheet"] .chat-message.mine { align-self: stretch; padding: 11px 14px; border: 1px solid var(--bs-hair-strong); border-radius: 8px;
  background: var(--bs-sheet); color: var(--bs-ink); font-weight: 600; }
.chat-panel[data-mode="sheet"] .chat-message.system { padding: 12px 14px; border: 1px dashed var(--bs-hair-strong); border-radius: 12px; }
.chat-panel[data-mode="sheet"] #buttons { max-width: 100%; }
.chat-panel[data-mode="sheet"] .chip { border-color: var(--bs-hair-strong); border-radius: var(--control-radius, 8px); min-height: 44px; }
.chat-panel[data-mode="sheet"] .chip.row { border-radius: 12px; }
.chat-panel[data-mode="sheet"] .chip.time { font-family: var(--mono); }
.chat-panel[data-mode="sheet"] .chip.success { border-color: var(--bs-fill); background: var(--bs-fill); color: var(--bs-fill-ink); font-weight: 800; }
.chat-panel[data-mode="sheet"] .chip.primary { border-color: var(--bs-deep); background: var(--bs-deep); color: var(--bs-deep-ink); }
.chat-panel[data-mode="sheet"] .chat-composer { border-top: 1px solid var(--bs-hair); background: var(--bs-sheet); }
/* «Вы записаны»: the journal's record — a hairline card, its mono line «Запись · завтра, 09:00» over the visit. */
.chat-panel .chat-message.bs-record { align-self: stretch; max-width: 100%; padding: 14px 16px; border: 1px solid var(--bs-hair-strong); border-left: 3px solid var(--bs-deep); border-radius: 14px;
  background: var(--bs-sheet); box-shadow: 0 18px 44px rgb(20 24 21 / .07), 0 2px 8px rgb(20 24 21 / .04); }
.bs-record-head { display: block; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px solid var(--bs-hair); font-family: var(--mono); font-size: 12px; color: var(--bs-muted); }

/* --- the foot: Назад / Дальше, the way to the chat ------------------------------------------------------------------ */
.bs-foot { flex: none; padding: 12px 20px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--bs-hair); background: var(--bs-sheet); }
.chat-panel[data-mode="sheet"][data-step="3"] .bs-foot { padding-top: 8px; }
.bs-cta { display: flex; gap: 8px; }
.bs-cta [hidden] { display: none !important; }
.bs-back, .bs-mine { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border: 1px solid var(--bs-hair-strong);
  border-radius: var(--control-radius, 8px); background: var(--bs-sheet); color: var(--bs-ink); font: inherit; font-size: 14.5px; font-weight: 700; text-decoration: none; cursor: pointer; }
.bs-next { flex: 1 1 auto; min-height: 46px; padding: 0 20px; border: 0; border-radius: var(--control-radius, 8px); background: var(--bs-deep); color: var(--bs-deep-ink);
  font: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 22px color-mix(in srgb, var(--bs-deep) 22%, transparent);
  transition: transform .2s var(--bs-ease), opacity .2s; }
.bs-next:not(:disabled):hover { transform: translateY(-1px); }
.bs-next:disabled { opacity: .45; box-shadow: none; cursor: default; }
.chat-panel[data-step="done"] .bs-next { background: var(--bs-sheet); color: var(--bs-ink); border: 1px solid var(--bs-hair-strong); box-shadow: none; }
.chat-panel[data-mode="sheet"][data-step="3"] .bs-cta:has(.bs-next[hidden]):has(.bs-back[hidden]) { display: none; }
.bs-quiet { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 0; font-size: 13.5px; }
.bs-where { font-family: var(--mono); font-size: 11.5px; color: var(--bs-muted); text-align: right; }
.chat-panel[data-sheet] :focus-visible { outline: 2px solid var(--bs-deep); outline-offset: 2px; }

@media (max-width: 520px) {
  .bs-pane, .chat-panel[data-mode="sheet"] #chat { padding-left: 16px; padding-right: 16px; }
  .bs-steps, .bs-summary, .bs-foot { padding-left: 16px; padding-right: 16px; }
  .bs-days { gap: 4px; }
  .bs-day { min-height: 70px; border-radius: 8px; }
  .bs-units { grid-template-columns: repeat(4, 4px); }
  .bs-units u { width: 4px; height: 4px; }
  .bs-where { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel[data-sheet] *, .chat-panel[data-sheet] *::before { transition: none !important; animation: none !important; }
}
/* The sheet's own «Назад» goes back: the dialog's way to its main menu and the demos' stand line stay the chat's. */
.chat-panel[data-mode="sheet"] #buttons .chip[data-cb="menu"], .chat-panel[data-mode="sheet"] .chat-stand { display: none; }
