:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a90);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #2481cc);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);

  --radius: 18px;
  --small-radius: 13px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  padding: 18px 16px 120px;
  color: var(--text);

  font: 16px/1.4
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;

  overflow-x: hidden;
}

button {
  box-sizing: border-box;
  font: inherit;
  color: inherit;
}

button:active {
  transform: scale(.98);
}

button:disabled {
  cursor: default;
}


/* =========================
   APP
   ========================= */

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}


/* =========================
   HERO
   ========================= */

.hero {
  display: flex;
  align-items: center;
  gap: 14px;

  width: 100%;
  min-width: 0;

  margin: 4px 0 26px;
}

.hero-icon {
  flex: 0 0 50px;

  width: 50px;
  height: 50px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 16px;
  background: var(--bg2);

  font-size: 25px;
}

.hero-text {
  min-width: 0;
}

h1 {
  margin: 0;

  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -.03em;

  overflow-wrap: anywhere;
}

.sub {
  margin: 4px 0 0;

  color: var(--hint);
  font-size: 14px;
  line-height: 1.35;

  overflow-wrap: anywhere;
}


/* =========================
   WELCOME
   ========================= */

.welcome-card {
  width: 100%;
  min-width: 0;

  padding: 22px;

  border-radius: 22px;
  background: var(--bg2);

  overflow: hidden;
}

.welcome-icon {
  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 16px;

  border-radius: 14px;
  background: var(--bg);

  font-size: 23px;
}

.welcome-card h2 {
  margin: 0;

  font-size: 25px;
  line-height: 1.18;
  letter-spacing: -.025em;

  overflow-wrap: anywhere;
}

.welcome-card p {
  margin: 11px 0 20px;

  color: var(--hint);
  font-size: 15px;
  line-height: 1.45;

  overflow-wrap: anywhere;
}

.primary-button {
  width: 100%;

  padding: 15px 18px;

  border: 0;
  border-radius: 15px;

  background: var(--accent);
  color: var(--accent-text);

  font-size: 16px;
  font-weight: 700;

  cursor: pointer;
}


/* =========================
   BOOKING CARD
   ========================= */

.booking-card {
  width: 100%;
  min-width: 0;

  margin-top: 14px;
  padding: 18px;

  border-radius: var(--radius);
  background: var(--bg2);

  overflow: hidden;
}

.booking-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;
  min-width: 0;
}

.booking-main {
  min-width: 0;
  flex: 1;
}

.booking-time {
  margin: 5px 0 3px;

  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;

  overflow-wrap: anywhere;
}

.booking-status {
  flex: 0 0 auto;

  padding: 6px 9px;

  border-radius: 10px;
  background: var(--bg);

  color: var(--hint);

  font-size: 11px;
  font-weight: 600;

  white-space: nowrap;
}

.hint {
  margin: 0;

  color: var(--hint);
  font-size: 14px;

  overflow-wrap: anywhere;
}

.cancel-button {
  margin-top: 15px;
  padding: 6px 0;

  border: 0;
  background: none;

  color: var(--danger);

  font-size: 14px;
  font-weight: 500;

  cursor: pointer;
}


/* =========================
   SECTIONS
   ========================= */

.section {
  width: 100%;
  min-width: 0;

  margin-top: 29px;
}

.section-head {
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 3px;

  color: var(--hint);

  font-size: 12px;
  font-weight: 600;

  line-height: 1.2;

  text-transform: uppercase;
  letter-spacing: .06em;
}

.section-head h2 {
  margin: 0;

  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.02em;
}


/* =========================
   HORIZONTAL CHOICES
   ========================= */

.masters-list,
.services-list {
  display: flex;

  gap: 9px;

  width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 2px 2px 6px;

  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.chip {
  flex: 0 0 auto;

  min-width: 125px;
  max-width: 230px;

  padding: 13px 14px;

  border: 1px solid transparent;
  border-radius: var(--small-radius);

  background: var(--bg2);
  color: var(--text);

  text-align: left;

  cursor: pointer;

  overflow: hidden;
}

.chip strong {
  display: block;

  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;

  white-space: normal;
  overflow-wrap: anywhere;
}

.chip small {
  display: block;

  margin-top: 4px;

  color: var(--hint);

  font-size: 12px;
  line-height: 1.2;

  white-space: normal;
  overflow-wrap: anywhere;
}

.chip.on {
  background: var(--accent);
  color: var(--accent-text);
}

.chip.on small {
  color: inherit;
  opacity: .78;
}

.services-list .chip {
  min-width: 145px;
}


/* =========================
   CALENDAR HEADER
   ========================= */

.calendar-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 12px;
}

.month-switcher {
  display: flex;
  align-items: center;
  gap: 5px;

  flex: 0 0 auto;
}

#month-title {
  min-width: 110px;

  text-align: center;

  font-size: 14px;
  font-weight: 600;

  text-transform: capitalize;
}

.month-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 34px;
  height: 34px;

  padding: 0;

  border: 0;
  border-radius: 10px;

  background: var(--bg2);

  font-size: 25px;
  line-height: 1;

  cursor: pointer;
}


/* =========================
   CALENDAR
   ========================= */

.calendar {
  width: 100%;
  min-width: 0;

  padding: 13px;

  border-radius: var(--radius);
  background: var(--bg2);

  overflow: hidden;
}

.weekdays,
.calendar-grid {
  display: grid;

  grid-template-columns: repeat(7, minmax(0, 1fr));

  gap: 5px;
}

.weekdays {
  margin-bottom: 7px;
}

.weekdays span {
  color: var(--hint);

  font-size: 11px;
  font-weight: 600;

  text-align: center;
}

.calendar-day {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;

  padding: 0;

  border: 0;
  border-radius: 11px;

  background: transparent;
  color: var(--text);

  font-size: 14px;
  font-weight: 500;

  cursor: pointer;
}

.calendar-day:hover:not(:disabled) {
  background: var(--bg);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.calendar-day.on {
  background: var(--accent);
  color: var(--accent-text);
}

.calendar-day.disabled {
  opacity: .25;
}

.calendar-day:disabled {
  cursor: default;
}

.empty-day {
  pointer-events: none;
}


/* =========================
   TIME
   ========================= */

.time-section {
  margin-top: 30px;
}

.time-grid {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 9px;

  width: 100%;
}

.slot {
  width: 100%;
  min-width: 0;
  min-height: 46px;

  padding: 11px 5px;

  border: 1px solid transparent;
  border-radius: var(--small-radius);

  background: var(--bg2);
  color: var(--text);

  font-size: 15px;
  font-weight: 500;

  font-variant-numeric: tabular-nums;
  text-align: center;

  cursor: pointer;
}

.slot.on {
  background: var(--accent);
  color: var(--accent-text);
}

.slot:disabled {
  opacity: .3;
  text-decoration: line-through;
  cursor: default;
}

.empty {
  grid-column: 1 / -1;

  margin: 0;
  padding: 20px 4px;

  color: var(--hint);

  font-size: 14px;
  text-align: center;

  overflow-wrap: anywhere;
}


/* =========================
   BOOKING HEADER
   ========================= */

.booking-header {
  display: flex;
  align-items: center;

  gap: 12px;

  margin: 3px 0 28px;
}

.booking-header h1 {
  font-size: 25px;
}

.back-button {
  flex: 0 0 auto;

  display: flex;
  align-items: center;

  padding: 8px 10px 8px 0;

  border: 0;
  background: none;

  color: var(--accent);

  font-size: 15px;
  font-weight: 500;

  cursor: pointer;
}


/* =========================
   BOTTOM BUTTON
   ========================= */

.bottom-bar {
  position: fixed;
  z-index: 20;

  left: 0;
  right: 0;
  bottom: 0;

  padding:
    10px
    max(16px, env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));

  background: var(--bg);

  border-top: 1px solid var(--bg2);
}

.book-button {
  display: block;

  width: 100%;
  max-width: 560px;

  margin: 0 auto;

  padding: 15px 18px;

  border: 0;
  border-radius: 16px;

  background: var(--accent);
  color: var(--accent-text);

  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;

  cursor: pointer;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-button:disabled {
  opacity: .45;
  cursor: default;
}


/* =========================
   FOCUS
   ========================= */

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}


/* =========================
   ПК
   ========================= */

@media (min-width: 700px) {
  body {
    padding-top: 28px;
  }

  .app {
    max-width: 600px;
  }

  .welcome-card {
    padding: 28px;
  }

  .welcome-card h2 {
    font-size: 28px;
  }

  .masters-list,
  .services-list {
    scrollbar-width: auto;
  }

  .calendar {
    padding: 16px;
  }

  .calendar-grid,
  .weekdays {
    gap: 7px;
  }

  .calendar-day {
    border-radius: 12px;
  }
}


/* =========================
   МАЛЕНЬКИЕ ЭКРАНЫ
   ========================= */

@media (max-width: 380px) {
  body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .welcome-card {
    padding: 18px;
  }

  .welcome-card h2 {
    font-size: 23px;
  }

  .calendar {
    padding: 10px;
  }

  .weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    border-radius: 9px;
    font-size: 13px;
  }

  #month-title {
    min-width: 95px;
    font-size: 13px;
  }

  .month-button {
    width: 31px;
    height: 31px;
  }
}