/* ПилоТаж — мини-приложение мастера. Палитра «слива» по брендбуку:
   картон #F7F1F4, плашки #F1E7EC, слива #6B3956, глубокая #542B43, графит #33252E, пепел #76626C, шампань #AE8B55.
   Заголовки — антиква (Prata, если положат файл; иначе системная), текст — Manrope. */
@font-face { font-family: "Manrope"; src: url("/static/fonts/manrope-cyrillic-c9a5f1.woff2") format("woff2");
  font-weight: 200 800; font-display: swap; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; src: url("/static/fonts/manrope-latin-814019.woff2") format("woff2");
  font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20BD; }

:root {
  --bg: #F7F1F4; --card: #FFFFFF; --soft: #F1E7EC; --line: #E6D8DF;
  --plum: #6B3956; --deep: #542B43; --ink: #33252E; --ash: #76626C; --gold: #AE8B55;
  --ok: #2F6B4F; --warn: #A2542A; --danger: #9B2C3C;
  --on-plum: #FFFFFF;
  --serif: "Prata", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px; --r-s: 8px;
  --pad: clamp(14px, 4vw, 24px);
  --tabs-h: 62px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1A1317; --card: #251B21; --soft: #2E222A; --line: #3B2C35;
  --plum: #C48AAB; --deep: #E2B9CF; --ink: #F3E9EE; --ash: #B5A0AB; --gold: #CDAE7C;
  --ok: #7FC4A1; --warn: #E3A27A; --danger: #E58796;
  --on-plum: #1A1317;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh; padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--plum); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* --- шапка: значок-аватар перед словом «ПилоТаж» на каждом экране (правило Дениса) --- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; }
.logo-word { font: 24px/1 var(--serif); letter-spacing: .01em; }
.top-ctx { font-size: 12px; color: var(--ash); text-align: right; }
.demo-bar {
  background: var(--deep); color: var(--bg); font-size: 13px; padding: 8px var(--pad);
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.demo-bar button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 999px; padding: 4px 12px; cursor: pointer; }

.view { padding: 18px var(--pad) 28px; width: 100%; max-width: 1280px; margin: 0 auto; }
.loading { color: var(--ash); padding: 40px 0; text-align: center; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; color: var(--ink); }
h1 { font-size: clamp(28px, 7vw, 36px); line-height: 1.1; }
h2 { font-size: 22px; margin: 26px 0 12px; }
h3 { font-size: 18px; }
.sub { color: var(--ash); font-size: 13px; margin: 4px 0 0; }
.muted { color: var(--ash); }
.small { font-size: 13px; }
.label { font-size: 12px; color: var(--ash); margin: 16px 0 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.price { font-weight: 700; white-space: nowrap; }
.stack > * + * { margin-top: 10px; }

/* --- плашки и кнопки --- */
.card { background: var(--soft); border-radius: var(--r); padding: 14px 16px; }
.card.white { background: var(--card); border: 1px solid var(--line); }
.card.link { cursor: pointer; }
.card .t { font-weight: 700; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px;
  border-radius: var(--r-s); border: 1px solid var(--plum); background: var(--plum); color: var(--on-plum);
  font-weight: 700; cursor: pointer; padding: 10px 16px; text-decoration: none; touch-action: manipulation;
}
.btn.ghost { background: transparent; color: var(--plum); }
.btn.soft { background: var(--soft); border-color: var(--soft); color: var(--plum); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.sm { min-height: 36px; width: auto; padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn + .btn { margin-top: 0; }
.linkbtn { background: none; border: 0; color: var(--plum); font-weight: 700; cursor: pointer; padding: 0; font-size: 13px; }
.plus {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--plum); color: var(--on-plum);
  font-size: 20px; line-height: 1; cursor: pointer; flex: none;
}

/* --- выборы: сегменты, чипы, чекбоксы, счётчики --- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 10px 6px; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--soft); color: var(--plum); font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: var(--r-s); padding: 8px 12px;
  cursor: pointer; white-space: nowrap; font-size: 13px;
}
.chip[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; flex: none; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--plum); }
.opt {
  display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: var(--r-s);
  padding: 12px 14px; cursor: pointer; user-select: none;
}
.opt + .opt { margin-top: 8px; }
.opt input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--plum); margin: 0; flex: none; }
.opt .grow small { display: block; color: var(--ash); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 16px; }
.stepper output { min-width: 22px; text-align: center; font-weight: 700; }

input[type="text"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-s); padding: 11px 12px;
  font-size: 16px; /* меньше 16 — iOS приближает страницу при вводе */
}
textarea { min-height: 84px; resize: vertical; }
.field + .field { margin-top: 10px; }
.field label { display: block; font-size: 12px; color: var(--ash); margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ash); margin-top: 12px; }
.check input { width: 20px; height: 20px; accent-color: var(--plum); margin: 0; flex: none; }

/* --- главная --- */
.hero { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--soft); color: var(--plum); flex: none;
  display: grid; place-items: center; font: 26px var(--serif);
}
.near { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.near .when { font-size: 18px; font-weight: 700; }
.badge { font-size: 11px; background: var(--card); color: var(--plum); border-radius: 6px; padding: 4px 8px; white-space: nowrap; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100px, 30%), 1fr)); gap: 8px; }
.thumbs img, .ph { aspect-ratio: 1; object-fit: cover; border-radius: var(--r-s); width: 100%; background: var(--soft); }
.places { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
details.faq { background: var(--soft); border-radius: var(--r-s); padding: 12px 14px; }
details.faq + details.faq { margin-top: 8px; }
details.faq summary { cursor: pointer; font-weight: 700; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq p { margin: 8px 0 0; color: var(--ash); }

/* --- запись: лента дней, сетка времени --- */
.days { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad)); padding: 2px var(--pad) 6px; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none; width: 48px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--card);
  padding: 6px 0 8px; text-align: center; cursor: pointer;
}
.day small { display: block; font-size: 11px; color: var(--ash); }
.day b { font-size: 18px; font-weight: 600; }
.day i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--plum); margin: 3px auto 0; }
.day[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.day[aria-pressed="true"] small { color: inherit; opacity: .8; }
.day[aria-pressed="true"] i { background: var(--on-plum); }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.time { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-s); padding: 10px 4px; cursor: pointer; text-align: center; }
.time small { display: block; font-size: 10px; color: var(--ash); }
.time[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.time[aria-pressed="true"] small { color: inherit; }
.svc-cat { margin-top: 14px; }
.sticky-cta {
  position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; margin-top: 18px;
  background: var(--bg); padding-top: 8px; box-shadow: 0 -12px 12px -8px var(--bg);
}
.total { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.total .sum { font: 30px/1 var(--serif); }
.total small { color: var(--ash); font-size: 12px; display: block; }
.upload-ref { display: flex; align-items: center; gap: 12px; }
.upload-ref img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }

/* --- работы --- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(160px, 45%), 1fr)); }
.work { position: relative; }
.work img { aspect-ratio: 4/5; object-fit: cover; border-radius: var(--r); width: 100%; background: var(--soft); }
.work .heart {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--plum); cursor: pointer; display: grid; place-items: center;
}
.work .heart svg { width: 16px; height: 16px; }
.work .heart[aria-pressed="true"] svg { fill: var(--plum); }
.work .cap { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 6px; font-size: 13px; }
.work .cap b { font-weight: 600; }
.work .same { font-size: 12px; font-weight: 700; color: var(--plum); background: none; border: 0; padding: 0; cursor: pointer; }
.empty { text-align: center; color: var(--ash); padding: 30px 10px; }

/* --- магазин --- */
.product { background: var(--soft); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.product .pimg { aspect-ratio: 1; border-radius: var(--r-s); background: var(--card); display: grid; place-items: center; overflow: hidden; }
.product .pimg img { width: 100%; height: 100%; object-fit: cover; }
.product .pname { font-size: 13px; }
.product .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.cart-bar {
  position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); margin-top: 16px; z-index: 5;
}
.qty { display: inline-flex; align-items: center; gap: 8px; }

/* --- кабинет --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 46%), 1fr)); gap: 10px; }
.tile { background: var(--soft); border-radius: var(--r); padding: 14px; }
.tile b { font: 24px/1.1 var(--serif); display: block; }
.tile small { color: var(--ash); font-size: 12px; }
.visit { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.visit .vimg { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--soft); flex: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--plum); margin-right: 5px; vertical-align: 0; }
.tag { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--soft); color: var(--plum); }
.tag.gold { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--ink); }
.tag.ok { color: var(--ok); }
.tag.warn { color: var(--warn); }

/* --- нижние вкладки --- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 11px;
  color: var(--ash); text-decoration: none; min-height: var(--tabs-h);
}
.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tabs a[aria-current="page"] { color: var(--plum); font-weight: 700; }

/* --- нижний лист и уведомление --- */
.sheet-back { position: fixed; inset: 0; background: rgb(20 10 16 / .45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg); border-radius: 18px 18px 0 0;
  max-height: 88dvh; overflow-y: auto; padding: 8px var(--pad) calc(18px + env(safe-area-inset-bottom));
  overscroll-behavior: contain; animation: up .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom));
  z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  max-width: min(92vw, 520px); text-align: center;
}
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* --- кабинет мастера --- */
.timeline .slot { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 6px 0; }
.timeline .slot .tm { color: var(--ash); font-size: 13px; padding-top: 10px; }
.timeline .bk { border-left: 3px solid var(--plum); background: var(--card); border-radius: 0 var(--r-s) var(--r-s) 0; padding: 10px 12px; cursor: pointer; }
.timeline .bk.done { border-color: var(--ok); opacity: .85; }
.timeline .bk.noshow { border-color: var(--danger); opacity: .7; }
.timeline .free { border: 1px dashed var(--line); border-radius: var(--r-s); padding: 9px 12px; color: var(--ash); font-size: 13px; }
.timeline .block { background: repeating-linear-gradient(45deg, var(--soft), var(--soft) 6px, transparent 6px, transparent 12px); border-radius: var(--r-s); padding: 9px 12px; font-size: 13px; }
.bar { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--plum); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.chart i { flex: 1; background: var(--plum); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.list-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-row:last-child { border-bottom: 0; }
.warn-box { border: 1px solid var(--warn); color: var(--ink); background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: var(--r-s); padding: 12px 14px; font-size: 13px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch input { width: 44px; height: 26px; accent-color: var(--plum); }

/* Широкий экран (кабинет мастера в браузере /panel, планшет): колонки вместо ленты, вкладки сбоку */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 96px; }
  .tabs { top: 0; right: auto; width: 96px; grid-auto-flow: row; grid-auto-rows: 76px; align-content: start;
          border-top: 0; border-right: 1px solid var(--line); padding-top: 70px; }
  .sticky-cta, .cart-bar { bottom: 12px; }
  .toast { bottom: 24px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .sheet { left: 50%; right: auto; width: min(560px, 92vw); transform: translateX(-50%); bottom: auto; top: 6vh; border-radius: 18px; max-height: 88vh; }
  @keyframes up { from { opacity: .4; } }
}
