:root {
  --bg: #faf7f4;
  --card: #ffffff;
  --text: #2a2522;
  --muted: #7b716b;
  --line: #e9e2dc;
  --accent: #b5566b;
  --accent-soft: #f6e6ea;
  --accent-text: #ffffff;
  --ok: #3d8a5a;
  --ok-soft: #e4f2e8;
  --warn: #b7791f;
  --warn-soft: #fbf0dc;
  --bad: #b3413b;
  --bad-soft: #f8e3e1;
  --shadow: 0 1px 2px rgba(60, 40, 30, .06), 0 4px 16px rgba(60, 40, 30, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1817; --card: #252120; --text: #f1ebe7; --muted: #a79d97; --line: #3a3431;
    --accent: #e0849a; --accent-soft: #3d262c; --accent-text: #1b1817;
    --ok: #7cc79a; --ok-soft: #1f3327; --warn: #e5b464; --warn-soft: #3a2f1d;
    --bad: #ec8b84; --bad-soft: #3d2322; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1817; --card: #252120; --text: #f1ebe7; --muted: #a79d97; --line: #3a3431;
  --accent: #e0849a; --accent-soft: #3d262c; --accent-text: #1b1817;
  --ok: #7cc79a; --ok-soft: #1f3327; --warn: #e5b464; --warn-soft: #3a2f1d;
  --bad: #ec8b84; --bad-soft: #3d2322; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 28px 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
a { color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 8px 10px; }
.danger { color: var(--bad); }
.wide { width: 100%; }
.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; margin: 0; cursor: pointer; }

.chip {
  display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.error { color: var(--bad); font-size: 14px; min-height: 1em; }
.hidden { display: none !important; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 15px; max-width: calc(100% - 32px); z-index: 50; box-shadow: var(--shadow);
}

/* --- клиентская страница --- */
.hero { padding: 12px 0 4px; }
.hero .contacts { font-size: 15px; color: var(--muted); margin-top: 6px; }
.step-title { display: flex; gap: 10px; align-items: baseline; margin: 28px 0 12px; font-size: 18px; font-weight: 600; }
.step-title .num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none;
}
.services { display: grid; gap: 10px; }
.service {
  text-align: left; display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px;
  border-radius: var(--radius); width: 100%;
}
.service .name { font-weight: 600; }
.service .meta { color: var(--muted); font-size: 14px; }
.service .price { font-weight: 600; white-space: nowrap; }
.service.selected, .day.selected, .slot.selected {
  border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent);
}
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.day {
  flex: none; width: 64px; flex-direction: column; gap: 0; padding: 8px 4px; scroll-snap-align: start;
}
.day .dow { font-size: 13px; color: var(--muted); text-transform: uppercase; }
.day .num { font-size: 20px; font-weight: 600; }
.day .mon { font-size: 12px; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot { padding: 8px 0; font-variant-numeric: tabular-nums; }
.summary { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.done { text-align: center; padding: 32px 16px; }
.done .big { font-size: 44px; }

/* --- кабинет --- */
.tabs {
  display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px; position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow);
}
.tabs button { flex: 1; border: 0; min-height: 40px; font-size: 15px; padding: 6px 4px; background: transparent; }
.tabs button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.tabs .badge {
  background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 2px;
}
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.day-head h3 { margin: 0; }
.day-head h3::first-letter, .cal-row .d::first-letter { text-transform: uppercase; }
.booking { display: grid; grid-template-columns: 64px 1fr; gap: 12px; }
.booking .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.booking .time .end { color: var(--muted); font-weight: 400; font-size: 14px; }
.booking.cancelled { opacity: .55; }
.booking.cancelled .who { text-decoration: line-through; }
.booking .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cal-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; width: 100%;
  text-align: left; border-radius: 10px; padding: 10px 12px; min-height: 0;
}
.cal-row.off { color: var(--muted); }
.cal-row .d { display: inline-block; font-weight: 600; }
.cal-list { display: grid; gap: 6px; }
.week-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.week-row:first-child { border-top: 0; }
.week-row .dname { font-weight: 600; padding-top: 10px; text-transform: capitalize; }
.interval { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.interval input { padding: 8px; }
.svc-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.svc-edit .full { grid-column: 1 / -1; }

dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100% - 24px));
  background: var(--card); color: var(--text); box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(20, 15, 12, .45); }
dialog .dlg { padding: 18px; }
dialog h3 { font-size: 18px; margin-bottom: 14px; }
.login { max-width: 360px; margin: 12vh auto 0; }

/* --- о мастере, фото, согласие --- */
.about { margin: 12px 0 0; white-space: pre-line; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin-top: 14px; padding-bottom: 6px; scroll-snap-type: x proximity; }
.gallery img { height: 180px; width: auto; border-radius: 12px; flex: none; object-fit: cover; scroll-snap-align: start; cursor: zoom-in; }
.viewer { padding: 0; background: transparent; box-shadow: none; width: auto; max-width: 96vw; }
.viewer img { display: block; max-width: 96vw; max-height: 90vh; border-radius: 12px; }
.consent { align-items: flex-start; }
.consent input { margin-top: 1px; flex: none; }
.photos-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos-admin .ph { position: relative; }
.photos-admin img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photos-admin button { position: absolute; top: 4px; right: 4px; min-height: 28px; padding: 2px 8px; background: var(--card); }
.policy h2 { margin-top: 22px; }

/* --- схемы стрижек --- */
:root { --hair: #6f4e3b; --skin: #f4dfd0; --skin-line: #b99a88; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hair: #a07860; --skin: #e9cdb9; --skin-line: #8a6f60; } }
:root[data-theme="dark"] { --hair: #a07860; --skin: #e9cdb9; --skin-line: #8a6f60; }
.hair-svg { display: block; width: 100%; height: auto; }
.hair-svg .h { fill: var(--hair); stroke: color-mix(in srgb, var(--hair) 70%, #000); stroke-width: .6; stroke-linejoin: round; }
.hair-svg .st { opacity: .45; }
.hair-svg .st2 { opacity: .2; }
.hair-svg .sk { fill: var(--skin); stroke: var(--skin-line); stroke-width: .8; }
.hair-svg .ln { fill: none; stroke: var(--skin-line); stroke-width: .9; stroke-linecap: round; }
.hair-svg .h ~ .ln, .hair-svg .h + .ln { stroke: color-mix(in srgb, var(--hair) 55%, #000); }

/* --- выбор услуги, стрижки, длины --- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; min-height: 36px; padding: 6px 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.chip-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.usual { outline: 2px dashed var(--accent); outline-offset: 2px; }
.usual-chip { background: var(--accent); color: var(--accent-text); font-size: 11px; padding: 1px 7px; vertical-align: 1px; }
.usual-card { margin-top: 18px; border-color: var(--accent); background: var(--accent-soft); }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.style-card { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; padding: 6px 6px 8px; text-align: center; min-height: 0; position: relative; }
.style-card .thumb { display: block; aspect-ratio: 6 / 7; border-radius: 8px; overflow: hidden; background: var(--bg); }
.style-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-card .sname { font-size: 13px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.style-card .meta, .len .meta { font-size: 12px; color: var(--muted); }
.style-card .usual-chip { position: absolute; top: 4px; left: 4px; }
.star { color: #d49b1f; }
.selected-txt { font-weight: 700; text-decoration: underline; }
.lengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.len { flex-direction: column; justify-content: flex-start; gap: 0; padding: 6px 4px 8px; min-height: 0; position: relative; }
.len .pic { display: block; width: 64px; margin: 0 auto 2px; }
.len .sname { font-weight: 600; font-size: 14px; }
.len .usual-chip { position: absolute; top: 4px; left: 4px; }
.plan { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 15px; }
.style-dlg { width: min(560px, calc(100% - 16px)); }
.views4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.views4 figure { margin: 0; background: var(--bg); border-radius: 10px; overflow: hidden; }
.views4 figure img, .views4 figure svg { width: 100%; aspect-ratio: 6 / 7; object-fit: cover; display: block; }
.views4 figcaption { text-align: center; font-size: 13px; color: var(--muted); padding: 2px 0 6px; }
.example { margin: 0; border-radius: 12px; overflow: hidden; background: var(--bg); }
.example img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.example figcaption { font-size: 12px; color: var(--muted); padding: 4px 8px; }
.photo-prev { position: relative; }
.photo-prev img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.photo-prev button { position: absolute; top: -6px; right: -6px; min-height: 22px; padding: 0 6px; font-size: 12px; border-radius: 999px; }
@media (min-width: 560px) { .views4 { grid-template-columns: repeat(4, 1fr); } }

/* --- кабинет: клиенты, услуги, стрижки --- */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; padding: 6px 10px; }
.visits { font-size: 12px; color: var(--ok); }
.note-line { font-size: 13px; background: var(--warn-soft); color: var(--text); border-radius: 8px; padding: 4px 8px; margin-top: 6px; white-space: pre-line; }
.client-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; width: 100%; text-align: left; min-height: 0; padding: 10px 12px; }
.svc-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; width: 100%; text-align: left; min-height: 0; padding: 10px 12px; }
.svc-row.off { opacity: .55; }
.times3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-head { margin: 20px 0 8px; font-weight: 700; }
.style-admin { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; min-height: 0; padding: 8px; }
.style-admin.off { opacity: .55; }
.style-admin .thumb { width: 72px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.style-admin .thumb img { width: 100%; aspect-ratio: 6 / 7; object-fit: cover; display: block; }
.slots4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slots4 figure { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.slots4 .box { position: relative; border: 1px dashed var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.slots4 .box img, .slots4 .box svg { width: 100%; aspect-ratio: 6 / 7; object-fit: cover; display: block; }
.slots4 .box .del { position: absolute; top: 2px; right: 2px; min-height: 22px; padding: 0 6px; font-size: 12px; }
.slots4 label.btn { min-height: 30px; padding: 2px 6px; font-size: 12px; margin-top: 4px; width: 100%; }
.client-photo { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; margin-top: 6px; cursor: zoom-in; }

/* --- фото-примеры: мелко, под схемами --- */
.examples { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.examples img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; cursor: zoom-in; opacity: .92; }
.examples .ex { position: relative; }
.examples .ex button { position: absolute; top: -6px; right: -6px; min-height: 20px; padding: 0 5px; font-size: 11px; border-radius: 999px; }
.viewer .credit { margin: 6px 0 0; font-size: 12px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.viewer .credit a { color: #fff; }

/* --- быстрая запись --- */
.cat-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.cat-title:first-child { margin-top: 0; }
.seg { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.seg-label { font-size: 14px; color: var(--muted); margin-right: 4px; }
.seg button { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 999px; }
.seg button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.plan-line { font-size: 15px; margin: 0 0 10px; }
.two { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) { .two { grid-template-columns: 1fr 1fr; } }
.big-btn { min-height: 52px; font-size: 17px; }
