/*
  VOICE   спокойный, деловой, премиальный — как хороший сервис записи
  IDEA    лист ежедневника: белая бумага, тонкие линейки, одна изумрудная метка
  PICTURE сама запись: лента дней и сетка времени — главное на экране
  COLOUR  белый / графит, один акцент — изумруд; тёмная тема — тот же лист ночью
  TYPE    Manrope: крупный заголовок 30px, текст 16px, подписи 13px
*/
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f5f5f2;
  --line: #e6e5e0;
  --ink: #15181a;
  --muted: #6d7275;
  --accent: #0d5a46;
  --accent-ink: #ffffff;
  --accent-soft: #e5efeb;
  --danger: #b2352c;
  --danger-soft: #f7e7e5;
  --amber: #8a5a00;
  --amber-soft: #f6eedb;
  --blue: #1f4c8f;
  --blue-soft: #e7eef8;
  --violet: #4b3f8f;
  --violet-soft: #eeecf7;
  --shadow: 0 1px 2px rgba(20, 24, 26, .04), 0 8px 24px rgba(20, 24, 26, .06);
  --r: 14px;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #101213;
  --surface: #191c1e;
  --line: #2a2e31;
  --ink: #eceeed;
  --muted: #8f9598;
  --accent: #3aa783;
  --accent-ink: #08120e;
  --accent-soft: #15302a;
  --danger: #e2766c;
  --danger-soft: #3a1f1c;
  --amber: #e0b45c;
  --amber-soft: #33291a;
  --blue: #8fb2ea;
  --blue-soft: #1b2638;
  --violet: #b2a8f0;
  --violet-soft: #25223a;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --bg: #101213; --surface: #191c1e; --line: #2a2e31; --ink: #eceeed; --muted: #8f9598;
    --accent: #3aa783; --accent-ink: #08120e; --accent-soft: #15302a; --danger: #e2766c; --danger-soft: #3a1f1c;
    --amber: #e0b45c; --amber-soft: #33291a; --blue: #8fb2ea; --blue-soft: #1b2638; --violet: #b2a8f0; --violet-soft: #25223a; --shadow: none;
  }
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: clip; }
main { padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
h1 { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; padding: 48px 0; }
.center-text { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.big { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }

/* шапка экрана */
.hero { padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.eyebrow { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: 0 10px 3px 0; vertical-align: middle; }
.lead { color: var(--muted); font-size: 15px; }
.back { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 0 0 14px; cursor: pointer; width: auto; }

/* кнопки */
button, .btn { appearance: none; border: 1px solid transparent; border-radius: 12px; min-height: 52px; padding: 12px 18px;
  font: inherit; font-weight: 600; font-size: 16px; background: var(--accent); color: var(--accent-ink); cursor: pointer; width: 100%;
  transition: background .15s, border-color .15s, color .15s; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost { background: transparent; color: var(--accent); min-height: 40px; padding: 8px 4px; width: auto; font-weight: 600; font-size: 15px; }
button.danger { background: transparent; color: var(--danger); border-color: var(--line); }
button:disabled { opacity: .35; cursor: default; }
.btns { display: grid; gap: 10px; margin-top: 16px; }
.bottom { position: sticky; bottom: 0; display: grid; gap: 6px; margin: 24px -20px 0; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 22%); }

/* разделы */
.sec { margin-bottom: 22px; }
.sec-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.sec-title .muted { font-weight: 500; font-size: 13px; }

/* лента дней */
.days { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 60px; min-height: 0; height: 80px; padding: 8px 0; display: grid; justify-items: center; gap: 0; scroll-snap-align: start;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); font-weight: 500; }
.day small { font-size: 12px; color: var(--muted); font-weight: 500; }
.day b { font-size: 22px; font-weight: 600; line-height: 1.2; }
.day.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.day.active small { color: inherit; opacity: .7; }

/* время */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slot { background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* формы */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 16px 0 6px; }
input, textarea, select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid transparent; border-radius: 12px; padding: 13px 14px; outline: none; min-height: 50px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: var(--bg); }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0 4px; font-size: 14px; color: var(--ink); font-weight: 400; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--accent); }

/* карточки */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 10px 0; }
.ok-icon { color: var(--accent); display: grid; place-items: center; margin: 24px 0 14px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 14px 0 14px 40px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.steps li b { color: var(--ink); font-weight: 600; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 13px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink); }

.status-line { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface); font-weight: 600; font-size: 15px; margin-bottom: 14px; }
.status-line i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: 0 0 auto; }
.status-line.st-requested { background: var(--amber-soft); color: var(--amber); }
.status-line.st-booked, .status-line.st-link_sent { background: var(--accent-soft); color: var(--accent); }
.status-line.st-booked i, .status-line.st-link_sent i { background: var(--accent); }

/* видео после записи */
.video-block { margin: 6px 0 22px; }
.video-wrap { position: relative; }
.unmute { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); width: auto; min-height: 40px; padding: 8px 16px; font-size: 14px; border-radius: 999px; background: rgba(21, 24, 26, .78); color: #fff; backdrop-filter: blur(6px); }
.unmute[hidden] { display: none; }
.video-block video { display: block; width: 100%; max-height: 72vh; aspect-ratio: 9 / 16; object-fit: cover; background: var(--surface); border-radius: 18px; }

/* ---------- менеджер ---------- */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; }
.tabs button { width: auto; min-height: 46px; padding: 10px 0; background: none; border: 0; border-radius: 0; color: var(--muted);
  font-weight: 600; font-size: 16px; box-shadow: inset 0 -2px 0 transparent; }
.tabs button.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.tabs.sub { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--surface); border: 0; border-radius: 12px; margin: 0 0 14px; }
.tabs.sub button { min-height: 38px; padding: 6px; border-radius: 9px; font-size: 14px; box-shadow: none; }
.tabs.sub button.active { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; width: auto; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); font-weight: 500; font-size: 14px; }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 6px; }
.filters input { grid-column: 1 / -1; }
.filters select, .filters input { min-height: 44px; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
.filters select { background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px; }
.count { color: var(--muted); font-size: 13px; }

/* список записей */
.card.bk { cursor: pointer; padding: 14px 16px; margin: 0; border-radius: 0; border-width: 0 0 1px; }
.card.bk:first-of-type { border-top-width: 1px; }
.bk .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.bk .who { margin-top: 2px; font-size: 14px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.requested { color: var(--amber); }
.st.booked { color: var(--blue); }
.st.link_sent { color: var(--accent); }
.st.attended { color: var(--violet); }
.st.bought { color: var(--accent); }
.st.no_show, .st.cancelled { color: var(--danger); }

.detail { cursor: default; margin-top: 6px; }
.detail h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 22px 0 8px; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); font-size: 14px; margin-top: 12px; border-top: 1px solid var(--line); }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv button.ghost { min-height: 0; padding: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.msgs { display: grid; gap: 6px; margin-bottom: 8px; }
.msg { background: var(--accent-soft); color: var(--ink); border-radius: 14px 14px 4px 14px; padding: 9px 12px; font-size: 14px; white-space: pre-wrap; justify-self: end; max-width: 88%; }
.msg small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.msg.fail { background: var(--danger-soft); }

/* расписание */
.sched-day { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sched-day:last-child { border-bottom: 0; }
.sched-day b { color: var(--muted); font-weight: 600; font-size: 14px; }
.times { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.time-tag { border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 14px; font-weight: 600; display: inline-flex; gap: 2px; align-items: center; font-variant-numeric: tabular-nums; }
.time-tag button { width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); font-weight: 400; border: 0; }
.add-time { width: 104px; min-height: 34px; padding: 4px 10px; border-radius: 999px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.daygrid .slotline { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.daygrid .slotline span.t { font-weight: 600; width: 52px; font-variant-numeric: tabular-nums; }
.daygrid .slotline button { width: auto; min-height: 34px; padding: 4px 12px; font-size: 13px; }

/* календарь: цвета статусов */
.st-bg-requested { background: var(--amber-soft); color: var(--amber); }
.st-bg-booked { background: var(--blue-soft); color: var(--blue); }
.st-bg-link_sent { background: var(--accent-soft); color: var(--accent); }
.st-bg-attended { background: var(--violet-soft); color: var(--violet); }
.st-bg-bought { background: var(--accent); color: var(--accent-ink); }
.st-bg-no_show, .st-bg-cancelled { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.st-border-requested { border-left-color: var(--amber) !important; }
.st-border-booked { border-left-color: var(--blue) !important; }
.st-border-link_sent, .st-border-bought { border-left-color: var(--accent) !important; }
.st-border-attended { border-left-color: var(--violet) !important; }
.st-border-no_show, .st-border-cancelled { border-left-color: var(--danger) !important; }

.calnav { display: flex; align-items: center; gap: 4px; margin: 10px 0 4px; }
.calnav button { width: 44px; height: 44px; min-height: 0; padding: 0; font-size: 24px; font-weight: 400; color: var(--ink); border: 1px solid var(--line); border-radius: 50%; }
.caltitle { flex: 1; text-align: center; font-weight: 600; font-size: 17px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: flex-end; }
.legend .st { font-size: 12px; font-weight: 500; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 10px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mcell { min-height: 70px; padding: 5px 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mcell.out { opacity: .35; }
.mcell .n { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.mcell.today .n { background: var(--ink); color: var(--bg); }
.mcell .dot { font-size: 10px; border-radius: 4px; padding: 1px 3px; font-weight: 600; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mcell .more { font-size: 10px; color: var(--muted); padding-left: 2px; }

.week { margin-top: 8px; border-top: 1px solid var(--line); }
.wrow { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wday { width: auto; min-height: 0; background: transparent; color: var(--ink); padding: 2px 0; display: grid; justify-items: center; border: 0; }
.wday b { font-size: 12px; color: var(--muted); font-weight: 600; }
.wday span { font-size: 20px; font-weight: 600; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.wrow.today .wday span { background: var(--ink); color: var(--bg); }
.wevents { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; }
.ev { width: auto; min-height: 36px; padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 500; border: 0; }
.ev b { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 2px; }

.dayrow { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: stretch; margin: 10px 0; }
.dtime { font-weight: 600; padding-top: 14px; font-variant-numeric: tabular-nums; }
.dcard { text-align: left; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--accent); font-weight: 400; display: grid; gap: 4px; border-radius: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; max-width: 90%; z-index: 50; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.center-text .meta { justify-content: center; }

/* ---------- бесплатный урок ---------- */
.video-wrap.lesson { margin: 4px -20px 0; }
.video-wrap.lesson video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
@media (min-width: 520px) { .video-wrap.lesson { margin: 4px 0 0; } .video-wrap.lesson video { border-radius: 14px; } }
.resume { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); width: auto; min-height: 40px; padding: 8px 16px; font-size: 14px; border-radius: 999px; background: rgba(21, 24, 26, .8); color: #fff; backdrop-filter: blur(6px); }
.resume[hidden] { display: none; }
.end-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center; background: rgba(12, 14, 15, .86); color: #fff; }
@media (min-width: 520px) { .end-overlay { border-radius: 14px; } }
.end-overlay[hidden] { display: none; }
.end-overlay .eyebrow { color: #7fd1b3; margin: 0; }
.end-overlay b { font-size: 18px; font-weight: 600; max-width: 260px; }
.end-overlay button { width: auto; padding: 12px 22px; }
.end-overlay .ghost.light { color: #fff; opacity: .8; min-height: 32px; padding: 4px 10px; }
.lesson-progress { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.lesson-progress .track { flex: 1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.lesson-progress .track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.next-card { margin: 22px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
.next-card .eyebrow { margin-bottom: 4px; }
.next-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.next-card p { margin: 0; color: var(--muted); font-size: 15px; }
button.ghost.wide { width: 100%; margin-top: 14px; }
.lbadge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); white-space: nowrap; vertical-align: 1px; }
.lbadge.part { color: #9a6a12; border-color: #ecd9b0; }
.lbadge.full { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
[data-theme="dark"] .lbadge.part { color: #e0b45e; border-color: #4d3d1c; }
