/* ============================================================
   FitCRM — единая тема сервиса (решение №11: одна тема в MVP).
   Без сборщиков: этот файл подключается напрямую.
   ============================================================ */

:root {
    --bg: #f2f5f4;
    --card: #ffffff;
    --text: #22312c;
    --muted: #6b7a74;
    --line: #dfe7e3;
    --prim: #0e7c66;
    --prim-dark: #0a5d4c;
    --prim-deep: #084c3f;
    --prim-light: #e2f2ed;
    --accent: #ee7f1f;
    --danger: #c0392b;
    --danger-bg: #fbeae7;
    --ok-bg: #e3f4ea;
    --ok-text: #1c7a45;
    --warn-bg: #fdf3df;
    --warn-text: #8a6210;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 40, 33, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1 { font-size: 26px; margin: 0 0 18px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--prim); }
a:hover { color: var(--prim-dark); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 48px; min-height: calc(100vh - 140px); }
.muted { color: var(--muted); font-size: .93em; }
.inline { display: inline; }
.right { text-align: right; }
.req { color: var(--danger); }

/* ---------- Шапка ---------- */
.topbar { background: var(--prim-deep); box-shadow: var(--shadow); }
.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand {
    font-weight: 800; font-size: 20px; letter-spacing: .3px;
    color: #fff; text-decoration: none; white-space: nowrap;
}
.brand-dark { color: var(--prim-deep); }
.brand-big { font-size: 28px; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
    color: #cfe5de; text-decoration: none; padding: 6px 12px;
    border-radius: 8px; font-size: 15px;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .16); font-weight: 600; }
.nav .nav-sep { margin-left: 10px; border-left: 1px solid rgba(255,255,255,.25); border-radius: 0 8px 8px 0; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #cfe5de; font-size: 14px; }
.nav-user-name { white-space: nowrap; }
.btn-link {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: #ffd9ae; font-size: 14px; text-decoration: underline;
}
.btn-link:hover { color: #fff; }
.burger {
    display: none; background: none; border: 0; color: #fff;
    font-size: 24px; cursor: pointer; margin-left: auto; padding: 4px 8px;
}

/* ---------- Карточки и плитки ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px;
}
.tile-num { font-size: 30px; font-weight: 800; color: var(--prim-dark); line-height: 1.1; }
.tile-label { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tile-warn .tile-num { color: var(--accent); }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block; border: 0; cursor: pointer; text-decoration: none;
    font-size: 15px; font-weight: 600; line-height: 1;
    padding: 11px 18px; border-radius: 9px; text-align: center;
    transition: background .15s;
}
.btn-primary { background: var(--prim); color: #fff; }
.btn-primary:hover { background: var(--prim-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d76f12; color: #fff; }
.btn-ghost { background: #fff; color: var(--prim-dark); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--prim); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f5d9d4; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn-wide { width: 100%; }
.btn-big { padding: 14px 26px; font-size: 17px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Формы ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=email], .field input[type=tel],
.field input[type=password], .field input[type=number], .field input[type=date],
.field input[type=time], .field input[type=datetime-local],
.field select, .field textarea {
    width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
    border: 1px solid var(--line); border-radius: 9px; background: #fff;
    color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--prim-light); border-color: var(--prim);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-check label, .check { font-weight: 400; font-size: 15px; }
.check input { margin-right: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Таблицы ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th {
    text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .4px;
    color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #f7faf9; }

/* ---------- Редактор строк упражнений ---------- */
.set-head, .set-row {
    display: grid;
    grid-template-columns: 2.2fr 74px 110px 90px 1.4fr 40px;
    gap: 8px; align-items: center;
}
.set-head {
    font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
    color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
.set-row { margin-bottom: 8px; }
.set-row input {
    width: 100%; padding: 9px 10px; font-size: 15px; font-family: inherit;
    border: 1px solid var(--line); border-radius: 8px;
}
.set-row input:focus { outline: 2px solid var(--prim-light); border-color: var(--prim); }
.workout-card h3 { margin-bottom: 4px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 18px 0; }
.pager-btn {
    padding: 8px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line);
    text-decoration: none; font-size: 14px; font-weight: 600;
}
.pager-off { color: var(--muted); opacity: .5; }
@media (max-width: 720px) {
    .set-head { display: none; }
    .set-row {
        grid-template-columns: 1fr 1fr;
        border: 1px solid var(--line); border-radius: 10px; padding: 10px;
    }
    .set-row input[name="ex[]"] { grid-column: 1 / -1; }
}

/* ---------- Фото прогресса ---------- */
.photo-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.photo-item { width: 150px; }
.photo-item img {
    width: 150px; height: 200px; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--line); display: block;
}
.photo-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 16px; }
.compare-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-pair img {
    width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--line); display: block;
}
.photo-none {
    aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px;
}

/* ---------- Живая проверка адреса страницы ---------- */
.slug-status { font-size: 13px; margin-top: 5px; min-height: 18px; color: var(--muted); }
.slug-status.slug-ok { color: var(--ok-text); font-weight: 600; }
.slug-status.slug-bad { color: var(--danger); font-weight: 600; }

/* ---------- Рабочие дни (настройки тренера) ---------- */
.days-row { display: flex; gap: 6px; flex-wrap: wrap; }
.day-check { cursor: pointer; }
.day-check input { position: absolute; opacity: 0; pointer-events: none; }
.day-check span {
    display: inline-block; padding: 8px 13px; border: 1px solid var(--line);
    border-radius: 8px; font-size: 14px; font-weight: 600; background: #fff;
    user-select: none;
}
.day-check input:checked + span {
    background: var(--prim); border-color: var(--prim); color: #fff;
}
.club-info { color: var(--muted); font-size: 14px; margin-top: 4px; }
.club-info b { color: var(--text); }

/* ---------- Отзыв клиента ---------- */
.feedback-box {
    background: var(--prim-light); border-radius: 10px;
    padding: 14px 16px; margin-top: 12px;
}
.feedback-box h3 { color: var(--prim-dark); }

/* ---------- Графики ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chart-legend i {
    display: inline-block; width: 12px; height: 12px; border-radius: 3px;
    margin-right: 5px; vertical-align: -1px;
}
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--prim); }
.range-row output { font-weight: 700; min-width: 44px; text-align: center; }

/* ---------- Календарь ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th {
    font-size: 12px; text-transform: uppercase; color: var(--muted);
    padding: 6px 4px; text-align: left;
}
.cal-day {
    vertical-align: top; border: 1px solid var(--line); padding: 6px;
    height: 92px; font-size: 13px;
}
.cal-other { background: #f7f9f8; color: var(--muted); }
.cal-today { outline: 2px solid var(--prim); outline-offset: -2px; }
.cal-num { font-weight: 700; margin-bottom: 4px; }
.cal-ev {
    background: var(--prim-light); color: var(--prim-dark); border-radius: 6px;
    padding: 3px 6px; margin-bottom: 4px; position: relative; line-height: 1.3;
}
.cal-ev-time { font-weight: 700; }
.cal-ev-del {
    background: none; border: 0; color: var(--danger); cursor: pointer;
    font-size: 13px; padding: 0 2px; float: right;
}
.trainer-head { display: flex; gap: 18px; align-items: center; }
.trainer-photo {
    width: 96px; height: 96px; object-fit: cover; border-radius: 50%;
    border: 3px solid var(--prim-light);
}

/* ---------- Значки и алерты ---------- */
.badge {
    display: inline-block; font-size: 12px; font-weight: 700; line-height: 1;
    padding: 5px 9px; border-radius: 20px; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-err { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: #edf1ef; color: var(--muted); }
.badge-prim { background: var(--prim-light); color: var(--prim-dark); }

.alert {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 15px;
}
.alert a { font-weight: 600; }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
.alert-err { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
.alert-list { margin: 0; padding-left: 18px; }

/* ---------- Вкладки ---------- */
.tabs {
    display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 18px;
    border-bottom: 2px solid var(--line);
}
.tabs a {
    padding: 9px 14px; text-decoration: none; color: var(--muted);
    font-size: 15px; font-weight: 600; border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tabs a:hover { color: var(--prim-dark); background: #f7faf9; }
.tabs a.active { color: var(--prim-dark); border-bottom-color: var(--prim); }

/* ---------- Списки ---------- */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.start-list { padding-left: 20px; }
.start-list li { margin-bottom: 8px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- Гостевые страницы ---------- */
.guest-body { background: linear-gradient(160deg, #eef4f2, #dcebe6); min-height: 100vh; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 48px 16px; text-align: center; }
.auth-wrap .brand { display: inline-block; margin-bottom: 18px; font-size: 26px; }
.auth-card { text-align: left; padding: 26px; }
.auth-title { font-size: 22px; margin-top: 0; }
.auth-foot { margin-top: 16px; font-size: 15px; color: var(--muted); }
.auth-foot .dot { margin: 0 6px; }

/* ---------- Витрина ---------- */
.landing { max-width: 980px; margin: 0 auto; padding: 60px 16px 20px; }
.landing-hero { text-align: center; margin-bottom: 44px; }
.landing-hero h1 { font-size: 34px; max-width: 700px; margin: 14px auto 0; }
.landing-sub { max-width: 640px; margin: 14px auto 22px; color: var(--muted); font-size: 17px; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.feat {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px;
}
.feat b { display: block; margin-bottom: 4px; color: var(--prim-dark); }
.feat span { color: var(--muted); font-size: 14px; }

/* ---------- Подвал ---------- */
.footer {
    padding: 18px 0 26px; text-align: center; color: var(--muted); font-size: 13px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
    .burger { display: block; }
    .nav {
        display: none; position: absolute; left: 0; right: 0; top: 56px;
        background: var(--prim-deep); flex-direction: column; align-items: stretch;
        padding: 8px 16px 14px; z-index: 50; gap: 2px;
    }
    .topbar { position: relative; }
    .nav.open { display: flex; }
    .nav a { padding: 11px 12px; }
    .nav .nav-sep { margin-left: 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.25); border-radius: 0; }
    .nav-user { margin-left: 0; padding-top: 10px; justify-content: space-between; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    h1 { font-size: 22px; }
    .landing-hero h1 { font-size: 26px; }
}

/* Таблица → карточки на телефоне (ячейки подписываются data-label) */
@media (max-width: 640px) {
    .tbl-collapse thead { display: none; }
    .tbl-collapse tr {
        display: block; border: 1px solid var(--line); border-radius: 10px;
        margin-bottom: 10px; padding: 6px 10px; background: #fff;
    }
    .tbl-collapse td {
        display: flex; justify-content: space-between; gap: 12px;
        border-bottom: 1px dashed var(--line); padding: 7px 2px; text-align: right;
    }
    .tbl-collapse td:last-child { border-bottom: 0; }
    .tbl-collapse td::before {
        content: attr(data-label); font-weight: 600; color: var(--muted);
        font-size: 13px; text-align: left;
    }
    .tbl-collapse tr:hover td { background: transparent; }
}
