/* Онлайн-запись «Фамилия». Все правила внутри .fb / .fb-overlay — со стилями шаблона не пересекаются.
   Основной цвет берётся из настройки Аспро (--theme-base-color), если её нет — бирюзовый сайта. */

.fb, .fb-overlay {
  --fb-accent: var(--theme-base-color, #23babf);
  --fb-accent-ink: #fff;
  --fb-text: #222;
  --fb-muted: #6b7378;
  --fb-line: #e3e8ea;
  --fb-soft: #f3f7f8;
  --fb-bg: #fff;
  --fb-bad: #c62828;
  --fb-radius: 12px;
}

.fb { font-family: inherit; font-size: 15px; line-height: 1.45; color: var(--fb-text); background: var(--fb-bg); text-align: left; }
.fb *, .fb *::before, .fb *::after { box-sizing: border-box; }
.fb button { font: inherit; color: inherit; cursor: pointer; }
.fb a { color: var(--fb-accent); }

.fb-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--fb-line);
  position: sticky; top: 0; background: var(--fb-bg); z-index: 1;
}
.fb-test { flex-basis: 100%; order: -1; padding: 4px 8px; border-radius: 6px; background: #fff3cd; color: #7a5b00; font-size: 13px; text-align: center; }
.fb-head { flex-wrap: wrap; }
.fb-title { flex: 1; font-size: 18px; font-weight: 600; line-height: 1.25; }
.fb-back, .fb-close {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--fb-soft);
  font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.fb-close { font-size: 26px; }
.fb-back:hover, .fb-close:hover { background: var(--fb-line); }

.fb-body { padding: 16px; }

.fb-search {
  width: 100%; height: 44px; padding: 0 14px; font: inherit; color: inherit;
  border: 1px solid var(--fb-line); border-radius: var(--fb-radius); background: var(--fb-soft); outline: none;
}
.fb-search:focus { border-color: var(--fb-accent); background: var(--fb-bg); }

.fb-seg { display: flex; gap: 4px; margin: 12px 0; padding: 4px; background: var(--fb-soft); border-radius: var(--fb-radius); }
.fb-seg button { flex: 1; height: 36px; border: 0; border-radius: 9px; background: transparent; }
.fb-seg button.is-on { background: var(--fb-bg); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

.fb-list { display: flex; flex-direction: column; }
.fb-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  width: 100%; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--fb-line); background: none; text-align: left;
}
.fb-row:hover span { color: var(--fb-accent); }
.fb-row small { color: var(--fb-muted); white-space: nowrap; flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.fb-sub { margin: 18px 0 2px; font-size: 13px; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .04em; }

.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fb-chips button { padding: 6px 12px; border: 1px solid var(--fb-line); border-radius: 999px; background: var(--fb-bg); font-size: 14px; }
.fb-chips button.is-on { border-color: var(--fb-accent); color: var(--fb-accent); font-weight: 600; }

.fb-card { padding: 16px; border: 1px solid var(--fb-line); border-radius: var(--fb-radius); margin-bottom: 12px; }
.fb-doc { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.fb-ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--fb-soft); }
.fb-ph-txt { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: var(--fb-accent); }
.fb-name { font-weight: 600; }
.fb-name a { color: inherit; text-decoration: none; }
.fb-name a:hover { color: var(--fb-accent); }
.fb-meta { color: var(--fb-muted); font-size: 14px; }

.fb-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: thin; }
.fb-days button {
  flex: none; min-width: 64px; padding: 6px 8px; border: 1px solid var(--fb-line); border-radius: 10px; background: var(--fb-bg);
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.fb-days b { font-weight: 600; font-size: 14px; white-space: nowrap; }
.fb-days small { color: var(--fb-muted); font-size: 12px; }
.fb-days button.is-on { border-color: var(--fb-accent); box-shadow: inset 0 0 0 1px var(--fb-accent); }

.fb-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.fb-times button {
  height: 40px; border: 0; border-radius: 10px; background: var(--fb-accent); color: var(--fb-accent-ink); font-weight: 600;
}
.fb-times button:hover { filter: brightness(.93); }

.fb-note { margin: 4px 0 0; color: var(--fb-muted); font-size: 14px; }
.fb-link { display: block; margin: 4px auto 0; border: 0; background: none; color: var(--fb-accent); text-decoration: underline; }

.fb-summary {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 16px;
  background: var(--fb-soft); border-radius: var(--fb-radius); font-size: 14px; color: var(--fb-muted);
}
.fb-summary b { font-size: 16px; color: var(--fb-text); }

.fb-form { display: flex; flex-direction: column; gap: 12px; }
.fb-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.fb-field > span { font-size: 14px; color: var(--fb-muted); }
.fb-field i { color: var(--fb-bad); font-style: normal; }
.fb-field input, .fb-field textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: var(--fb-bg);
  border: 1px solid var(--fb-line); border-radius: 10px; outline: none; resize: vertical;
}
.fb-field input { height: 44px; }
.fb-field input:focus, .fb-field textarea:focus { border-color: var(--fb-accent); }
.fb-field .is-bad { border-color: var(--fb-bad); }
.fb-hint { margin: -6px 0 0; font-size: 13px; color: var(--fb-muted); }
.fb-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--fb-muted); margin: 0; cursor: pointer; }
.fb-check input { margin-top: 2px; width: 18px; height: 18px; flex: none; accent-color: var(--fb-accent); }
.fb-check input.is-bad { outline: 2px solid var(--fb-bad); }
.fb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.fb-error { padding: 10px 12px; border-radius: 10px; background: #fdecea; color: var(--fb-bad); font-size: 14px; }

.fb-btn {
  width: 100%; height: 48px; border: 0; border-radius: var(--fb-radius);
  background: var(--fb-accent); color: var(--fb-accent-ink) !important; font-weight: 600; font-size: 16px;
}
.fb-btn:disabled { opacity: .6; cursor: default; }

.fb-empty { padding: 24px 8px; text-align: center; color: var(--fb-muted); }
.fb-empty .fb-btn { margin-top: 12px; }

.fb-done { text-align: center; padding: 8px 0; }
.fb-done p { margin: 4px 0; }
.fb-ok {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--fb-accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.fb-done-when { font-size: 18px; font-weight: 600; }
.fb-done .fb-note { margin: 14px 0 16px; }

.fb-loading { display: flex; justify-content: center; gap: 6px; padding: 40px 0; }
.fb-loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--fb-accent); animation: fb-dot 1s infinite ease-in-out; }
.fb-loading span:nth-child(2) { animation-delay: .15s; }
.fb-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes fb-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Окно */
html.fb-lock, html.fb-lock body { overflow: hidden; }
.fb-overlay {
  position: fixed; inset: 0; z-index: 100000; background: rgba(20, 30, 35, .5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.fb-dialog {
  width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--fb-bg); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
@media (max-width: 600px) {
  .fb-overlay { padding: 0; }
  .fb-dialog { max-width: none; height: 100%; border-radius: 0; }
}

/* Встроенный вариант на странице /zapis/ */
[data-familia-booking] .fb { max-width: 720px; border: 1px solid var(--fb-line); border-radius: 16px; overflow: hidden; }
[data-familia-booking] .fb-head { position: static; }

@media (prefers-reduced-motion: reduce) { .fb-loading span { animation: none; opacity: .7; } }
