:root {
  --ground: #f4f6f8;
  --surface: #ffffff;
  --ink: #1a2430;
  --muted: #5d6b7a;
  --accent: #1d4f76;
  --line: #d9e0e7;
  --bad: #9b2c2c;
  --bad-soft: #fdeaea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 64px;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 640px; margin: 0 auto; }
.wrap--wide { max-width: 900px; }

header.site {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
header.site a { color: var(--accent); }
.site-name { font-weight: 600; font-size: 18px; }

h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 32px 0 10px; }
p { margin: 0 0 14px; max-width: 62ch; }
.lede { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

label { display: block; font-weight: 600; margin: 16px 0 6px; }
.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.helptext { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }

button, .button {
  margin-top: 22px;
  padding: 11px 20px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.1); }

.errors {
  background: var(--bad-soft);
  border-left: 3px solid var(--bad);
  color: var(--bad);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
}
.errors ul { margin: 0; padding-left: 18px; }

.muted { color: var(--muted); font-size: 14px; }
.links { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 15px; }
.links a { color: var(--accent); margin-right: 18px; }

ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tag { font-size: 13px; color: var(--muted); }

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #121a23;
    --surface: #1a232e;
    --ink: #e2e8ee;
    --muted: #93a1b0;
    --accent: #7cb0d8;
    --line: #2a3644;
    --bad: #f0a0a0;
    --bad-soft: #33232a;
  }
  .field { background: #121a23; }
}

/* Кнопка выхода должна выглядеть ссылкой: выход обязан быть POST-ом
   (в Django 5 GET на выход отдаёт 405), но человеку это знать незачем. */
.linklike {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.linklike:hover { filter: none; opacity: .75; }

/* Обёртка поля формы. Без блока input и кнопка встают в одну строку. */
.row { margin-bottom: 4px; }
.row .field { max-width: 420px; }

/* Анкета */
.req { color: var(--bad); }
.actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.notice {
  margin-top: 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
.msg { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; background: var(--surface); border-left: 3px solid var(--accent); }
.msg.error { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
ul.checks { list-style: none; padding: 0; margin: 8px 0 0; }
ul.checks li { padding: 2px 0; }

/* Карточка тренера */
.card-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.card-table th, .card-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.card-table th { width: 34%; font-weight: 600; }
.thumb { max-width: 120px; max-height: 120px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; margin-right: 10px; }

/* Фотография тренера — на экране, в PDF не попадает (TZ §13.17) */
.coach-header { display: flex; gap: 20px; align-items: center; margin-bottom: 4px; }
.coach-header h1 { margin-bottom: 4px; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); flex-shrink: 0;
}
.avatar-placeholder {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 600;
}
.avatar--lg, .avatar-placeholder.avatar--lg { width: 96px; height: 96px; font-size: 34px; }
.avatar-card { display: flex; gap: 20px; align-items: flex-start; }
.avatar-card .avatar, .avatar-card .avatar-placeholder { width: 96px; height: 96px; font-size: 34px; }
.avatar-controls { flex: 1; min-width: 220px; }
.avatar-controls label { margin-top: 0; }
.avatar-controls .actions { margin-top: 16px; }

/* Список тренеров */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 20px 0 26px; }
.filter { display: flex; flex-direction: column; }
.filter label { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.filter .field { width: auto; min-width: 150px; }
.filter--actions { flex-direction: row; gap: 10px; }
.filter--actions button, .filter--actions .button { margin-top: 0; }
.warn { color: var(--flag, #a8681a); }
