/* ---------- Шрифты: лежат на нашем сервере, без Google Fonts ---------- */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/unbounded-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/unbounded-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/unbounded-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/unbounded-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ---------- Токены ---------- */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #66706b;
  --line: #dadfdc;
  --accent: #1d5a44;        /* бутылочно-зелёный, как кожа барберского кресла */
  --accent-ink: #ffffff;
  --accent-soft: #e2ede7;
  --brass: #b5832f;         /* «ваша запись» */
  --danger: #b3261e;
  --hatch: #e3e6e4;

  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;

  --r-sheet: 22px;
  --r-tile: 14px;
  --r-pill: 999px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111614;
    --surface: #19201d;
    --ink: #e7ecea;
    --muted: #93a09a;
    --line: #2a3430;
    --accent: #5fb892;
    --accent-ink: #0d1a14;
    --accent-soft: #1f3129;
    --brass: #d9a653;
    --danger: #f2827a;
    --hatch: #232c28;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111614;
  --surface: #19201d;
  --ink: #e7ecea;
  --muted: #93a09a;
  --line: #2a3430;
  --accent: #5fb892;
  --accent-ink: #0d1a14;
  --accent-soft: #1f3129;
  --brass: #d9a653;
  --danger: #f2827a;
  --hatch: #232c28;
  color-scheme: dark;
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.top, .view { max-width: 560px; margin: 0 auto; padding-inline: var(--gutter); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 14px;
}
.brand {
  font: 700 17px/1.2 var(--font-display);
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* На главной название уже крупно в заголовке — в шапке не дублируем */
.is-home .brand { visibility: hidden; }
.top-nav { display: flex; gap: 16px; flex: 0 0 auto; }
.top-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.top-nav a[aria-current="page"] { color: var(--accent); }
/* Внутри Telegram шапка не нужна: есть заголовок и кнопка «Назад» самого Telegram */
.in-tg .top { display: none; }
.in-tg .view { padding-top: 12px; }

.view { padding-bottom: 48px; }

h1 { font: 700 26px/1.15 var(--font-display); letter-spacing: -0.02em; margin: 8px 0 6px; }
h2 { font: 600 18px/1.3 var(--font-body); margin: 32px 0 10px; }
.muted { color: var(--muted); }
.lead { margin: 0; color: var(--muted); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 0; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn-block { width: 100%; }
.btn-quiet {
  background: transparent; color: var(--accent); padding: 0 6px; min-height: 40px;
}
.btn-danger { color: var(--danger); }

/* ---------- Главная ---------- */
.hero { padding-top: 8px; }
.hero .facts { margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); }

.nearest { margin-top: 28px; }
.nearest-day { margin: 0 0 10px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.services { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.service {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.service-photo {
  width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--hatch);
}
.service-photo.empty {
  display: grid; place-items: center;
  font: 700 22px/1 var(--font-display); color: var(--muted);
}
.service-title { font-weight: 600; }
.service-meta { color: var(--muted); font-size: 14px; }
.service-price { font-weight: 600; white-space: nowrap; }

.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  scrollbar-width: none; scroll-padding-inline: var(--gutter);
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  flex: 0 0 auto; width: 150px; height: 190px; object-fit: cover;
  border-radius: 12px; scroll-snap-align: start; background: var(--hatch);
}

/* ---------- Выбор дня ---------- */
.service-head { margin-bottom: 18px; }
.service-head .lead { font-size: 15px; }

.month { margin: 0 0 8px; font-weight: 600; text-transform: capitalize; }
.days {
  display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity;
  margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scrollbar-width: none; scroll-padding-inline: var(--gutter);
}
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 52px; display: grid; justify-items: center; gap: 2px;
  padding: 8px 0 10px; border: 1px solid var(--line); border-radius: var(--r-tile);
  background: var(--surface); cursor: pointer; scroll-snap-align: start;
}
.day-wd { font-size: 12px; color: var(--muted); }
.day-num { font: 500 18px/1.1 var(--font-display); }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day[aria-pressed="true"] .day-wd { color: inherit; opacity: .8; }
.day:disabled { background: transparent; border-style: dashed; color: var(--muted); cursor: default; }
.day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day[aria-pressed="true"] .dot { background: var(--accent-ink); }
.day .dot.none { visibility: hidden; }

/* ---------- Сетка часов — главный элемент ---------- */
.hours {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 18px;
}
@media (min-width: 420px) { .hours { grid-template-columns: repeat(4, 1fr); } }

.hour {
  position: relative;
  display: flex; align-items: baseline; justify-content: center;
  height: 74px; border-radius: var(--r-tile);
  border: 1.5px solid var(--accent); background: var(--surface); color: var(--ink);
  cursor: pointer; padding: 0; text-decoration: none;
}
.hour .h { font: 700 30px/74px var(--font-display); letter-spacing: -0.03em; }
.hour .m { font: 500 13px/1 var(--font-display); margin-left: 1px; color: var(--muted); }
.hour.free:hover, .hour[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.hour.free:hover .m, .hour[aria-pressed="true"] .m { color: inherit; opacity: .75; }

.hour.busy {
  border-color: transparent; color: var(--muted); cursor: default;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 6px, transparent 6px 12px), var(--surface);
}
.hour.no_fit { border: 1.5px dashed var(--line); color: var(--muted); cursor: default; background: transparent; }
.hour.past { border-color: transparent; color: var(--muted); opacity: .4; cursor: default; background: transparent; }
.hour.past .m, .hour.no_fit .m, .hour.busy .m { color: inherit; }
.hour.mine { border-color: var(--brass); background: var(--brass); color: var(--accent-ink); cursor: default; }
.hour.mine .m { color: inherit; opacity: .8; }

.chips .hour { width: 86px; height: 56px; }
.chips .hour .h { font-size: 22px; line-height: 56px; }

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; padding: 0; list-style: none;
  font-size: 13px; color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend .l-free { border: 1.5px solid var(--accent); }
.legend .l-busy { background: repeating-linear-gradient(135deg, var(--hatch) 0 3px, var(--surface) 3px 6px); }
.legend .l-nofit { border: 1.5px dashed var(--line); }
.legend .l-mine { background: var(--brass); }

.closed { margin-top: 24px; color: var(--muted); }

/* ---------- Шторка ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgb(0 0 0 / .18);
  animation: sheet-in .22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet .grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet-when { margin: 0; color: var(--muted); }
.sheet-time { font: 700 34px/1.15 var(--font-display); letter-spacing: -0.03em; margin: 2px 0 4px; }
.sheet-service { margin: 0 0 16px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 14px; }
.field input {
  min-height: 50px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg); font-size: 18px; letter-spacing: .02em;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 13px; color: var(--muted); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 18px; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: 0 0 auto; }

.error { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }

/* ---------- Успех ---------- */
.done { padding-top: 24px; }
.ticket {
  margin: 18px 0 24px; padding: 18px 20px; border-radius: 18px;
  background: var(--accent-soft);
}
.ticket .sheet-time { font-size: 30px; }

/* ---------- Мои записи ---------- */
.bookings { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.booking {
  display: grid; grid-template-columns: 58px 1fr; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.b-date { text-align: center; }
.b-day { font: 700 28px/1 var(--font-display); letter-spacing: -0.03em; }
.b-month { font-size: 13px; color: var(--muted); }
.b-time { font-weight: 600; }
.b-status { font-size: 13px; color: var(--muted); }
.b-status.ok { color: var(--accent); }
.b-actions { display: flex; gap: 4px; margin: 6px 0 0 -6px; }

.empty-state { margin-top: 28px; }
.empty-state p { color: var(--muted); }

/* ---------- Вход ---------- */
.login { padding-top: 16px; }
.login .steps { padding-left: 20px; color: var(--muted); }
.waiting { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Мелочи ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 20; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 15px;
}
.back { display: inline-block; margin-bottom: 4px; color: var(--muted); text-decoration: none; font-size: 15px; }
.in-tg .back { display: none; }
.skeleton { height: 74px; border-radius: var(--r-tile); background: var(--hatch); }
.prose { max-width: 66ch; }
.prose p { margin: 0 0 12px; }

/* ---------- Формы (общие) ---------- */
.field select, .field textarea {
  min-height: 50px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg); font-size: 16px; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.4; }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.visually-hidden:focus-visible + *, label:has(+ .visually-hidden:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.choices { border: 0; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.choices legend { font-weight: 500; font-size: 14px; margin-bottom: 6px; padding: 0; }
.choices.inline { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer;
}
.choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.choice .muted { flex-basis: 100%; padding-left: 28px; font-size: 14px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Мастер: навигация ---------- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 4px calc(var(--gutter) * -1) 18px; padding: 0 var(--gutter);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; padding: 8px 14px; border-radius: var(--r-pill);
  color: var(--ink); text-decoration: none; font-weight: 500; background: var(--surface); border: 1px solid var(--line);
}
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.banner {
  margin-bottom: 18px; padding: 14px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--brass) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent);
}
.banner p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; }
.banner ul { margin: 0; padding-left: 18px; font-size: 15px; }

/* ---------- Мастер: день ---------- */
.day.off { background: transparent; border-style: dashed; color: var(--muted); }
.day.off[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.day.today .day-wd { color: var(--accent); font-weight: 700; }
.day.today[aria-pressed="true"] .day-wd { color: inherit; }
.day-count { font-size: 12px; font-weight: 600; min-height: 16px; color: var(--accent); }
.day[aria-pressed="true"] .day-count { color: inherit; }
.day-note { margin: -4px 0 8px; color: var(--muted); }
.day-note .btn-quiet { padding: 0; min-height: 32px; }

.timeline { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.a-time { font: 700 18px/1.3 var(--font-display); letter-spacing: -0.02em; }
.a-end { display: block; font: 500 13px/1.3 var(--font-body); color: var(--muted); letter-spacing: 0; }
.free-row { padding: 4px 0; align-items: center; }
.free-row .a-time { color: var(--muted); font-weight: 500; }
.free-row .btn-quiet { padding: 0; }
.a-booking { background: var(--surface); margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); border-left: 4px solid var(--accent); }
.a-booking.status-completed { border-left-color: var(--line); }
.a-booking.status-no_show { border-left-color: var(--danger); }
.a-booking.status-no_show .a-client { text-decoration: line-through; text-decoration-color: var(--danger); }
.a-client { font-weight: 600; font-size: 17px; }
.a-phone { display: inline-block; margin: 2px 0; font-weight: 500; }
.a-service { color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 13px;
  background: var(--hatch); color: var(--muted);
}
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.seg { display: inline-flex; margin-top: 10px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 500; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[data-visit="completed"][aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button[data-visit="no_show"][aria-pressed="true"] { background: var(--danger); color: #fff; }

/* ---------- Мастер: фото ---------- */
.photo-grid { list-style: none; margin: 12px 0 16px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 480px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
.photo-grid li { position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; display: block; background: var(--hatch); }
.cover-tag { position: absolute; top: 8px; left: 8px; }
.photo-actions .btn-quiet { padding: 0; min-height: 36px; font-size: 14px; }
.photo-del {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}

/* ---------- Мастер: расписание ---------- */
.hours-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { position: relative; }
.wd input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.wd span {
  display: grid; place-items: center; height: 46px; border-radius: 12px;
  border: 1.5px dashed var(--line); color: var(--muted); font-weight: 500;
}
.wd input:checked + span { border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.wd input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.daysoff { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--line); }
.daysoff li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.off-form { display: grid; gap: 4px; margin-top: 12px; }
.off-form .btn { justify-self: start; }

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