:root {
  --bw-bg-main: #f5efdb;
  --bw-bg-chip: #efe7d3;
  --bw-text-main: #4a4136;
  --bw-text-muted: #7f7466;
  --bw-accent: #ff7a4a;
  --bw-radius-chip: 16px;
  --bw-radius-card: 14px;
  --bw-radius-button: 28px;
}

.bw-widget {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: var(--bw-bg-main);
  border-radius: 16px;
  color: var(--bw-text-main);
  font-family: "Inter", "Arial", sans-serif;
  box-sizing: border-box;
  padding: 16px;
}

/* Force border-box across the whole widget subtree. Some hosts (e.g. Tilda)
   set a global `*{box-sizing:content-box}` which otherwise leaks into the
   widget's children, making `width:100%` elements (like the submit button)
   wider than their container. The class scope outranks the host's `*` rule. */
.bw-widget,
.bw-widget *,
.bw-widget *::before,
.bw-widget *::after {
  box-sizing: border-box;
}

.bw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 22, 16, 0.55);
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.bw-overlay[hidden] {
  display: none;
}

.bw-popup {
  width: min(100%, 440px);
  max-height: 94vh;
  overflow: auto;
  scrollbar-width: none;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.bw-popup::-webkit-scrollbar {
  display: none;
}

.bw-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #4a4136;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.bw-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.bw-photo {
  width: 110px;
  height: 110px;
  border-radius: 12px;
  object-fit: cover;
  background: #ddd;
}

.bw-name {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
}

.bw-subtitle,
.bw-price {
  margin: 6px 0 0;
  color: var(--bw-text-main);
  font-size: 16px;
}

.bw-price {
  margin-top: 10px;
}

.bw-duration-note {
  margin: 8px 0 0;
  color: var(--bw-text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.bw-services-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.bw-service-tab {
  border: 0;
  border-radius: 999px;
  background: var(--bw-bg-chip);
  color: var(--bw-text-main);
  min-height: 34px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.bw-service-tab.is-selected {
  background: var(--bw-accent);
}

.bw-legal-note,
.bw-legal-footnote {
  margin: 10px 0 0;
  color: var(--bw-text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.bw-legal-footnote {
  margin-top: 4px;
}

.bw-calendar {
  margin-top: 14px;
  margin-bottom: 16px;
}

.bw-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.bw-cal-title {
  font-weight: 600;
  font-size: 20px;
  text-align: center;
  flex: 1;
}

.bw-cal-arrow {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--bw-bg-chip);
  color: var(--bw-text-main);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.bw-cal-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

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

.bw-cal-weekdays {
  margin-bottom: 6px;
}

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

.bw-cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-size: 16px;
  border-radius: 12px;
  box-sizing: border-box;
}

.bw-cal-empty {
  background: transparent;
}

button.bw-cal-day {
  border: 0;
  font-family: inherit;
  font-weight: 500;
}

.bw-cal-day.is-available {
  background: var(--bw-bg-chip);
  color: var(--bw-text-main);
  cursor: pointer;
}

.bw-cal-day.is-selected {
  background: var(--bw-accent);
  color: #3f3429;
  font-weight: 700;
}

.bw-cal-day.is-disabled {
  background: transparent;
  color: var(--bw-text-muted);
  opacity: 0.4;
  cursor: default;
}

.bw-section {
  margin-top: 10px;
}

.bw-section-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.bw-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.bw-slot {
  min-height: 38px;
  border-radius: 24px;
  border: 0;
  background: var(--bw-bg-chip);
  color: var(--bw-text-main);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.bw-slot.is-selected {
  background: var(--bw-accent);
}

.bw-slot:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bw-footer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bw-bg-main) 75%, rgba(245, 239, 219, 0));
  padding-top: 14px;
}

.bw-submit {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: var(--bw-radius-button);
  background: var(--bw-accent);
  color: #5c4336;
  font-size: 21px;
  font-weight: 500;
  cursor: pointer;
}

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

.bw-error {
  margin-top: 10px;
  color: #9b3b25;
  font-size: 14px;
}

.bw-notice {
  margin: 18px 0;
  padding: 8px 4px;
  color: var(--bw-text-main);
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
}

.bw-skeleton-block,
.bw-skeleton-line,
.bw-skeleton-cal-cell,
.bw-skeleton-slot {
  position: relative;
  overflow: hidden;
  background: rgba(127, 116, 102, 0.22);
}

.bw-skeleton-block::after,
.bw-skeleton-line::after,
.bw-skeleton-cal-cell::after,
.bw-skeleton-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: bw-skeleton-shimmer 1.2s infinite;
}

.bw-skeleton-texts {
  width: 100%;
  padding-top: 6px;
}

.bw-skeleton-line {
  border-radius: 8px;
  height: 16px;
  margin-bottom: 10px;
}

.bw-skeleton-name {
  width: 70%;
  height: 22px;
}

.bw-skeleton-subtitle {
  width: 88%;
}

.bw-skeleton-price {
  width: 48%;
}

.bw-skeleton-cal-title {
  width: 150px;
  height: 24px;
  border-radius: 10px;
  margin: 0 auto;
}

.bw-skeleton-cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
}

.bw-skeleton-slot {
  height: 48px;
  border-radius: 24px;
}

@keyframes bw-skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 400px) {
  .bw-name {
    font-size: 18px;
  }
  .bw-section-title {
    font-size: 18px;
  }
  .bw-slot {
    font-size: 14px;
    min-height: 34px;
  }
  .bw-cal-grid {
    gap: 4px;
  }
  .bw-cal-cell {
    font-size: 14px;
    border-radius: 10px;
  }
  .bw-cal-title {
    font-size: 18px;
  }
}
