/* Страница мастера — в первую очередь для телефона. Токены и базовые элементы — из crm.css. */
.mpage { max-width: 600px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: contain; }
@media (min-width: 640px) { .mpage { box-shadow: 0 0 0 1px var(--line); } }

/* ---------- шапка: кто я ---------- */
.mhead { background: var(--black); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top)); }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; padding: 4px; border-radius: 10px; text-align: left; }
.who img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: top; background: color-mix(in srgb, var(--dark) 88%, #fff); flex: none; }
.who span { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.who b { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: rgba(255,255,255,.55); font-size: 13px; }
.who .chev { width: 18px; height: 18px; flex: none; color: rgba(255,255,255,.5); }
.mhead .logo { flex: none; display: flex; padding: 6px; opacity: .9; }
.mdemo { background: color-mix(in srgb, var(--dark) 88%, #fff); color: rgba(255,255,255,.75); font-size: 12.5px; text-align: center; padding: 5px 12px; }

/* ---------- масштаб и период (липкая панель) ---------- */
.mtop { position: sticky; top: 0; z-index: 20; background: rgba(247,244,240,.96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 10px 12px 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 0; border-radius: 8px; font-weight: 500; font-size: 14.5px; color: var(--ink-2); }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(21,20,19,.14); }
.pnav { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.arrow { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--ink); }
.arrow svg { width: 22px; height: 22px; }
.arrow:active { background: var(--line); }
.ttl { flex: 1; min-width: 0; text-align: center; }
.ttl h1 { font-size: 19px; font-weight: 500; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttl p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.3; min-height: 16px; }
.today { border: 0; background: none; padding: 0 0 0 6px; font-size: 12.5px; color: var(--red); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* полоса недели в режиме «день» */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 8px; }
.sd { border: 0; background: none; padding: 4px 0 6px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); }
.sd .w { font-size: 11.5px; color: var(--muted); }
.sd .n { font-size: 17px; font-weight: 500; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.sd .lv { width: 22px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.sd .lv i { display: block; height: 100%; background: var(--ink); }
.sd.off .n { color: color-mix(in srgb, var(--muted) 60%, var(--line-2)); }
.sd.off .lv { visibility: hidden; }
.sd.is-today .n { color: var(--red); }
.sd[aria-pressed="true"] .n { background: var(--ink); color: #fff; }
.sd[aria-pressed="true"].is-today .n { background: var(--red); }

/* ---------- сцена со свайпом ---------- */
.mpage { touch-action: pan-y; }
.stage { overflow: hidden; min-height: 60vh; }
.view { padding: 12px 12px 28px; will-change: transform; }
.view.anim { transition: transform .22s cubic-bezier(.2,.7,.3,1), opacity .22s; }
.mempty { color: var(--muted); text-align: center; padding: 48px 12px; }
.hint { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0 16px 28px; }

/* итоги периода */
.sum { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.sum div { padding: 9px 10px 8px; display: flex; flex-direction: column; min-width: 0; }
.sum div + div { border-left: 1px solid var(--line); }
.sum b { font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-note { font-size: 13px; color: var(--muted); margin: -4px 2px 12px; }
.sum-note .bad { color: var(--red); }

/* ---------- день: лента записей с окнами ---------- */
.dayoff { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }
.dayoff b { display: block; color: var(--ink); font-size: 17px; font-weight: 500; margin-bottom: 4px; }
.agenda { display: flex; flex-direction: column; gap: 6px; }
.slot { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.slot .tm { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; padding-top: 9px; text-align: right; }
.slot .tm small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.bk { position: relative; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--r); padding: 9px 12px 9px 14px; min-width: 0; width: 100%;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.bk::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink); }
.bk:active { background: color-mix(in srgb, var(--bg) 40%, var(--card)); }
.bk .nm { font-size: 16px; font-weight: 500; line-height: 1.25; display: flex; gap: 6px; align-items: baseline; }
.bk .nm span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk .nm .tag { margin-left: auto; flex: none; }
.bk .sv { font-size: 14px; color: var(--ink-2); }
.bk .about { font-size: 13px; color: var(--muted); }
.bk .flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.bk .memo { font-size: 13px; color: var(--ink-2); background: var(--paper); border-radius: 6px; padding: 4px 8px; margin-top: 2px; }
.bk.past { background: transparent; }
.bk.past::before { background: var(--line-2); }
.bk.past .nm, .bk.past .sv { color: var(--ink-2); }
.bk.noshow::before { background: var(--red); }
.bk.noshow .nm span { text-decoration: line-through; text-decoration-color: rgba(205,41,38,.5); }
.bk.pending::before { background: repeating-linear-gradient(180deg, var(--ink) 0 6px, transparent 6px 10px); }
.bk.live { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.bk.live::before { background: var(--red); }
.gap { margin-left: 56px; border: 1px dashed var(--line-2); border-radius: var(--r); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px; color: var(--muted); font-size: 13px; }
.gap b { font-weight: 500; color: var(--ink-2); }
.gap.past { opacity: .6; }
.now { display: flex; align-items: center; gap: 8px; color: var(--red); font-size: 12.5px; font-weight: 500; margin: 2px 0; }
.now::after { content: ""; flex: 1; height: 2px; background: var(--red); border-radius: 1px; }
.now span { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.cancelled { margin-top: 18px; }
.cancelled h2, .wk-head h2 { font-size: 15px; font-weight: 500; margin: 0 0 6px 2px; }
.cx { display: grid; grid-template-columns: 48px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.cx .tm { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; text-decoration: line-through; }
.cx b { font-weight: 500; }
.cx div { font-size: 14px; color: var(--ink-2); }
.cx small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- неделя ---------- */
.wd { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; overflow: hidden; }
.wd.is-today { border-color: var(--ink); }
.wd-h { display: flex; align-items: baseline; gap: 8px; width: 100%; border: 0; background: none; padding: 10px 12px 6px; text-align: left; }
.wd-h b { font-size: 16px; font-weight: 500; }
.wd-h b .t { color: var(--red); }
.wd-h span { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wd-h svg { width: 16px; height: 16px; color: var(--muted); align-self: center; flex: none; }
.wd.off { background: transparent; border-style: dashed; }
.wd.off .wd-h { padding-bottom: 10px; }
.wd.off .wd-h b { color: var(--muted); font-weight: 400; }
.tl { position: relative; height: 8px; margin: 0 12px 4px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); border-radius: 4px; overflow: hidden; }
.tl i { position: absolute; top: 0; bottom: 0; background: var(--ink); border-radius: 1px; }
.tl i.past { background: var(--muted); }
.tl i.bad { background: var(--red); }
.tl-scale { display: flex; justify-content: space-between; margin: 0 12px 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wl { list-style: none; margin: 0; padding: 0 0 4px; }
.wl button { display: grid; grid-template-columns: 44px 1fr; gap: 8px; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 7px 12px; text-align: left; font-size: 14px; }
.wl .tm { font-variant-numeric: tabular-nums; font-weight: 500; }
.wl .who2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl .who2 small { color: var(--muted); font-size: 13px; }
.wl .past .tm, .wl .past .who2 { color: var(--muted); }
.wl .bad .who2 { text-decoration: line-through; text-decoration-color: rgba(205,41,38,.5); }
.wl .first::after, .bk .nm .first { content: ""; }
.dot-first { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 5px; vertical-align: 1px; }

/* ---------- месяц ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wh { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cd { aspect-ratio: 1 / 1.18; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 5px 0 0; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; overflow: hidden; color: var(--ink); min-width: 0; }
.cd .n { font-size: 13px; font-variant-numeric: tabular-nums; }
.cd .c { font-size: 19px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.cd .c.zero { color: var(--muted); font-weight: 400; font-size: 14px; }
.cd .lv { align-self: stretch; height: 4px; background: var(--line); }
.cd .lv i { display: block; height: 100%; background: var(--ink); }
.cd.past .lv i { background: var(--muted); }
.cd.off { background: transparent; border-style: dashed; color: color-mix(in srgb, var(--muted) 60%, var(--line-2)); }
.cd.off .c { visibility: hidden; }
.cd.out { opacity: .32; }
.cd.is-today { border: 2px solid var(--red); }
.cd.is-today .n { color: var(--red); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin: 12px 2px 0; }
.legend i { display: inline-block; width: 16px; height: 4px; background: var(--ink); vertical-align: 3px; margin-right: 5px; border-radius: 1px; }
.legend i.off { height: 12px; width: 12px; vertical-align: -1px; border: 1px dashed color-mix(in srgb, var(--muted) 60%, var(--line-2)); background: none; border-radius: 3px; }
.vac { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 14px; }
.vac b { font-weight: 500; }

/* ---------- нижний лист ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: rgba(21,20,19,.4); animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 600px; margin: 0 auto; max-height: 88vh; max-height: 88dvh; background: var(--paper);
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .24s cubic-bezier(.2,.7,.3,1); padding-bottom: env(safe-area-inset-bottom); }
.grab { flex: none; height: 22px; display: grid; place-items: center; cursor: pointer; }
.grab::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
.sheet-body { overflow-y: auto; padding: 0 16px 20px; overscroll-behavior: contain; }
@keyframes up { from { transform: translateY(100%); } }
/* на широком экране лист — окном по центру */
@media (min-width: 641px) {
  .sheet { top: 50%; bottom: auto; left: 50%; right: auto; width: min(600px, calc(100% - 48px)); margin: 0; transform: translate(-50%, -50%);
    max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); border-radius: 18px; padding-bottom: 0; box-shadow: 0 30px 90px rgba(0,0,0,.28); animation: mpop .18s ease-out; }
  .grab { display: none; }
  .sheet-body { padding-top: 16px; }
}
@keyframes mpop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sh-name { font-size: 22px; font-weight: 500; margin: 2px 0 2px; }
.sh-sub { color: var(--muted); font-size: 14px; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line);
  text-decoration: none; font-size: 13px; color: var(--ink); }
.act svg { width: 22px; height: 22px; }
.act.call svg { color: var(--ink); }
.act.tg svg { color: var(--tg); }
.act.wa svg { color: var(--wa); }
.act[aria-disabled="true"] { color: var(--muted); }
.act[aria-disabled="true"] svg { color: var(--line-2); }
.sh-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 12px; margin-bottom: 12px; }
.sh-box h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 8px 0 2px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); flex: none; }
.kv b { font-weight: 500; text-align: right; }
.memo-big { padding: 8px 0 10px; font-size: 14.5px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.hist li:first-child { border-top: 0; }
.hist .d { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hist .s { min-width: 0; }
.hist .s small { display: block; color: var(--muted); font-size: 12.5px; }
.hist li.mine .s small { color: var(--ink); }
.hist li.cur { background: var(--paper); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }

/* впечатление о визите и заметка к записи (шаблон формы) */
.impr-cta { align-self: flex-start; margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--red); border: 1px dashed rgba(205,41,38,.45); border-radius: 999px; padding: 2px 10px; }
.iform { padding-bottom: 12px; }
.impr-has { align-self: flex-start; margin-top: 4px; font-size: 13px; color: var(--ink-2); background: var(--paper); border-radius: 999px; padding: 2px 10px; }
.nlist { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.ne { border-left: 2px solid var(--line-2); padding: 2px 0 2px 12px; display: grid; gap: 6px; }
.ne-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.ne-t { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.ne-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ne-f { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 13.5px; }
.ne-f dt { color: var(--muted); }
.ne-f dd { margin: 0; }
.vbub { display: flex; align-items: center; gap: 10px; background: #eef4ea; border-radius: 14px 14px 14px 4px; padding: 6px 12px 6px 6px; max-width: 300px; }
.vplay { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #4f9a5f; color: #fff; display: grid; place-items: center; }
.vplay svg { width: 11px; height: 13px; margin-left: 2px; }
.vwave { flex: 1; display: flex; align-items: center; gap: 2px; height: 24px; }
.vwave i { flex: 1; background: #4f9a5f; border-radius: 2px; opacity: .8; }
.vbub small { color: #5b7a5f; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.add-more { width: 100%; margin-top: 12px; border: 1px dashed var(--line-2); background: none; border-radius: 12px; padding: 11px; font-size: 14.5px; font-weight: 500; color: var(--ink); }
.fq { font-size: 14px; color: var(--ink-2); margin: 10px 0 6px; }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.opt { border: 1px solid var(--line-2); background: var(--card); border-radius: 10px; padding: 9px 4px; font-size: 14px; color: var(--ink-2); line-height: 1.2; }
.opt[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt.ok[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.opt.bad[aria-checked="true"] { background: var(--red); border-color: var(--red); }
.mic { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; padding: 10px 12px; text-align: left; }
.mic svg { flex: none; width: 46px; height: 46px; padding: 12px 13px; border-radius: 50%; background: var(--red); color: #fff; box-shadow: 0 0 0 5px var(--red-soft); }
.mic b { display: block; font-weight: 500; font-size: 15.5px; }
.mic small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.or { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px 0 2px; }
.fl { display: block; font-size: 13.5px; color: var(--muted); margin-top: 10px; }
.fl textarea, .fl input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; background: var(--card);
  font-size: 16px; color: var(--ink); resize: vertical; }
.fl textarea:focus, .fl input:focus { outline: none; border-color: var(--ink); }
.sw { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 14.5px; }
.sw input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.sw small { display: block; color: var(--muted); font-size: 12.5px; }
.send { width: 100%; margin-top: 14px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; font-size: 15.5px; padding: 12px; }
.fnote { color: var(--muted); font-size: 12.5px; margin: 8px 2px 0; line-height: 1.4; }

/* выбор мастера */
.pick { list-style: none; margin: 8px 0 0; padding: 0; }
.pick button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px 2px; text-align: left; }
.pick li:first-child button { border-top: 0; }
.pick img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--line); }
.pick b { display: block; font-weight: 500; font-size: 16px; }
.pick small { color: var(--muted); font-size: 13px; }
.pick [aria-current="true"] b::after { content: " · это вы"; color: var(--muted); font-weight: 400; }

@media (min-width: 640px) {
  .hint { display: none; }
}
