:root {
  --ground: #FBF6F3;
  --surface: #FFFFFF;
  --ink: #2A1F24;
  --muted: #6E5F66;
  --muted-2: #5E4F56;
  --line: #EADCD8;
  --line-soft: #F1E6E3;
  --accent: #B4536A;
  --accent-ink: #8E3A50;
  --accent-soft: #F3E3E6;
  --dark-soft: #E2CFD4;
  --ph-1: #EFDCD9;
  --ph-2: #E8D5D0;
  --ph-3: #F2E6E1;
  --ok: #2E7D5B;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Manrope, system-ui, -apple-system, sans-serif;
  --r-card: 20px;
  --r-btn: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--accent-ink); }
a:hover { color: #6E2A3D; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
#app.wide { max-width: 1080px; }
.loading, .empty { padding: 48px 20px; text-align: center; color: var(--muted); line-height: 1.5; }
.empty h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 26px; color: var(--ink); font-weight: 600; }

.pad { padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 20px; }
.mt-s { margin-top: 10px; }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
.h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.05; }
.h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.1; }
.lead { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; color: var(--muted); }
.strong { font-weight: 600; }
.price { font-weight: 700; white-space: nowrap; }

.head { padding: 24px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink); text-decoration: none; }
.chip svg { flex: none; }
.tag { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.tag.gray { background: var(--line-soft); color: var(--muted-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; }
.card.dark { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.card.dark .small { color: var(--dark-soft); }

.btn { appearance: none; border: 0; min-height: 52px; padding: 0 18px; border-radius: var(--r-btn); background: var(--accent); color: #FFFFFF; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; width: 100%; }
.btn:hover { color: #FFFFFF; filter: brightness(.96); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--ground); }
.btn.light { background: var(--ground); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--accent-ink); border: 1px solid var(--line); }
.btn.small { min-height: 44px; font-size: 15px; }
.btn.link { background: none; color: var(--muted); min-height: 44px; }
.btn[disabled] { background: var(--line); color: var(--muted); cursor: default; filter: none; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item .t { font-size: 16px; font-weight: 600; }

.svc { display: flex; gap: 14px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; align-items: flex-start; }
.svc[aria-pressed="true"] { border: 2px solid var(--accent); padding: 11px; }
.svc .ph, .ph { width: 76px; height: 76px; flex: none; border-radius: 12px; background: var(--ph-1); object-fit: cover; }
.svc .check { width: 24px; height: 24px; flex: none; border-radius: 999px; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; }
.svc[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }

.pill { min-height: 44px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(48px, 1fr); gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.day { min-height: 64px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.day .wd { font-size: 11px; font-weight: 500; }
.day .n { font-size: 18px; font-weight: 700; }
.day .dot { width: 5px; height: 5px; border-radius: 99px; background: var(--accent); }
.day[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.day[aria-pressed="true"] .dot { background: var(--dark-soft); }
.day[disabled] { background: transparent; border-style: dashed; color: #9C8E93; cursor: default; }
.day[disabled] .dot { background: transparent; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.slot { height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; font-weight: 600; cursor: pointer; }
.slot[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.group-name { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); z-index: 5; }
.bar-in { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.bar .sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--muted); }
.bar .sum b { font-size: 20px; color: var(--ink); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); z-index: 5; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; }
.nav a[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #FFFFFF; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.summary { padding: 4px 18px; }
.summary .r { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.summary .r:last-child { border-bottom: 0; }
.summary .r > span:first-child { font-size: 14px; color: var(--muted); }
.summary .r > span:last-child { font-size: 15px; font-weight: 600; text-align: right; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 400; }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.45; }
.input::placeholder { color: #7A6B71; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 99px; background: #FFFFFF; transition: left .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 23px; }

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gallery img, .gallery .ph { width: 100%; height: auto; aspect-ratio: 1; border-radius: 14px; object-fit: cover; background: var(--ph-2); }

.chat { display: flex; flex-direction: column; gap: 10px; padding: 16px 14px; background: #EFE6E2; border-radius: var(--r-card); min-height: 240px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface); font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--accent-soft); }
.msg .when { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.icon-btn { width: 48px; height: 48px; border-radius: 999px; border: 0; background: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

#toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 12px 16px; border-radius: 14px; font-size: 14px; max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
#toast.on { opacity: 1; }

.sheet-back { position: fixed; inset: 0; background: rgba(42, 31, 36, .35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--ground); border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet .grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); align-self: center; }

/* майстер: день */
.timeline { display: flex; padding: 12px 20px 0 8px; }
.timeline .hours { width: 48px; flex: none; position: relative; }
.timeline .hours span { position: absolute; right: 8px; font-size: 12px; color: var(--muted); transform: translateY(-50%); }
.timeline .lane { flex: 1; position: relative; border-top: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, var(--line) 59px, var(--line) 60px); }
.timeline .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--ground) 0, var(--ground) 6px, #F6EEEB 6px, #F6EEEB 12px); }
.blk { position: absolute; left: 0; right: 0; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden; text-align: left; font-size: 13px; color: var(--muted); }
.blk b { font-size: 14px; color: var(--ink); }
.blk.pending { background: #FFF7F0; border-left-color: #C27A2C; }
.blk.done { opacity: .65; }
.blk.busy { background: repeating-linear-gradient(135deg, var(--line-soft) 0, var(--line-soft) 6px, var(--ground) 6px, var(--ground) 12px); border-left: 1px solid #E2D4CF; color: var(--muted-2); }
.now-line { position: absolute; left: -6px; right: 0; height: 2px; background: var(--accent); pointer-events: none; }
.fab { position: fixed; right: max(20px, calc(50% - 260px)); bottom: calc(96px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 20px; background: var(--accent); border: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 20px rgba(42, 31, 36, .18); z-index: 6; }
.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--line-soft); }
.seg a, .seg button { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; }
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--ground); text-decoration: none; }
.banner:hover { color: var(--ground); }
.week-day { padding: 14px 0; border-bottom: 1px solid var(--line); }
.wk-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; background: none; border: 0; width: 100%; text-align: left; }
.sched-day { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sched-day .times { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.sched-day input[type=time] { min-height: 40px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.stat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat .card b { display: block; font-family: var(--serif); font-size: 32px; }

@media (min-width: 820px) {
  #app.wide .timeline { padding-right: 40px; }
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
