/* ИС «Спортивный клуб» — уровень представления */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1d2433; --muted: #5b6577; --line: #dde2ea;
  --brand: #1f5fbf; --brand-ink: #ffffff; --brand-soft: #e8f0fb;
  --ok: #1b7a43; --ok-soft: #e5f4ea; --warn: #9a6400; --warn-soft: #fdf3dc;
  --err: #b42318; --err-soft: #fdecea; --side: #17233a; --side-ink: #c9d3e3;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* --- каркас --- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 16px; padding: 0 8px 16px; border-bottom: 1px solid #2b3a57; margin-bottom: 12px; }
.brand .logo { width: 30px; height: 30px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; font-weight: 700; }
.side a { display: block; color: var(--side-ink); padding: 8px 10px; border-radius: 6px; margin-bottom: 2px; }
.side a small { display: block; color: #8796b0; font-size: 12px; }
.side a:hover { background: #22314f; text-decoration: none; color: #fff; }
.side a.active { background: var(--brand); color: #fff; }
.side a.active small { color: #dbe6f7; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top .who { display: flex; gap: 12px; align-items: center; }
.badge-role { background: var(--brand-soft); color: var(--brand); border-radius: 20px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
main { padding: 20px 24px 40px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* --- блоки --- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 2px; }
.kpi .l { color: var(--muted); font-size: 13px; }
.help { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.help summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.help ol, .help ul { margin: 6px 0 0 18px; padding: 0; }

/* --- сообщения --- */
.flash { border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b7e0c5; color: var(--ok); }
.flash.error { background: var(--err-soft); border-color: #f5c2bd; color: var(--err); font-weight: 600; }
.flash.info { background: var(--warn-soft); border-color: #f0dca8; color: var(--warn); }

/* --- таблицы --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0f3f7; font-weight: 600; color: #344054; font-size: 13px; }
tr.subtotal td { background: #f6f8fb; font-weight: 600; }
tr.total td { background: #e9eef6; font-weight: 700; }
tr:target td { background: #fff7d6; }
td.num, th.num { text-align: right; white-space: nowrap; }
table.kv th { width: 38%; white-space: nowrap; background: #f6f8fb; }

/* --- состояния --- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.gray { background: #eef0f3; color: var(--muted); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }

/* --- формы --- */
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field label .req { color: var(--err); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input, select, textarea { width: 100%; font: inherit; padding: 7px 9px; border: 1px solid #c5ccd8; border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec0f0; border-color: var(--brand); }
input:invalid:not(:placeholder-shown) { border-color: var(--err); }
input[type=checkbox], input[type=radio] { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.light { background: #fff; color: var(--brand); }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }

/* --- расписание --- */
.day { margin-bottom: 14px; }
.day h3 { margin: 0 0 6px; }
.slot { display: grid; grid-template-columns: 96px 1fr 170px 120px; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: #fff; }
.slot:target { outline: 2px solid var(--warn); }
.slot .time { font-weight: 700; }
.bar { height: 7px; background: #e6eaf0; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--brand); }
.bar i.full { background: var(--err); }

/* --- вход --- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #17233a, #1f5fbf); padding: 16px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.demo { font-size: 13px; background: #f6f8fb; border-radius: 6px; padding: 10px 12px; margin-top: 16px; }
.demo code { background: #e9eef6; padding: 0 4px; border-radius: 3px; }

/* --- квитанция --- */
.receipt { max-width: 560px; margin: 0 auto; background: #fff; border: 1px dashed #9aa4b5; padding: 24px; }
@media print { .side, .top, .no-print, .flash { display: none !important; } .layout { display: block; } main { padding: 0; } body { background: #fff; } }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .slot { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
