/**
 * DECTO precision pass — refine existing surfaces only.
 * No new theme, no extra layers, no new components.
 */

html {
  background-attachment: scroll !important;
  background-image: var(--bn-ambient-bg) !important;
  background-color: #f3f6f4 !important;
}

body,
body.app-shell,
body.index-page,
body.auth-page {
  font-family: var(--bn-font-body);
  font-size: var(--bn-text-body-size);
  font-weight: var(--bn-font-weight-regular);
  line-height: var(--bn-text-body-lh);
  color: var(--bn-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .page-title, .section-title, .bn-title-display, .bn-title-section {
  font-weight: var(--bn-font-weight-semibold);
  letter-spacing: -0.02em;
  color: var(--bn-green);
}

/* Quiet glass: readable rafts, not demo-frost */
body.app-shell .bn-feed-card,
body.app-shell .settings-card,
body.app-shell .bn-settings-card,
body.app-shell .bn-settings-panel,
body.auth-page .auth-card,
body.auth-page .auth-notebook-sheet {
  backdrop-filter: blur(12px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.08) !important;
  box-shadow: var(--bn-shadow-sm) !important;
}

/* Doctor identity: scannable, not gold-gradient */
body.doctor-profile-page .bn-profile-name,
body.doctor-profile-page .bn-profile-name.dp-name,
body.clinic-profile .bn-profile-name,
.dp-name,
.cp-name {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  letter-spacing: -0.02em !important;
  color: var(--bn-green) !important;
  -webkit-text-fill-color: var(--bn-green) !important;
  background: none !important;
  text-shadow: none !important;
}

body.doctor-profile-page .dp-specialty,
body.clinic-profile .cp-specialty,
.bn-profile-handle {
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: var(--bn-text-2) !important;
}

/* Service chips: tactile, not floating gold pills */
.dp-hero-chip,
.dp-visitor-service-chip,
.dp-service-tile,
.chip,
.pill {
  min-height: 36px;
  font-weight: 600 !important;
  font-size: 0.8125rem;
  border-radius: 14px;
}

.dp-service-tile {
  min-height: 64px;
  background: rgba(255, 255, 255, 0.62) !important;
  border: 1px solid var(--bn-border) !important;
  box-shadow: none !important;
}

.dp-service-tile i,
.dp-hero-services__title i {
  color: var(--bn-green-mid) !important;
}

/* Booking dominates; secondaries recede */
body.bn-profile--visitor #bookAppointmentBtn,
body.bn-profile--visitor #clinicBookBtn,
body.bn-profile--visitor .dp-visitor-action-tile--primary,
body.bn-profile--visitor .bn-visitor-action--primary {
  min-height: 52px !important;
  font-size: 0.9375rem !important;
  font-weight: 650 !important;
  background: var(--bn-green) !important;
  color: #faf9f5 !important;
  -webkit-text-fill-color: #faf9f5 !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(23, 56, 47, 0.16) !important;
  transition: transform var(--bn-duration-fast) var(--bn-ease), opacity var(--bn-duration-fast) ease !important;
}

body.bn-profile--visitor #bookAppointmentBtn:active,
body.bn-profile--visitor #clinicBookBtn:active,
body.bn-profile--visitor .dp-visitor-action-tile--primary:active {
  transform: scale(0.98);
}

body.bn-profile--visitor #bookAppointmentBtn i,
body.bn-profile--visitor #clinicBookBtn i,
body.bn-profile--visitor .dp-visitor-action-tile--primary i {
  color: rgba(250, 249, 245, 0.92) !important;
}

body.bn-profile--visitor .dp-visitor-action-tile:not(.dp-visitor-action-tile--primary),
body.bn-profile--visitor .bn-visitor-action:not(.bn-visitor-action--primary) {
  min-height: 52px !important;
  background: rgba(255, 255, 255, 0.48) !important;
  border: 1px solid var(--bn-border) !important;
  box-shadow: none !important;
  color: var(--bn-green) !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Auth / landing type */
body.auth-page .auth-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bn-green);
}

body.auth-page .auth-header .bn-body,
body.auth-page #loginSubtitle {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--bn-text-2);
  line-height: 1.6;
}

body.index-page .bl-hero h1,
body.index-page #bl-hero-title {
  font-weight: 700 !important;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

body.index-page .bl-hero__lead {
  font-size: 0.9375rem;
  line-height: 1.7;
  font-weight: 400;
}

/* Feed / chat density */
body.app-shell .bn-feed-card__author strong,
body.app-shell .feed-post-author-name {
  font-weight: 650 !important;
  font-size: 0.9375rem !important;
}

body.app-shell .bn-feed-card__caption,
body.app-shell .bn-feed-card__desc {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
}

body.app-shell .bn-chat-list-item {
  font-weight: 500;
}

/* Patient CTA: green primary, not champagne fill */
.patient-profile .patient-appts-cta {
  background: var(--bn-green) !important;
  color: #faf9f5 !important;
  text-shadow: none !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(23, 56, 47, 0.16) !important;
  font-weight: 650 !important;
}

/* Content never hidden under floating dock */
body.app-shell .main-content {
  padding-bottom: calc(var(--bn-dock-h, 74px) + env(safe-area-inset-bottom, 0px) + 16px);
}

body.app-shell.bn-chat-active .main-content {
  padding-bottom: calc(var(--bn-bottom-dock-h, 72px) + env(safe-area-inset-bottom, 0px));
}

/* Quiet interactions */
a, button, .bn-btn, .btn {
  transition:
    opacity var(--bn-duration-fast) ease,
    transform var(--bn-duration-fast) var(--bn-ease),
    background-color var(--bn-duration) ease,
    color var(--bn-duration) ease,
    border-color var(--bn-duration) ease,
    box-shadow var(--bn-duration) ease;
}

@media (prefers-reduced-motion: reduce) {
  body.app-shell .bn-feed-card,
  body.app-shell .app-header-icon,
  body.app-shell .bottom-nav-item,
  .decto-onboarding::before,
  .decto-smart-pick__gem {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

@media (max-width: 360px) {
  body.doctor-profile-page .bn-profile-name,
  body.doctor-profile-page .bn-profile-name.dp-name {
    font-size: 1.35rem !important;
  }
  body.bn-profile--visitor #bookAppointmentBtn,
  body.bn-profile--visitor #clinicBookBtn {
    min-height: 48px !important;
  }
}

/* Patient owner header: title / photo / name / settings must not overlap */
body.patient-profile-owner #patientOwnerHero.pp-owner-hero,
body.patient-profile-page.patient-profile-owner #patientOwnerHero {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  overflow: visible !important;
  isolation: isolate;
}
body.patient-profile-owner .pp-owner-home__top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  position: relative !important;
  z-index: 1 !important;
  min-height: 44px;
}
body.patient-profile-owner .pp-owner-home__brand {
  flex: 1 1 auto;
  min-width: 0;
}
body.patient-profile-owner .pp-owner-home__top-actions {
  display: inline-flex !important;
  flex: 0 0 auto;
  gap: 8px;
  position: relative !important;
  z-index: 1 !important;
}
body.patient-profile-owner .pp-owner-nav-btn,
body.patient-profile-owner .pp-owner-nav-btn--settings {
  position: relative !important;
  z-index: 1 !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  flex: 0 0 40px;
}
body.patient-profile-owner .pp-owner-home__identity {
  display: grid !important;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: start;
  gap: 14px !important;
  width: 100%;
  direction: rtl;
}
body.patient-profile-owner .pp-owner-avatar-wrap {
  grid-column: 1;
  width: 108px !important;
  height: 108px !important;
  position: relative !important;
  margin: 0 !important;
}
body.patient-profile-owner .pp-owner-home__copy,
body.patient-profile-owner .pp-owner-home__copy.bn-profile-identity {
  grid-column: 2;
  width: auto !important;
  min-width: 0 !important;
  text-align: start !important;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
body.patient-profile-owner #profileFullname,
body.patient-profile-owner .pp-owner-name {
  font-size: clamp(1.05rem, 4vw, 1.28rem) !important;
  line-height: 1.3 !important;
  max-width: 100%;
  overflow-wrap: anywhere;
}
body.patient-profile-owner .pp-owner-avatar-edit {
  position: absolute !important;
  inset: auto 0 0 auto;
  left: 0;
  right: auto;
  bottom: 0;
  z-index: 2 !important;
}

/* Clinic visitor photo = doctor visitor square */
body.bn-profile--visitor.clinic-profile .dp-visitor-identity__photo,
body.bn-profile--visitor.clinic-profile .clinic-visitor-avatar-wrap,
body.bn-profile--visitor.clinic-profile .dp-visitor-photo-wrap {
  display: block !important;
  flex: 0 0 132px !important;
  width: 132px !important;
  height: 132px !important;
  max-width: 132px !important;
  margin: 0 !important;
  overflow: visible !important;
  order: 2 !important;
}
body.bn-profile--visitor.clinic-profile .dp-avatar-ring--square,
body.bn-profile--visitor.clinic-profile .dp-avatar-ring--square .bn-profile-avatar,
body.bn-profile--visitor.clinic-profile .dp-avatar-ring--square img,
body.bn-profile--visitor.clinic-profile .clinic-visitor-avatar-wrap .bn-profile-avatar-ring,
body.bn-profile--visitor.clinic-profile .clinic-visitor-avatar-wrap img {
  width: 132px !important;
  height: 132px !important;
  max-width: 132px !important;
  max-height: 132px !important;
  border-radius: 16px !important;
  object-fit: cover !important;
  padding: 0 !important;
}

/* Booking + pricing: true fullscreen above dock, page behind locked */
html:has(body.bk-booking-locked),
html:has(body.dp-pricing-open),
body.bk-booking-locked,
body.dp-pricing-open,
body.bn-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
/* Never put touch-action:none on body — breaks share sheet & taps on mobile */
body.bk-booking-locked .bottom-nav,
body.bk-booking-locked .global-auth-bottom-nav,
body.dp-pricing-open .bottom-nav,
body.dp-pricing-open .global-auth-bottom-nav {
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.bk-modal.open,
.bk-modal.is-open {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2400 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
  pointer-events: auto !important;
  background: rgba(15, 36, 29, 0.62) !important;
}
.bk-modal.open .bk-modal-content,
.bk-modal.is-open .bk-modal-content {
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.bk-modal.open .bk-modal-head {
  flex: 0 0 auto;
}
.bk-modal.open #bookingModalWidget,
.bk-modal.open #clinicBookingWidgetRoot,
.bk-modal.open .bk-widget {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.bk-modal.open .bk-summary--dock {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: #fff;
}

#doctorServicePricingModal.modal,
#clinicServicePricingModal.modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2410 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
  margin: 0 !important;
  background: rgba(15, 36, 29, 0.62) !important;
  pointer-events: auto !important;
}
#doctorServicePricingModal.modal[hidden],
#clinicServicePricingModal.modal[hidden],
#doctorServicePricingModal.modal[aria-hidden="true"]:not(.open):not(.active):not(.is-open),
#clinicServicePricingModal.modal[aria-hidden="true"]:not(.open):not(.active):not(.is-open) {
  display: none !important;
}
#doctorServicePricingModal.modal.open,
#doctorServicePricingModal.modal.active,
#doctorServicePricingModal.modal.is-open,
#clinicServicePricingModal.modal.open,
#clinicServicePricingModal.modal.active,
#clinicServicePricingModal.modal.is-open {
  display: flex !important;
}
#doctorServicePricingModal .modal-content,
#clinicServicePricingModal .modal-content {
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  background: #fffaf6 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}
#doctorServicePricingModal .modal-header,
#clinicServicePricingModal .modal-header,
#doctorServicePricingModal .modal-footer,
#clinicServicePricingModal .modal-footer {
  flex: 0 0 auto;
  padding: 16px 18px;
}
#doctorServicePricingModal .modal-footer,
#clinicServicePricingModal .modal-footer {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(23, 56, 47, 0.1);
}
#doctorServicePricingModal .modal-body,
#clinicServicePricingModal .modal-body,
#doctorServicePricingModal .bn-modal__body,
#clinicServicePricingModal .bn-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: none !important;
  padding: 12px 18px 20px;
}

/* --------------------------------------------------------------------------
   Share sheet — MUST live here: bn-stability is not on the lean app CSS path
   -------------------------------------------------------------------------- */
.bn-share-sheet {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2500 !important;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: auto !important;
  touch-action: manipulation;
}
.bn-share-sheet.open {
  display: flex !important;
}
#explorePostModal .bn-share-sheet {
  position: fixed !important;
  inset: 0 !important;
  z-index: 90 !important;
}
#explorePostModal .bn-share-sheet.open {
  display: flex !important;
}
.bn-share-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 14, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.bn-share-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(88dvh, 640px);
  overflow: auto;
  background: #fffaf2 !important;
  border-radius: 22px 22px 18px 18px;
  padding: 16px 16px 18px;
  box-shadow: 0 24px 64px rgba(16, 37, 29, 0.22);
  pointer-events: auto !important;
  touch-action: manipulation;
}
.bn-share-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.bn-share-sheet-head strong {
  font-size: 1rem;
  color: #1f2424;
}
.bn-share-sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 76, 58, 0.08);
  color: #1f2424;
  cursor: pointer;
}
.bn-share-sheet-sub {
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: #626b61;
  line-height: 1.45;
}
.bn-share-sheet-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.bn-share-sheet-field span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #626b61;
}
.bn-share-sheet-field input {
  width: 100%;
  border: 1px solid rgba(15, 76, 58, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: #0f172a;
}
.bn-share-sheet-apps-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #626b61;
}
.bn-share-sheet-apps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.bn-share-app-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 8px 4px;
  border: 1px solid rgba(15, 76, 58, 0.12);
  border-radius: 14px;
  background: #fff;
  color: #1f2424;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.bn-share-app-btn i { font-size: 1.35rem; }
.bn-share-app-btn[data-share-app="whatsapp"] i { color: #25d366; }
.bn-share-app-btn[data-share-app="telegram"] i { color: #229ed9; }
.bn-share-app-btn[data-share-app="sms"] i { color: #0f4c3a; }
.bn-share-app-btn[data-share-app="email"] i { color: #c45c26; }
.bn-share-sheet-actions {
  display: grid;
  gap: 8px;
}
.bn-share-sheet-btn {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(15, 76, 58, 0.14);
  background: #fff;
  color: #1f2424;
  font: inherit;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.bn-share-sheet-btn--primary {
  background: linear-gradient(135deg, #0f4c3a, #1a6b52);
  border-color: transparent;
  color: #fff;
}
body.bn-share-open .bottom-nav,
body.bn-share-open .global-auth-bottom-nav {
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* Visitor action icons: stable grid, never pile to one side after back */
body.bn-profile--visitor .dp-visitor-action-grid,
body.bn-profile--visitor #doctorVisitorActions,
body.bn-profile--visitor #clinicVisitorActions {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  direction: rtl !important;
}
body.bn-profile--visitor .dp-visitor-action-secondary {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  direction: rtl !important;
  justify-items: stretch !important;
}
body.bn-profile--visitor .dp-visitor-action-secondary > .dp-visitor-action-tile,
body.bn-profile--visitor .dp-visitor-action-secondary > .bn-visitor-action,
body.bn-profile--visitor .dp-visitor-action-secondary > a {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  float: none !important;
  justify-self: stretch !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}
body.bn-profile--visitor .dp-visitor-action-secondary > [hidden] {
  display: none !important;
}
body.bn-profile--visitor .bn-profile-nav .dp-hero-nav-group,
body.bn-profile--visitor .bn-profile-nav-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  direction: rtl !important;
}
body.bn-profile--visitor #doctorShareBtn,
body.bn-profile--visitor #clinicShareBtn {
  display: inline-flex !important;
}

/* AI search results: no zoom / no overflow mess */
#aiSearchStudio,
.bn-ai-search-studio,
.bn-ai-search-studio__results {
  max-width: 100% !important;
  overflow-x: hidden !important;
  transform: none !important;
  zoom: normal !important;
}
.bn-ai-search-studio__input,
#aiSearchQuery {
  font-size: 16px !important;
  max-width: 100%;
}
.bn-ai-search-studio__results .bn-provider-card,
.bn-ai-search-doctors .bn-provider-card {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  transform: none !important;
}
.bn-ai-search-studio__results .bn-provider-card:has(.bn-provider-card__score),
.bn-ai-search-doctors .bn-provider-card:has(.bn-provider-card__score) {
  display: grid !important;
  grid-template-columns: 48px minmax(0, 1fr) !important;
  gap: 10px 12px !important;
  align-items: start !important;
}
.bn-ai-search-studio__results .bn-provider-card__score,
.bn-ai-search-doctors .bn-provider-card__score {
  position: static !important;
  grid-column: 1;
  grid-row: 1;
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  inset: auto !important;
  top: auto !important;
}
.bn-ai-search-studio__results .bn-provider-card__main,
.bn-ai-search-doctors .bn-provider-card__main {
  grid-column: 2;
  grid-row: 1;
  padding-inline-start: 0 !important;
  min-width: 0 !important;
}
.bn-ai-search-studio__results .bn-provider-card__services,
.bn-ai-search-studio__results .bn-provider-card__actions,
.bn-ai-search-doctors .bn-provider-card__services,
.bn-ai-search-doctors .bn-provider-card__actions {
  grid-column: 1 / -1;
}
.bn-ai-search-studio__results .bn-provider-card__avatar-col {
  width: 72px !important;
}
.bn-ai-search-studio__results .bn-provider-card__actions {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  width: 100%;
}
.bn-ai-search-studio__results .bn-provider-card__btn {
  min-width: 0;
  font-size: 0.72rem;
  padding: 0 6px;
}
