/* Novaterica AI — окно ассистента и запись на встречу. Перенесено с benevsky.ai (styles.css: «кнопка ассистента», «панель ассистента»,
   «запись на встречу») и переведено на токены Novaterica AI («Лазурь»), живой аватар с глазами. */

/* ── кнопка ассистента внизу страницы ── */
.ask-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 22px 0 10px;
  border: 0; border-radius: 100px; cursor: pointer; color: #fff;
  background: linear-gradient(115deg, var(--g1), var(--g3));
  font: inherit; font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  box-shadow: 0 16px 36px -12px color-mix(in srgb, var(--g1) 75%, transparent), var(--lift-sm);
  transform: translateY(120px); opacity: 0; transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.ask-fab .ava { --s: 34px; }
.ask-fab.is-shown { transform: none; opacity: 1; }
.ask-fab.is-shown.is-tucked { transform: translateY(120px); opacity: 0; }

/* ── панель ассистента ── */
.chat {
  --chat-bg: color-mix(in srgb, var(--surface) 94%, transparent);
  position: fixed; z-index: 60; top: 16px; right: 16px; bottom: 16px; width: min(460px, calc(100% - 32px));
  display: flex; flex-direction: column;
  border-radius: 28px; border: 1px solid var(--hair); background: var(--chat-bg);
  box-shadow: 0 30px 80px -24px rgba(4, 20, 60, 0.45), var(--lift);
  -webkit-backdrop-filter: blur(30px) saturate(1.2); backdrop-filter: blur(30px) saturate(1.2);
  transform: translateX(calc(100% + 40px)); visibility: hidden;
  transition: transform 0.55s var(--ease), visibility 0s linear 0.55s;
}
.chat.is-open { transform: none; visibility: visible; transition: transform 0.55s var(--ease), visibility 0s; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--hair); }
.chat-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-ava.ava { --s: 40px; }
.chat-name { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.chat-status { display: flex; align-items: center; gap: 7px; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.chat-status .live { width: 6px; height: 6px; background: var(--ok); animation: none; }
.chat.is-busy .chat-status { color: var(--hot-ink); }
.chat.is-busy .chat-status .live { background: var(--hot); animation: live 1.6s ease-out infinite; }
#chat-status-t .st-busy, #chat-status-t[data-busy="1"] .st-idle { display: none; }
#chat-status-t[data-busy="1"] .st-busy { display: inline; }
.chat-tools { display: flex; gap: 2px; }
.chat-tools .icon-btn { color: var(--muted); }
.chat-tools .icon-btn:hover { color: var(--ink); }

.chat-log { position: relative; flex: 1; overflow-y: auto; padding: 20px 18px 12px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.chat-jump {
  position: absolute; left: 50%; bottom: 118px; z-index: 2; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 100px;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink); box-shadow: var(--lift-sm); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500;
}

/* приветствие */
.chat-hello { margin: auto 0; padding: 8px 2px; display: flex; flex-direction: column; align-items: flex-start; }
.chat-hello-orb.ava { --s: 56px; box-shadow: 0 0 0 8px color-mix(in srgb, var(--hot) 10%, transparent), 0 14px 34px color-mix(in srgb, var(--g1) 35%, transparent); }
.chat-hello-t { margin: 18px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.chat-hello-s { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.chat-starters { margin-top: 18px; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.starter {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 13px 14px; border-radius: 16px; text-align: left; cursor: pointer;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.starter b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.starter small { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.starter:hover { border-color: color-mix(in srgb, var(--hot) 55%, transparent); transform: translateY(-1px); box-shadow: var(--lift-sm); }
.chat-more-t { margin: 22px 0 0; font-size: 10.5px; color: var(--muted); }
.chat-more { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

/* сообщения */
.msg { font-size: 15px; line-height: 1.55; letter-spacing: -0.008em; overflow-wrap: anywhere; }
.msg p { margin: 0; }
.msg p + p, .msg p + ul, .msg ul + p, .msg p + ol, .msg ol + p { margin-top: 10px; }
.msg ul, .msg ol { list-style: none; display: flex; flex-direction: column; gap: 5px; padding: 0 0 0 2px; margin: 0; }
.msg ol { counter-reset: n; }
.msg li { position: relative; padding-left: 18px; }
.msg ul li::before { content: ""; position: absolute; left: 3px; top: 0.68em; width: 6px; height: 6px; border-radius: 2px; background: linear-gradient(135deg, var(--g2), var(--g1)); }
.msg ol li { counter-increment: n; padding-left: 24px; }
.msg ol li::before { content: counter(n); position: absolute; left: 0; top: 0.15em; width: 18px; height: 18px; border-radius: 50%; background: var(--hot-wash); color: var(--hot-ink); font-family: var(--mono); font-size: 11px; display: grid; place-items: center; }
.msg b, .msg strong { font-weight: 600; }
.msg a { color: var(--hot-ink); text-underline-offset: 3px; }
.msg-user {
  align-self: flex-end; max-width: 85%; padding: 10px 15px; border-radius: 18px 18px 5px 18px;
  background: linear-gradient(115deg, var(--g1), var(--g3)); color: #fff; white-space: pre-wrap; animation: logIn 0.3s var(--ease);
}
.bot { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; animation: logIn 0.3s var(--ease); }
.bot-ava.ava { --s: 28px; margin-top: 1px; }
.bot-col { min-width: 0; }
.msg-bot { padding-top: 3px; }
.msg-bot.is-note { padding: 10px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--hair); color: var(--muted); font-size: 14.5px; }
.msg-bot .caret { display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -0.16em; border-radius: 2px; background: var(--hot); animation: chatCaret 0.9s steps(1) infinite; }
@keyframes chatCaret { 50% { opacity: 0; } }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } }
.bot-extra { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.bot-extra:empty { display: none; }
.bot-tools { display: flex; gap: 2px; margin-left: -8px; }
.bot-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.bot-tool:hover { background: var(--hair); color: var(--ink); }
.bot-retry { align-self: flex-start; margin-left: -8px; color: var(--hot-ink); }
.chat-cta {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--hot) 55%, transparent); background: var(--hot-wash);
  animation: logIn 0.4s var(--ease);
}
.chat-cta-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g3)); }
.chat-cta-t b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.chat-cta-t small { display: block; font-size: 12.5px; color: var(--muted); }
.chat-cta .btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.chat-next { display: flex; flex-wrap: wrap; gap: 6px; animation: logIn 0.4s var(--ease); }
.chip-next {
  min-height: 34px; padding: 6px 13px; border-radius: 100px; border: 1px solid var(--hair); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13.5px; line-height: 1.3; text-align: left; cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.chip-next:hover { border-color: color-mix(in srgb, var(--hot) 60%, transparent); color: var(--hot-ink); }
.chip-more { color: var(--muted); }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* ввод */
.chat-form { display: flex; align-items: flex-end; gap: 6px; margin: 4px 12px 6px; padding: 6px 6px 6px 16px; border-radius: 24px; border: 1px solid var(--rule); background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s; }
.chat-form:focus-within { border-color: color-mix(in srgb, var(--hot) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hot) 14%, transparent); }
.chat-input { flex: 1; min-width: 0; max-height: 160px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; }
.chat-input::placeholder { color: var(--muted); }
.chat-send { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g3)); cursor: pointer; transition: opacity 0.2s, transform 0.2s var(--ease); }
.chat-send:hover:not(:disabled) { transform: scale(1.05); }
.chat-send:disabled { opacity: 0.3; cursor: default; }
.chat-send .i-stop { display: none; }
.chat.is-busy .chat-send .i-send { display: none; }
.chat.is-busy .chat-send .i-stop { display: block; }
.chat-foot { margin: 0; padding: 2px 20px 14px; font-size: 11.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── запись на встречу ── */
.book { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; visibility: hidden; pointer-events: none; }
.book.is-open { visibility: visible; pointer-events: auto; }
.book-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 10, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.35s var(--ease); }
.book.is-open .book-backdrop { opacity: 1; }
.book-card {
  position: relative; width: min(680px, 100%); max-height: min(860px, calc(100svh - 48px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 28px; border: 1px solid var(--hair); background: var(--surface); box-shadow: 0 30px 80px -24px rgba(4, 20, 60, 0.45), var(--lift);
  transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.45s var(--ease), opacity 0.35s var(--ease);
}
.book.is-open .book-card { transform: none; opacity: 1; }
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 24px; border-bottom: 1px solid var(--hair); }
.book-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.book-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 100px; font-size: 13.5px; color: var(--muted); }
.book-steps li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); font-family: var(--mono); font-size: 11px; }
.book-steps li.is-on { background: var(--surface-2); color: var(--ink); }
.book-steps li.is-on span { background: var(--ink); border-color: var(--ink); color: var(--page); }
.book-steps li.is-done span { background: var(--hot); border-color: var(--hot); color: #fff; }
.book-body { flex: 1; overflow-y: auto; padding: 24px 24px 8px; overscroll-behavior: contain; }
.book-title { margin: 0; font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.book-sub { margin: 10px 0 0; font-size: 16px; line-height: 1.5; color: var(--muted); max-width: 540px; }
.book-label { margin: 24px 0 10px; display: flex; align-items: baseline; gap: 10px; font-size: 11px; color: var(--muted); }
.book-tz { text-transform: none; letter-spacing: 0.02em; color: var(--hot-ink); }
.book-days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.book-day {
  flex: 0 0 auto; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 74px; padding: 10px 0 9px; border-radius: 16px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.book-day .wd { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.book-day .dd { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.book-day .mm { font-size: 12.5px; color: var(--muted); }
.book-day:hover, .book-time:hover { border-color: color-mix(in srgb, var(--hot) 60%, transparent); }
.book-day[aria-checked="true"], .book-time[aria-checked="true"] { background: linear-gradient(135deg, var(--g1), var(--g3)); border-color: transparent; color: #fff; }
.book-day[aria-checked="true"] .wd, .book-day[aria-checked="true"] .mm, .book-time[aria-checked="true"] small { color: rgba(255, 255, 255, 0.85); }
.book-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.book-time {
  min-height: 50px; padding: 6px 8px; border-radius: 14px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.book-time small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.book-format { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 8px; border-radius: 100px; background: var(--hair); }
.book-format .seg-btn { min-height: 38px; padding: 0 16px; border: 0; border-radius: 100px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -0.005em; text-transform: none; cursor: pointer; }
.book-format .seg-btn:hover { color: var(--ink); }
.book-format .seg-btn.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--lift-sm); }
.book-pick {
  margin-top: 16px; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--hot) 55%, transparent); background: var(--hot-wash); color: var(--ink); cursor: pointer; text-align: left;
  font: inherit; font-size: 15.5px; line-height: 1.4;
}
.book-pick b { font-weight: 600; }
.book-pick span:last-child { flex: 0 0 auto; font-size: 13.5px; color: var(--hot-ink); }
.book-form { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.fld.is-wide { grid-column: 1 / -1; }
.fld i { font-style: normal; opacity: 0.8; }
.fld input, .fld textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 16px; outline: 0; resize: vertical; transition: border-color 0.2s, box-shadow 0.2s;
}
.fld input:focus, .fld textarea:focus { border-color: color-mix(in srgb, var(--hot) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hot) 14%, transparent); }
.fld.is-bad input { border-color: var(--st-nocheck); }
.book-note { margin: 14px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.book-done { text-align: center; padding: 20px 0 12px; }
.book-done-ic { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g3)); margin-bottom: 18px; box-shadow: 0 12px 40px color-mix(in srgb, var(--g1) 40%, transparent); }
.book-done .book-sub { margin-left: auto; margin-right: auto; }
.book-done-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.book-foot { display: flex; align-items: center; gap: 12px; padding: 14px 16px 16px 24px; border-top: 1px solid var(--hair); }
.book-summary { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 1.35; color: var(--muted); }
.book-summary b { color: var(--ink); font-weight: 600; }
.book-foot .btn { min-height: 48px; }
.book-foot .btn[disabled] { opacity: 0.35; cursor: not-allowed; }
body.book-open { overflow: hidden; }

/* ── телефон ── */
@media (max-width: 860px) {
  .chat { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .chat-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .chat-starters { grid-template-columns: minmax(0, 1fr); }
  .chat-form { margin-bottom: 4px; }
  .chat-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body.chat-open { overflow: hidden; }
  .book { padding: 0; align-items: end; }
  .book-card { width: 100%; max-height: calc(100svh - 24px); border-radius: 24px 24px 0 0; transform: translateY(40px); }
  .book-head { padding: 10px 10px 10px 16px; }
  .book-steps { flex-wrap: nowrap; }
  .book-steps li { padding: 4px 8px 4px 4px; font-size: 12.5px; }
  .book-steps li:not(.is-on) { padding-right: 4px; font-size: 0; gap: 0; }
  .book-steps li:not(.is-on) span { font-size: 11px; }
  .book:not([data-step="1"]) .book-summary { display: none; }
  .book:not([data-step="1"]) .book-foot { justify-content: space-between; }
  .book-body { padding: 18px 16px 8px; }
  .book-times { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book-form { grid-template-columns: 1fr; }
  .book-foot { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)) 16px; }
  .book-format { display: flex; width: 100%; }
  .book-format .seg-btn { flex: 1; padding: 0 8px; font-size: 13px; }
  .ask-fab { right: 12px; bottom: 12px; }
}
@media (max-width: 480px) {
  .st-more { display: none; }
  .chat-cta { grid-template-columns: auto minmax(0, 1fr); }
  .chat-cta .btn-sm { grid-column: 1 / -1; width: 100%; min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat, .book-card, .book-backdrop, .ask-fab { transition: none; }
  .msg-user, .bot, .chat-cta, .chat-next { animation: none; }
}
@media print { .ask-fab, .chat, .book { display: none !important; } }

/* светлая тема: главные кнопки записи и чата — в фирменном градиенте, как кнопки первого экрана и финала */
:root:not([data-theme="dark"]) .book .btn-ink, :root:not([data-theme="dark"]) .chat-cta .btn-ink { background: linear-gradient(115deg, var(--g1), color-mix(in srgb, var(--g1) 50%, var(--g3)) 60%, var(--g3)); color: #fff; }
:root:not([data-theme="dark"]) .book .btn-ink:hover, :root:not([data-theme="dark"]) .chat-cta .btn-ink:hover { background: linear-gradient(115deg, color-mix(in srgb, var(--g1) 85%, #000), var(--g3)); color: #fff; }
.book-foot .btn[disabled] { background: var(--hair); color: var(--muted); }
.msg a[href*="wa.me"], .msg a[href^="tel"] { white-space: nowrap; }
/* скрытые элементы окна чата и записи действительно скрыты: собственный display кнопок не перебивает атрибут hidden */
.chat [hidden], .book [hidden] { display: none !important; }
