/* Общая основа: цвета, шрифты, кнопки, поля. Подключается и в регистрации, и в админке. */

:root {
  color-scheme: light;

  --ink: #101a3d;
  --ink-2: #444e6b;
  --ink-3: #6f7992;
  --line: #e1e5ef;
  --line-2: #c9d0e1;
  --paper: #ffffff;
  --mist: #f3f5fa;
  --tatami: #eceee6;

  --blue: #2457d6;
  --blue-d: #1b44ad;
  --blue-50: #eef3ff;
  --blue-100: #dbe5ff;

  --red: #d92d3a;
  --red-d: #b3202c;
  --red-50: #fdecee;

  --green: #16794a;
  --green-50: #e5f6ec;
  --amber: #9a4a06;
  --amber-50: #fff1dc;

  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --tap: 52px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: 3px; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(36, 87, 214, .45);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.num { font-variant-numeric: tabular-nums; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px;
  border: 0; border-radius: var(--r);
  font-weight: 700; font-size: 17px; line-height: 1.2; text-decoration: none;
  color: #fff; background: var(--blue);
  transition: background-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--blue-d); }
.btn:active { transform: scale(.985); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--line-2); color: #fff; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

.btn.secondary { background: var(--blue-50); color: var(--blue); }
.btn.secondary:hover { background: var(--blue-100); }
.btn.secondary[disabled] { background: var(--mist); color: var(--ink-3); }

.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--mist); }

.btn.danger { background: var(--red); }
.btn.danger:hover { background: var(--red-d); }
.btn.danger-ghost { background: transparent; color: var(--red-d); }
.btn.danger-ghost:hover { background: var(--red-50); }

.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 11px; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.secondary.busy::after, .btn.ghost.busy::after { border-color: var(--blue-100); border-top-color: var(--blue); }

.link-btn {
  background: none; border: 0; padding: 4px 2px; color: var(--blue); font-weight: 600; font-size: 16px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2); -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--mist); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- поля ---------- */

.field { display: grid; gap: 7px; }
.field > label, .field > .label { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 14px; color: var(--ink-3); }
.field .error { font-size: 14px; font-weight: 600; color: var(--red-d); display: flex; gap: 6px; align-items: flex-start; }

.input {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  font-size: 17px; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line-2); border-radius: 12px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: #9aa3b8; }
.input:hover { border-color: #aab4cc; }
.input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(36, 87, 214, .16); }
.input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 4px rgba(217, 45, 58, .1); }
.input[disabled] { background: var(--mist); color: var(--ink-3); }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }

select.input {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236f7992' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}

/* Выбор из двух: пол */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: grid; place-items: center; min-height: var(--tap);
  border: 1.5px solid var(--line-2); border-radius: 12px;
  font-weight: 700; font-size: 18px; color: var(--ink-2); background: var(--paper);
  transition: all .15s var(--ease); -webkit-tap-highlight-color: transparent;
}
.seg label:hover { border-color: #aab4cc; }
.seg input:checked + label { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid rgba(36, 87, 214, .45); outline-offset: 2px; }
.seg[aria-invalid="true"] label { border-color: var(--red); }

/* Плашки: тренеры, разряды */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--line-2); border-radius: 999px; font-weight: 600; font-size: 16px; color: var(--ink-2);
  background: var(--paper); transition: all .15s var(--ease); -webkit-tap-highlight-color: transparent;
}
.chip label:hover { border-color: #aab4cc; }
.chip input:checked + label { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip input:checked + label::before {
  content: ""; width: 14px; height: 14px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip input:focus-visible + label { outline: 3px solid rgba(36, 87, 214, .45); outline-offset: 2px; }
.chips[aria-invalid="true"] .chip label { border-color: var(--red); }

/* ---------- мелочи ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 700; line-height: 1.4; background: var(--mist); color: var(--ink-2); white-space: nowrap;
}
.pill.green { background: var(--green-50); color: var(--green); }
.pill.amber { background: var(--amber-50); color: var(--amber); }
.pill.red { background: var(--red-50); color: var(--red-d); }
.pill.blue { background: var(--blue-50); color: var(--blue); }

.notice {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r);
  background: var(--blue-50); color: var(--ink); font-size: 16px;
}
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 1px; color: var(--blue); }
.notice.warn { background: var(--amber-50); }
.notice.warn svg { color: var(--amber); }
.notice.error { background: var(--red-50); }
.notice.error svg { color: var(--red-d); }
.notice .actions-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  /* сверху: внизу у экранов лежит панель с главными кнопками */
  position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); z-index: 100;
  display: grid; gap: 8px; justify-items: center; padding: 0 16px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 13px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 16px; font-weight: 600; box-shadow: 0 10px 30px rgba(16, 26, 61, .28);
  animation: toast-in .25s var(--ease);
}
.toast.error { background: var(--red-d); }
.toast svg { width: 20px; height: 20px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

dialog {
  width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(16, 26, 61, .35);
}
dialog::backdrop { background: rgba(16, 26, 61, .5); }
dialog h3 { font-size: 22px; margin-bottom: 8px; }
dialog p { color: var(--ink-2); }
dialog .dialog-actions { display: grid; gap: 8px; margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
