:root {
  --bg: #ffffff;
  --ink: #14130f;          /* почти чёрный, тёплый */
  --soft: #6f6b63;         /* приглушённый текст */
  --faint: #a6a29a;        /* подписи */
  --line: #e7e4dd;         /* тонкие линии */
  --hover: #f6f4f0;        /* лёгкая заливка */
  --busy-bg: #f4f2ee;
  --busy-ink: #b9b4ab;
  --radius: 10px;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.app > * { min-width: 0; }
.content { min-width: 0; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 22px 16px;
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.lang {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 16px;
  display: flex;
  gap: 5px;
}
.lang-btn {
  width: 36px; height: 30px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: .45;
  transition: opacity .15s, border-color .15s;
}
.lang-btn.is-active { opacity: 1; border-color: var(--ink); }
.summary {
  margin-top: 6px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  min-height: 26px;
}
.summary .sub {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--soft);
  margin-top: 4px;
}

/* ---------- Контент / экраны ---------- */
.content { flex: 1; padding: 26px 20px 28px; }
.screen { display: none; }
.screen.is-active { display: block; }
.screen.is-active > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.screen.is-active > *:nth-child(2) { animation-delay: .05s; }
.screen.is-active > *:nth-child(3) { animation-delay: .10s; }
.screen.is-active > *:nth-child(4) { animation-delay: .15s; }
.screen.is-active > *:nth-child(5) { animation-delay: .20s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-h {
  font-size: 21px;
  font-weight: 700;
  margin: 4px 0 14px;
}
.section-h + .section-h, .slots + .section-h, .days + .section-h { margin-top: 30px; }
.hint { color: var(--soft); font-size: 14px; margin: 12px 0; }
.error { color: var(--ink); font-size: 15px; font-weight: 600; margin: 12px 0; min-height: 18px; }
.error:not(:empty)::before { content: "— "; }

/* ---------- Дни ---------- */
.days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 60px;
  padding: 13px 4px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .1s;
  font-family: "Manrope", sans-serif;
}
.day .wd { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.day .dnum { font-size: 21px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.day .mon { font-size: 11px; color: var(--faint); margin-top: 1px; }
.day:hover { border-color: var(--ink); }
.day.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.day.is-selected .wd, .day.is-selected .mon { color: rgba(255,255,255,.7); }
.day.is-full { opacity: 0.4; }
.day:active { transform: scale(0.97); }

/* ---------- Слоты времени ---------- */
.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slot {
  min-height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.slot small { font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--busy-ink); }
.slot:not(.is-busy):hover { border-color: var(--ink); }
.slot:active { transform: scale(0.97); }
.slot.is-busy {
  background: var(--busy-bg);
  border-color: var(--busy-bg);
  color: var(--busy-ink);
  cursor: not-allowed;
}
.slot.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Услуги (множественный выбор) ---------- */
.services { display: flex; flex-direction: column; }
.service-group {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  margin: 22px 2px 8px;
}
.service-group:first-child { margin-top: 4px; }
.service {
  width: 100%;
  text-align: left;
  padding: 15px 15px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.service .check {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  position: relative;
  transition: border-color .15s, background .15s;
}
.service .service-name { flex: 1 1 auto; min-width: 0; text-align: left; line-height: 1.25; }
.svc-info {
  flex: 0 0 auto;
  width: 27px; height: 27px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--soft);
  font: italic 700 14px Georgia, serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.svc-info:hover { border-color: var(--ink); color: var(--ink); }
.service:hover { border-color: var(--ink); }
.service.is-selected { border-color: var(--ink); background: var(--hover); font-weight: 600; }
.service.is-selected .check { background: var(--ink); border-color: var(--ink); }
.service.is-selected .check::after {
  content: "";
  position: absolute;
  left: 8px; top: 4px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Поля ввода ---------- */
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  margin: 22px 2px 8px;
}
.field {
  width: 100%;
  padding: 15px 16px;
  font-family: "Manrope", sans-serif;
  font-size: 19px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-color: var(--ink); }
.code-input {
  text-align: center;
  letter-spacing: 16px;
  font-size: 30px;
  font-weight: 700;
  padding-left: 32px;
  font-variant-numeric: tabular-nums;
}
.dev-note {
  background: var(--hover);
  border: 1px solid var(--line);
  color: var(--soft);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin: 14px 0;
}

/* ---------- Кнопки ---------- */
.primary {
  width: 100%;
  min-height: 56px;
  margin-top: 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
}
.primary:active { transform: scale(0.985); }
.primary:disabled { background: #d8d4cc; cursor: default; }
.link {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--soft);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.link:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.back {
  background: none;
  border: none;
  color: var(--faint);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 0 0 18px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.back:hover { color: var(--ink); }

/* ---------- Нижняя панель ---------- */
.bottombar {
  position: sticky;
  bottom: 0;
  padding: 14px 20px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: linear-gradient(to top, var(--bg) 65%, rgba(255,255,255,0));
}
.bottombar .primary { margin-top: 0; }

/* ---------- Экран готово ---------- */
.done { text-align: center; padding-top: 28px; }
.check {
  width: 72px; height: 72px;
  margin: 8px auto 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-size: 32px;
  line-height: 70px;
  font-weight: 400;
}
.done-title {
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0 24px;
}
.done-card {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 2px;
  text-align: left;
}
.done-card .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.done-card .row:last-child { border-bottom: none; }
.done-card .row span:first-child { color: var(--faint); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.done-card .row span:last-child { font-size: 17px; font-weight: 600; text-align: right; max-width: 64%; }
.done-note { color: var(--soft); font-size: 15px; margin: 24px 6px; }

/* ---------- Оверлей ожидания ---------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.loading[hidden] { display: none; }
.spinner {
  width: 46px; height: 46px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* ---------- Инфо-окошко услуги ---------- */
.info-pop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 19, 15, 0.28);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadein .15s ease;
}
.info-pop[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.info-card {
  background: var(--bg);
  border-radius: 16px;
  padding: 22px 20px 18px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: rise .2s ease;
}
.info-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.info-text { font-size: 15px; color: var(--soft); line-height: 1.55; }
.info-card .primary { margin-top: 18px; min-height: 50px; }
