:root {
  --bg: #fff7fa;
  --bg-2: #fdeef4;
  --card: #ffffff;
  --pink-50: #fef3f7;
  --pink-100: #fbe3ec;
  --pink-200: #f7cadb;
  --pink-300: #f2abc5;
  --pink-400: #ea8db0;
  --accent: #d9578d;
  --accent-dark: #b53f72;
  --text: #4b2a3b;
  --muted: #9a7587;
  --line: #f3dbe5;
  --ok: #4fa984;
  --ok-bg: #e5f5ee;
  --warn: #d98a2b;
  --warn-bg: #fdf1e1;
  --bad: #d4545f;
  --bad-bg: #fde8ea;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(201, 88, 135, .10);
  --font-head: 'Comfortaa', 'Nunito', system-ui, sans-serif;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 100% -10%, var(--pink-100), transparent 60%),
    radial-gradient(700px 500px at -10% 20%, #fdeaf2, transparent 60%),
    var(--bg);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 4vw, 34px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
a { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px 18px 80px; }
[hidden] { display: none !important; }

/* ── шапка ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: rgba(255, 247, 250, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark { width: 42px; height: 42px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--font-head); font-size: 18px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 700;
  padding: 9px 15px; border-radius: 999px; transition: .15s;
}
.nav a:hover { color: var(--accent-dark); background: var(--pink-50); }
.nav a.active { color: var(--accent-dark); background: var(--pink-100); }
.who { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-weight: 700; }
.who .avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink-200); color: var(--accent-dark); font-family: var(--font-head);
}
.badge-admin { font-size: 11px; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 8px; }

/* ── кнопки и поля ── */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  padding: 11px 20px; border-radius: 999px; transition: transform .1s, background .15s, box-shadow .15s;
  background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(217, 87, 141, .28);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.soft { background: var(--pink-100); color: var(--accent-dark); box-shadow: none; }
.btn.soft:hover { background: var(--pink-200); }
.btn.ghost { background: transparent; color: var(--accent-dark); box-shadow: none; border: 1.5px solid var(--pink-200); }
.btn.ghost:hover { background: var(--pink-50); }
.btn.danger { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.btn.danger:hover { background: #fbd5d9; }
.btn.sm { padding: 7px 13px; font-size: 14px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--accent-dark); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
label.field > span { color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; width: 100%;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink-400); box-shadow: 0 0 0 4px var(--pink-100); }
textarea { resize: vertical; min-height: 70px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.err { color: var(--bad); font-weight: 700; font-size: 14px; min-height: 1em; margin-top: 10px; }

/* ── карточки ── */
.card {
  background: var(--card); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.grid-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.pill.pink { background: var(--pink-100); color: var(--accent-dark); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.grey { background: #f3eef1; color: var(--muted); }

/* ── герой / вход ── */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center;
  margin: 10px 0 34px;
}
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 480px; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-tags span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; }
.auth-card { max-width: 420px; width: 100%; justify-self: end; }
.tabs { display: flex; background: var(--pink-50); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: none; font: inherit; font-weight: 800; color: var(--muted); padding: 9px; border-radius: 999px; cursor: pointer; }
.tabs button.active { background: #fff; color: var(--accent-dark); box-shadow: 0 2px 8px rgba(201, 88, 135, .12); }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }

/* ── прайс ── */
.prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.price {
  position: relative; overflow: hidden; text-align: center; padding: 28px 20px 24px;
  background: linear-gradient(160deg, #fff 30%, var(--pink-50));
}
.price .count { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.price .sum { font-family: var(--font-head); font-size: 40px; font-weight: 700; color: var(--accent); margin: 8px 0 4px; }
.price .per { color: var(--muted); font-size: 14px; }
.price.best { border: 2px solid var(--pink-300); }
.price.best::before { content: 'Выгодно'; position: absolute; top: 14px; right: -30px; transform: rotate(35deg); background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; padding: 3px 34px; }

/* ── расписание ── */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .range { font-family: var(--font-head); font-weight: 700; min-width: 170px; text-align: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 18px; color: var(--accent-dark); display: grid; place-items: center; }
.icon-btn:hover { background: var(--pink-50); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.day { background: rgba(255, 255, 255, .6); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; min-height: 160px; }
.day.today { background: #fff; border-color: var(--pink-300); box-shadow: var(--shadow); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 10px; }
.day-head b { font-family: var(--font-head); font-size: 15px; text-transform: capitalize; }
.day-head .wd-full { display: none; }
@media (max-width: 1020px) { .day-head .wd-full { display: inline; } .day-head .wd-short { display: none; } }
.day-head span { color: var(--muted); font-size: 13px; font-weight: 700; }
.day.today .day-head span { color: var(--accent); }
.day-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; opacity: .7; }
.slots { display: flex; flex-direction: column; gap: 9px; }
.slot {
  background: #fff; border-radius: 14px; padding: 11px; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; transition: .15s;
}
.slot.clickable { cursor: pointer; }
.slot.clickable:hover { border-color: var(--pink-300); box-shadow: var(--shadow); }
.slot.mine { background: linear-gradient(160deg, #fff, var(--pink-100)); border-color: var(--pink-300); }
.slot.past { opacity: .55; }
.slot .time { font-family: var(--font-head); font-weight: 700; font-size: 17px; }
.slot .title { font-weight: 800; font-size: 14px; }
.slot .trainer { color: var(--muted); font-size: 13px; }
.spots { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.bar { height: 6px; border-radius: 9px; background: var(--pink-50); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink-300), var(--accent)); border-radius: 9px; }
.bar.full i { background: var(--bad); }
.slot .btn { padding: 7px 10px; font-size: 13.5px; }

/* ── абонемент клиента ── */
.balance {
  display: flex; align-items: center; gap: 26px; padding: 26px;
  background: linear-gradient(135deg, #fff 0%, var(--pink-100) 100%);
}
.ring { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num b { font-family: var(--font-head); font-size: 46px; line-height: 1; color: var(--accent); }
.ring .num span { font-size: 13px; color: var(--muted); font-weight: 700; }
.balance h2 { margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: repeat(2, auto); gap: 4px 18px; margin-top: 10px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 800; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px dashed var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .main { display: flex; flex-direction: column; }
.list-item .main b { font-weight: 800; }
.date-chip {
  width: 52px; flex-shrink: 0; text-align: center; border-radius: 12px; background: var(--pink-50); padding: 6px 0;
  font-family: var(--font-head); line-height: 1.1;
}
.date-chip b { display: block; font-size: 20px; color: var(--accent-dark); }
.date-chip small { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .em { font-size: 34px; display: block; margin-bottom: 6px; }

.pass-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pass-card.active { border-color: var(--pink-300); background: var(--pink-50); }
.dots { display: flex; flex-wrap: wrap; gap: 5px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--pink-300); }
.dots i.used { background: #eadde3; }

/* ── таблица ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 800; padding: 10px 12px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--pink-50); }

/* ── состав группы ── */
.roster { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--pink-50); flex-wrap: wrap; }
.person .who-p { flex: 1; min-width: 140px; }
.person .who-p b { display: block; }
.seg { display: inline-flex; background: #fff; border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 800; padding: 6px 11px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button.on-booked { background: var(--pink-100); color: var(--accent-dark); }
.seg button.on-attended { background: var(--ok-bg); color: var(--ok); }
.seg button.on-noshow { background: var(--bad-bg); color: var(--bad); }
.x-btn { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; }
.x-btn:hover { background: var(--bad-bg); color: var(--bad); }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; z-index: 5; }
.picker-list button { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; font: inherit; text-align: left; padding: 10px 14px; cursor: pointer; gap: 10px; }
.picker-list button:hover { background: var(--pink-50); }

.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekdays label { cursor: pointer; }
.weekdays input { display: none; }
.weekdays span { display: inline-block; width: 42px; text-align: center; padding: 8px 0; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 800; color: var(--muted); }
.weekdays input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── модалка и тосты ── */
.modal { position: fixed; inset: 0; background: rgba(75, 42, 59, .32); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow-y: auto; }
.modal-card { position: relative; background: #fff; border-radius: 24px; padding: 26px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(120, 40, 80, .25); animation: pop .18s ease-out; }
.modal-card.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--pink-50); font-size: 22px; color: var(--accent-dark); cursor: pointer; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 420px); }
.toast { background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: pop .2s; }
.toast.ok { background: #3f8f6e; }
.toast.bad { background: #c2434f; }
.toast.warn { background: #c27a22; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat b { font-family: var(--font-head); font-size: 26px; color: var(--accent-dark); display: block; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }

.loading { text-align: center; padding: 60px; color: var(--muted); }
.footer { text-align: center; color: var(--muted); font-size: 14px; margin-top: 40px; }

/* ── адаптив ── */
@media (max-width: 1020px) {
  .week { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .day { min-height: 0; }
}
@media (max-width: 820px) {
  .hero, .grid-2 { grid-template-columns: 1fr; }
  .auth-card { justify-self: stretch; max-width: none; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  .brand-text small { display: none; }
  .brand { flex: 1; min-width: 0; }
  .who .small { display: none; }
  .day.past-day { display: none; }
  .balance { flex-direction: column; text-align: center; }
  .facts { justify-content: center; }
  .week { grid-template-columns: 1fr; }
  .day-empty { display: none; }
  .day:has(.day-empty) { padding-bottom: 2px; }
  .modal-card { padding: 22px 18px; }
}
