/* Виджет записи на исследование — плавающая кнопка + модальное окно */
:root {
  --bk-primary: #1a6fb5;
  --bk-primary-hover: #155a94;
  --bk-bg: #ffffff;
  --bk-text: #1a1a1a;
  --bk-muted: #5c6570;
  --bk-border: #e2e8f0;
  --bk-error: #c62828;
  --bk-radius: 14px;
  --bk-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  --bk-z: 2147483000;
}

#bk-widget-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--bk-z);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--bk-text);
}

#bk-widget-root * {
  box-sizing: border-box;
}

.bk-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a6fb5, #0d4f8c);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 24px rgba(26, 111, 181, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bk-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 28px rgba(26, 111, 181, 0.55);
}

.bk-fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.bk-fab-label {
  position: fixed;
  right: 92px;
  bottom: 38px;
  background: var(--bk-bg);
  color: var(--bk-text);
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: var(--bk-shadow);
  pointer-events: none;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.25s, transform 0.25s;
}

.bk-fab:hover + .bk-fab-label,
.bk-fab:focus + .bk-fab-label {
  opacity: 1;
  transform: translateX(0);
}

.bk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.bk-overlay.bk-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.bk-modal {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 120px));
  background: var(--bk-bg);
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.bk-modal.bk-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.bk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--bk-border);
  background: linear-gradient(180deg, #f8fafc, #fff);
}

.bk-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.bk-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--bk-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bk-close:hover {
  background: #f1f5f9;
  color: var(--bk-text);
}

.bk-progress {
  height: 4px;
  background: #e2e8f0;
}

.bk-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a6fb5, #38bdf8);
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}

.bk-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.bk-body p {
  margin: 0 0 12px;
}

.bk-html {
  margin-bottom: 14px;
}

.bk-html b,
.bk-html strong {
  font-weight: 600;
}

.bk-html i,
.bk-html em {
  font-style: italic;
  color: var(--bk-muted);
}

.bk-error {
  background: #fef2f2;
  color: var(--bk-error);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.bk-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bk-choice {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--bk-border);
  border-radius: 10px;
  background: #fff;
  color: var(--bk-text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.bk-choice:hover {
  border-color: var(--bk-primary);
  background: #f0f7ff;
}

.bk-choice:active {
  transform: scale(0.99);
}

.bk-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bk-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--bk-border);
  border-radius: 10px;
  font-size: 16px;
}

.bk-field input:focus {
  outline: none;
  border-color: var(--bk-primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 181, 0.15);
}

.bk-submit {
  margin-top: 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--bk-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.bk-submit:hover {
  background: var(--bk-primary-hover);
}

.bk-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bk-footer {
  display: flex;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--bk-border);
}

.bk-back {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--bk-border);
  border-radius: 10px;
  background: #fff;
  color: var(--bk-muted);
  font-size: 14px;
  cursor: pointer;
}

.bk-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bk-success-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.bk-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--bk-muted);
}

/* Календарь дат */
.bk-calendar {
  margin-top: 4px;
}

.bk-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bk-cal-month-label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--bk-text);
}

.bk-cal-nav {
  width: 34px;
  height: 34px;
  border: 1px solid var(--bk-border);
  border-radius: 10px;
  background: #fff;
  color: var(--bk-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.bk-cal-nav:hover:not(:disabled) {
  border-color: var(--bk-primary);
  background: #f6f8fb;
  color: var(--bk-text);
}

.bk-cal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.bk-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.bk-cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--bk-muted);
  padding: 2px 0;
}

.bk-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.bk-cal-day {
  aspect-ratio: 1;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--bk-text);
  cursor: default;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.bk-cal-day.is-outside {
  visibility: hidden;
  pointer-events: none;
}

.bk-cal-day.is-disabled {
  color: #b8c0ca;
  background: #f4f6f8;
  border-color: #eef1f5;
}

.bk-cal-day.is-enabled {
  cursor: pointer;
  background: #fff;
  border-color: var(--bk-border);
}

.bk-cal-day.is-enabled:hover {
  border-color: var(--bk-primary);
  background: #f6f8fb;
  color: var(--bk-primary);
}

.bk-cal-day.is-enabled:active {
  transform: scale(0.96);
}

/* Плитки времени */
.bk-time-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.bk-time-tile {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 11px 18px;
  border: 1px solid var(--bk-border);
  border-radius: 999px;
  background: #fff;
  color: var(--bk-text);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.bk-time-tile:hover {
  border-color: var(--bk-primary);
  background: #f6f8fb;
  color: var(--bk-primary);
}

.bk-time-tile:active {
  transform: scale(0.98);
}

.bk-time-tile:disabled,
.bk-time-tile.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f4f6f8;
  border-color: #eef1f5;
  color: #b8c0ca;
  box-shadow: none;
}

@media (max-width: 480px) {
  .bk-fab {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  .bk-fab-label {
    display: none;
  }

  .bk-modal {
    right: 16px;
    left: 16px;
    bottom: 80px;
    width: auto;
    max-height: calc(100vh - 100px);
  }
}
