/* ---------- токены ---------- */
/* Фон страницы и карточки берутся из темы Telegram (запасные значения — вне Telegram).
   Единственный акцентный цвет меняется одной переменной --accent. */
:root {
  --accent: #d6457a;
  --accent-soft: #fbe7ef;
  --accent-ink: #ffffff;

  --bg: var(--tg-theme-secondary-bg-color, #f6f3f5);
  --surface: var(--tg-theme-bg-color, #ffffff);
  --surface-2: #f1ecef;
  --text: var(--tg-theme-text-color, #1e1b1f);
  --hint: var(--tg-theme-hint-color, #7d7581);
  --line: rgba(30, 27, 31, 0.08);
  --danger: #d64545;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 10, 20, 0.05), 0 8px 24px rgba(20, 10, 20, 0.06);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-soft: #3a1f2b;
    --bg: var(--tg-theme-secondary-bg-color, #141215);
    --surface: var(--tg-theme-bg-color, #1e1b20);
    --surface-2: #28242b;
    --text: var(--tg-theme-text-color, #f2edf1);
    --hint: var(--tg-theme-hint-color, #a097a3);
    --line: rgba(255, 255, 255, 0.09);
    --danger: #ef7d7d;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --accent-soft: #3a1f2b;
  --bg: var(--tg-theme-secondary-bg-color, #141215);
  --surface: var(--tg-theme-bg-color, #1e1b20);
  --surface-2: #28242b;
  --text: var(--tg-theme-text-color, #f2edf1);
  --hint: var(--tg-theme-hint-color, #a097a3);
  --line: rgba(255, 255, 255, 0.09);
  --danger: #ef7d7d;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin-bottom: 14px; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }
.muted { color: var(--hint); font-size: 14px; }

/* ---------- шапка ---------- */
.hero {
  position: relative;
  display: flex;
  min-height: 260px;
  margin: 12px 12px 0;
  border-radius: 26px;
  overflow: hidden;
  background: var(--accent-soft);
  color: #fff;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(40, 10, 25, 0.1) 0%, rgba(40, 10, 25, 0.78) 100%);
}
.hero-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  margin-top: auto;
  padding: 22px;
}
.hero h1 { font-size: 30px; margin-top: 6px; }
.hero p { font-size: 14px; opacity: 0.92; }
.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 700;
}

.notice {
  margin: 14px 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

main { max-width: 560px; margin: 0 auto; padding: 20px 16px 8px; }

/* ---------- шаги ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background 0.3s; }
.steps i.on { background: var(--accent); }

.step { margin-bottom: 28px; animation: rise 0.35s var(--ease); }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- услуги ---------- */
.services { display: flex; flex-direction: column; gap: 10px; }
.service {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto 24px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.15s var(--ease);
}
.service:active { transform: scale(0.98); }
.service.selected { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.service .icon {
  grid-row: 1 / span 2;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent); /* значки пака белые, им нужен тёмный/насыщенный фон */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  font-size: 22px;
}
.service .name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.service .meta { color: var(--hint); font-size: 13px; }
.service .price { grid-column: 3; grid-row: 1 / span 2; font-weight: 800; font-size: 15px; }
/* круглый индикатор выбора справа */
.service::after {
  content: "";
  grid-column: 4;
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.service.selected::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface);
}

/* ---------- лента дней ---------- */
.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day {
  flex: none;
  width: 62px;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  scroll-snap-align: start;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.day:active { transform: scale(0.95); }
.day-w { font-size: 12px; color: var(--hint); text-transform: capitalize; }
.day-n { font-size: 20px; font-weight: 800; }
.day-m { font-size: 11px; color: var(--hint); }
.day.today .day-n { color: var(--accent); }
.day.selected { background: var(--accent); color: var(--accent-ink); }
.day.selected .day-w, .day.selected .day-m, .day.selected .day-n { color: rgba(255, 255, 255, 0.9); }

/* ---------- время ---------- */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.slot:active { transform: scale(0.96); }
.slot.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- подтверждение ---------- */
.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
textarea {
  width: 100%;
  min-height: 48px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
textarea { min-height: 88px; resize: vertical; }

button.primary {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(214, 69, 122, 0.28);
  transition: transform 0.08s, opacity 0.2s;
}
button.primary:active { transform: scale(0.98); }
button.primary:disabled { opacity: 0.45; pointer-events: none; }
/* главная кнопка не уходит за нижнюю панель */
#step-confirm button.primary { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 5; }

/* ---------- готово ---------- */
.done { text-align: center; padding: 28px 8px; }
.done-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 34px;
}
.done h2 { margin-bottom: 8px; }
.done p { margin-bottom: 24px; line-height: 1.5; }

/* ---------- списки записей ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-item > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-title { font-weight: 800; font-size: 15px; }
.day-title {
  margin: 14px 2px 0;
  color: var(--hint);
  font-size: 13px;
  font-weight: 700;
}
.day-title::first-letter { text-transform: uppercase; }
.day-title:first-child { margin-top: 0; }
.ghost {
  flex: none;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--line);
}
.ghost:not(.danger) { color: var(--accent); }
.ghost:active { background: var(--surface-2); }

.card-item.stack { flex-direction: column; align-items: stretch; }
.card-item > .card-actions { gap: 6px; align-items: stretch; flex: none; }
.card-actions .ghost { width: 100%; }

.badge {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

/* предложение переноса, которое клиент видит в «Моих записях» */
.card-item > .proposal {
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--accent-soft);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
button.primary.small { width: auto; height: 40px; padding: 0 16px; font-size: 14px; box-shadow: none; }

/* ---------- окно «Предложить перенос» ---------- */
body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  animation: slide-up 0.3s var(--ease);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; }
.sheet-label { margin: 18px 0 8px; font-size: 14px; font-weight: 800; }
.sheet-note { margin: 14px 0 12px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

footer { padding: 8px 16px 20px; text-align: center; color: var(--hint); font-size: 12px; }
footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- нижняя панель ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--hint);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  transition: color 0.2s;
}
.tab .ico {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.active { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
