/* Дополнения к стилю кабинета первенства (app.css): анкета, фото 3×4, список сборной. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-content: start; }
.form-grid .wide, .form-grid .fld.wide, .form-grid .actions, .form-grid .hint.wide { grid-column: 1 / -1; }
.form-grid .fld > label.field, .form-grid .fld > fieldset { height: 100%; }
.form-grid textarea { min-height: 76px; }
.fld[hidden] { display: none; }
.req { color: var(--red); font-style: normal; }
label.field.err input, label.field.err select, label.field.err textarea { border-color: var(--red); background: var(--red-tint); }
.field-err { color: var(--red); font-size: 12.5px; font-weight: 600; }
fieldset.radios { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.radios legend { padding: 0; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-mid);
  background: var(--paper); cursor: pointer; font-size: 14px; }
.radio:has(input:checked) { border-color: var(--violet); background: var(--violet-tint); color: var(--violet); font-weight: 600; }
.radio input { accent-color: var(--violet); margin: 0; }
fieldset.radios.err .radio { border-color: var(--red); }
.side a .side-ok { margin-left: auto; color: var(--green); display: inline-flex; }
.steps.steps-wide { max-width: 640px; }
.steps.steps-wide a span { font-size: 11px; }
.section-card { display: block; color: inherit; }
.section-card:hover { border-color: var(--violet); }
.disc-ico.ok { background: var(--green-tint); color: var(--green); }
.photo-box { margin-top: 12px; width: 180px; aspect-ratio: 3 / 4; background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { display: grid; place-items: center; gap: 6px; color: var(--faint); font-size: 12px; }
.photo-rules { margin: 14px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.warn { color: var(--orange); }
.plain { margin: 0; padding-left: 18px; line-height: 1.8; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 260px; max-width: 360px; }
.roster .meter { width: 80px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--violet); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
details.card summary { cursor: pointer; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .roster .meter { display: none; }
}

/* ───────────────────── сообщения под полем ───────────────────── */

.field-warn { color: var(--orange); font-size: 12.5px; font-weight: 500; line-height: 1.45; }
.field-err, .field-warn { animation: msg-in .3s var(--ease); }
.field-err[hidden], .field-warn[hidden], .hint[hidden], .req[hidden] { display: none; }
.side a .side-ok[hidden] { display: none; }
.form-grid .todo { margin: 0; color: var(--orange); font-size: 13px; font-weight: 500; animation: msg-in .3s var(--ease); }
.todo[hidden] { display: none; }
.todo span { text-transform: lowercase; }
.suggest-box { display: block; position: relative; }
.suggest-box.is-open input { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-tint-2); }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } }

/* ───────────────────── автосохранение ───────────────────── */

/* Плашка в углу: что сейчас с данными. Через несколько секунд после «Сохранено» бледнеет, но не исчезает —
   чтобы в любой момент было видно, что введённое не пропадёт. */
.save-state {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  background: var(--court); color: #fff; font-size: 12.5px; font-weight: 600;
  border-left: 3px solid var(--lilac); box-shadow: 0 10px 30px rgba(20, 18, 26, .22);
  animation: save-in .4s var(--ease);
  transition: opacity .5s, transform .4s var(--ease), border-color .25s;
}
.save-state[hidden] { display: none; }
.save-state.is-quiet { opacity: .55; transform: translateY(2px); }
.save-state.is-quiet:hover { opacity: 1; }
.save-state i { width: 12px; height: 12px; flex: 0 0 auto; display: block; }
.save-state[data-state=saving] i {
  border: 2px solid rgba(255, 255, 255, .25); border-top-color: var(--lilac); border-radius: 50%;
  animation: spin .7s linear infinite;
}
.save-state[data-state=saved] { border-left-color: #4FC27D; }
.save-state[data-state=saved] i {
  width: 11px; height: 6px; margin: 0 1px 3px; border: solid #4FC27D; border-width: 0 0 2px 2px;
  transform: rotate(-45deg); animation: tick-in .35s var(--ease);
}
.save-state[data-state=partial] { border-left-color: #F2A65A; }
.save-state[data-state=partial] i { background: #F2A65A; transform: rotate(45deg) scale(.7); }
.save-state[data-state=error] { border-left-color: #F0676F; }
.save-state[data-state=error] i { background: #F0676F; animation: blink 1.2s ease-in-out infinite; }
@keyframes save-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes tick-in { from { opacity: 0; transform: rotate(-45deg) scale(.3); } }
@keyframes blink { 50% { opacity: .35; } }

/* ───────────────────── движение ───────────────────── */

/* Переход между страницами кабинета: шапка и меню стоят на месте, сменяется только содержимое. */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.side { view-transition-name: side; }
.page { view-transition-name: page; }
::view-transition-old(page) { animation: page-out .1s ease-in both; }
::view-transition-new(page) { animation: page-in .26s var(--ease) both; }
::view-transition-group(topbar), ::view-transition-group(side) { animation: none; }
::view-transition-old(topbar), ::view-transition-old(side) { display: none; }
::view-transition-new(topbar), ::view-transition-new(side) { animation: none; }
@keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

/* Блоки страницы поднимаются по очереди. */
.page > * { animation: rise .5s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .05s; }
.page > *:nth-child(3) { animation-delay: .1s; }
.page > *:nth-child(4) { animation-delay: .15s; }
.page > *:nth-child(n+5) { animation-delay: .2s; }
.page > .save-state { animation: save-in .4s var(--ease); }
.grid > .card { animation: rise .5s var(--ease) both; animation-delay: calc(var(--n, 0) * 45ms + .12s); }
.grid > .card:nth-child(2) { --n: 1; } .grid > .card:nth-child(3) { --n: 2; } .grid > .card:nth-child(4) { --n: 3; }
.grid > .card:nth-child(5) { --n: 4; } .grid > .card:nth-child(6) { --n: 5; } .grid > .card:nth-child(7) { --n: 6; }
.roster > li { animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--n, 12), 12) * 25ms); }
.roster > li:nth-child(1) { --n: 0; } .roster > li:nth-child(2) { --n: 1; } .roster > li:nth-child(3) { --n: 2; }
.roster > li:nth-child(4) { --n: 3; } .roster > li:nth-child(5) { --n: 4; } .roster > li:nth-child(6) { --n: 5; }
.roster > li:nth-child(7) { --n: 6; } .roster > li:nth-child(8) { --n: 7; } .roster > li:nth-child(9) { --n: 8; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Обзор: линия шагов прочерчивается слева направо, ромбы загораются по очереди. */
.hero .steps li { animation: step-in .45s var(--ease) both; animation-delay: calc(var(--n, 0) * 60ms + .2s); }
.hero .steps li:nth-child(2) { --n: 1; } .hero .steps li:nth-child(3) { --n: 2; } .hero .steps li:nth-child(4) { --n: 3; }
.hero .steps li:nth-child(5) { --n: 4; } .hero .steps li:nth-child(6) { --n: 5; } .hero .steps li:nth-child(7) { --n: 6; }
.hero .steps li:nth-child(8) { --n: 7; }
.hero .steps li:not(:last-child)::after {
  transform-origin: 0 50%; animation: line-draw .5s var(--ease) both; animation-delay: calc(var(--n, 0) * 60ms + .3s);
}
.hero-art { animation: art-in 1.1s var(--ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes line-draw { from { transform: scaleX(0); } }
@keyframes art-in { from { opacity: 0; translate: 24px 0; } }

/* Карточки разделов: приподнимаются под курсором, галочка «заполнено» выскакивает. */
.section-card { transition: border-color .2s, transform .3s var(--ease), box-shadow .3s var(--ease); }
.section-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(91, 47, 176, .10); }
.section-card:active { transform: translateY(0); }
.disc-ico { transition: background .25s, color .25s, transform .35s var(--ease); }
.section-card:hover .disc-ico { transform: scale(1.06); }
.disc-ico.ok .ico, .side-ok.is-pop { animation: pop .45s var(--ease) both; }
.disc-ico.ok .ico { animation-delay: .35s; }
@keyframes pop { from { opacity: 0; transform: scale(.3) rotate(-20deg); } 60% { transform: scale(1.2); } }

/* Поля, появляющиеся по выбору: выезжают сверху, уходят быстро. */
.fld.is-entering { animation: fld-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.fld.is-leaving { animation: fld-out .2s ease-in both; pointer-events: none; }
@keyframes fld-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
@keyframes fld-out { to { opacity: 0; transform: translateY(-6px); } }

/* Ошибка — поле вздрагивает; сервер поправил значение — мягкая зелёная вспышка. */
.field.is-shaking { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.fld.is-fixed input, .fld.is-fixed textarea, .fld.is-fixed select { animation: fixed 1s ease-out; }
@keyframes fixed { 0%, 30% { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); } }
label.field input, label.field select, label.field textarea { transition: border-color .2s, box-shadow .2s, background .25s; }

/* Переключатели и флажки. */
.radio { transition: border-color .15s, background .2s, color .15s, transform .15s; }
.radio:hover { border-color: var(--violet); }
.radio:active { transform: scale(.97); }
.check input, .radio input { transition: transform .2s var(--ease); }
.check input:checked, .radio input:checked { animation: pop-small .3s var(--ease); }
@keyframes pop-small { from { transform: scale(.6); } }

/* Сообщения: выезжают, а «сохранено» через несколько секунд складывается (motion.js). */
.flash { animation: flash-in .45s var(--ease) both; overflow: hidden;
  transition: height .45s var(--ease), opacity .3s, margin .45s var(--ease), padding .45s var(--ease), border-width .45s; }
.flash.is-leaving { height: 0 !important; opacity: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px); } }

/* Фото: рамка плавно принимает снимок, во время загрузки по ней идёт блик. */
.photo-box { position: relative; transition: border-color .2s; }
.photo-box img { animation: photo-in .5s var(--ease); }
.photo-box.is-loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  background-size: 250% 100%; animation: sheen 1.1s linear infinite;
}
@keyframes photo-in { from { opacity: 0; transform: scale(1.04); } }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -130% 0; } }

/* Шкала заполненности в списке сборной набегает слева. */
.meter { animation: meter-in .9s var(--ease) both; }
@keyframes meter-in { from { background-size: 0% 100%; } }
.stat { animation: rise .5s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
@media (max-width: 700px) {
  .save-state { left: 12px; right: 12px; bottom: 12px; justify-content: center; }
}

/* Поля в одной строке сетки равны по высоте, но само поле ввода не растягивается — пустое место уходит вниз. */
.form-grid .fld > label.field, .form-grid .fld > fieldset { align-content: start; }
fieldset.radios legend {
  margin-bottom: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
fieldset.radios { gap: 7px; }
label.field > span.suggest-box { font-size: inherit; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); }

/* ───────────────────── кабинет организатора ───────────────────── */

.stat-tabs > a.card { display: block; color: inherit; transition: border-color .2s, transform .3s var(--ease), box-shadow .3s var(--ease); }
.stat-tabs > a.card:hover { border-color: var(--violet); transform: translateY(-2px); }
.stat-tabs > a.card.on { border-color: var(--violet); box-shadow: inset 0 -3px 0 var(--violet); }
.grid.c4.stat-tabs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; align-items: end; }
.filters .wide { grid-column: 1 / -1; }
.filters .actions { margin-top: 2px; }
.filters .found { margin-left: auto; color: var(--muted); font-size: 13px; }
.filters .found b { color: var(--ink); }
.export .actions { margin-top: 12px; }
.export .hint { margin-top: 12px; }
.roster > li { gap: 12px; }
.avatar.ghost { display: inline-grid; place-items: center; background: #EFEDF3; color: var(--faint); font-weight: 700; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head .link { font-size: 12.5px; font-weight: 600; color: var(--violet); flex: 0 0 auto; }
.fact-note { margin: 0 0 4px !important; padding: 6px 10px; background: var(--orange-tint); color: var(--orange) !important; font-size: 12.5px; max-width: none !important; }
.dossier .facts > div > span:last-child { max-width: 62%; overflow-wrap: anywhere; }
.checks { list-style: none; padding: 0; margin-top: 12px; font-size: 13.5px; }
.checks li { padding-left: 20px; position: relative; color: var(--ink-2); }
.checks li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; background: var(--line-mid); transform: rotate(45deg); }
.checks li.ok::before { background: var(--green); }
.tabs-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tabs-row a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1px solid var(--line-mid); background: var(--paper);
  font-size: 13px; font-weight: 600; color: var(--ink-2); transition: border-color .15s, background .15s, color .15s; }
.tabs-row a:hover { border-color: var(--violet); color: var(--violet); }
.tabs-row a.on { background: var(--court); border-color: var(--court); color: #fff; }
.tabs-row a .ico { color: var(--green); }
.tabs-row a.on .ico { color: #6FDB9C; }
@media (max-width: 900px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .filters { grid-template-columns: minmax(0, 1fr); } .filters .found { margin-left: 0; } }
