/* Фотобанк лиг. Палитра: лёд, тёмно-синий борта, голубой Ligasy; красный только для опасных действий. */
:root {
  --ice: #f2f6f9;
  --white: #ffffff;
  --navy: #0a1f44;
  --navy-2: #163063;
  --ink: #0d1b33;
  --muted: #586a80;
  --line: #d6dfe8;
  --line-strong: #b9c7d6;
  --cyan: #00aeef;
  --link: #0072a8;
  --cyan-tint: #e3f5fc;
  --red: #c4232b;
  --red-tint: #fcebec;
  --green: #1c6d45;
  --green-tint: #e5f3ea;
  --amber: #8a5a00;
  --amber-tint: #fdf3dc;
  --r: 0;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-score: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", var(--font);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ice); color: var(--ink); font: 15px/1.5 var(--font); }
body.no-scroll { overflow: hidden; }
a { color: var(--link); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin-top: 18px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- шапка ---- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: stretch; gap: 24px;
  min-height: 58px; padding: 0 24px;
  background: var(--navy); color: var(--white);
}
.brand {
  display: flex; align-items: center; gap: 11px;
  color: var(--white); text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap;
}
.brand img { width: 40px; height: 40px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-weight: 800; font-size: 17px; letter-spacing: .01em; }
.brand-text small { font-size: 10px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: var(--cyan); margin-top: 2px; }
.league-tabs, .nav { display: flex; gap: 2px; }
.league-tabs a, .nav a {
  display: flex; align-items: center; padding: 0 14px;
  color: rgba(255, 255, 255, .74); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.league-tabs a.code { text-transform: uppercase; letter-spacing: .03em; }
.league-tabs a:hover, .nav a:hover { color: var(--white); background: rgba(255, 255, 255, .07); }
.league-tabs a[aria-current="page"], .nav a[aria-current="page"] { color: var(--white); border-bottom-color: var(--cyan); }
.me { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.me-link { color: var(--white); text-decoration: none; font-weight: 600; }
.me-link:hover { text-decoration: underline; }
.me-role { color: rgba(255, 255, 255, .62); }
.me form { margin: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: rgba(255, 255, 255, .74); }
button.link:hover { color: var(--white); text-decoration: underline; }

.main { padding: 22px 24px 96px; max-width: 1480px; margin: 0 auto; }
.foot { max-width: 1480px; margin: 0 auto; padding: 0 24px 40px; color: var(--muted); font-size: 13px; }

/* ---- элементы ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 0;
  background: var(--white); color: var(--navy);
  font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--navy); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn.primary:hover:not(:disabled) { background: var(--navy-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(10, 31, 68, .06); border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.danger:hover:not(:disabled) { border-color: var(--red); background: var(--red-tint); }
.btn.on { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.btn.icon { width: 36px; padding: 0; }
.btn.wide { width: 100%; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

input, select, textarea {
  font: inherit; color: inherit; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: 0; background: var(--white);
  max-width: 100%;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--navy); width: 16px; height: 16px; }
input[type="file"] { border: 0; padding: 0; background: none; min-height: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field > span { color: var(--muted); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }

.alert { padding: 10px 14px; border-radius: 0; margin: 0 0 16px; border: 1px solid; }
.alert.error { background: var(--red-tint); border-color: #f0b7ba; color: #8c1a20; }
.alert.ok { background: var(--green-tint); border-color: #a9d6bb; color: var(--green); }
.alert.warn { background: var(--amber-tint); border-color: #ecd08f; color: var(--amber); }

.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 0; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.st-pub { background: var(--green-tint); color: var(--green); }
.chip.st-draft { background: var(--amber-tint); color: var(--amber); }
.chip.st-none { background: #edf1f5; color: var(--muted); }

/* Значки лиг: щит лиги + код */
.lg {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font: 700 12px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--navy);
}
.lg img { height: 20px; width: auto; display: block; }
.league-tabs a.code { gap: 7px; }
.league-tabs a.code img { height: 22px; width: auto; }
.pub-title { display: flex; align-items: center; gap: 14px; }
.pub-title img { height: 46px; width: auto; }

.logo {
  width: 30px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center;
}
.logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo.sm { width: 22px; height: 22px; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--white); border: 1px dashed var(--line-strong); border-radius: 0; }
.empty.big { border: 0; background: none; padding-top: 80px; color: var(--ink); }
.empty.big p { color: var(--muted); }

/* ---- публичный список ---- */
.pub-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 20px; }
.pub-head h1 { margin: 0; }
.filters { display: flex; gap: 12px; align-items: end; margin: 0; }
.filters.wrap { flex-wrap: wrap; margin-bottom: 18px; padding: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 0; }
.filter { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.filter.grow { flex: 1 1 220px; }
.filter select, .filter input { color: var(--ink); min-width: 0; }

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  display: flex; flex-direction: column; background: var(--white); border-radius: 0; overflow: hidden;
  border: 1px solid var(--line); color: inherit; text-decoration: none;
}
.card:hover { border-color: var(--navy); }
.card-img { position: relative; aspect-ratio: 3 / 2; background: #dde6ee; overflow: hidden; display: block; }
.card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-count {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 0;
  background: rgba(10, 31, 68, .82); color: var(--white); font-size: 12px; font-weight: 600;
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card-title { font-weight: 650; font-size: 16px; }
.card-sub { font-size: 13px; color: var(--muted); }

.match-line, .row-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-width: 0; }
.mt { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mt-away { justify-content: flex-end; text-align: right; }
.mt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-score { font: 700 18px/1 var(--font-score); font-variant-numeric: tabular-nums; color: var(--navy); }
.more { text-align: center; margin-top: 26px; }

/* ---- табло матча ---- */
.board {
  background: var(--navy); color: var(--white); border-radius: 0;
  padding: 18px 24px 26px; margin-bottom: 18px;
  border-bottom: 4px solid var(--cyan);
}
.board-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .72); }
.board-meta .lg { color: var(--white); font-size: 13px; gap: 8px; }
.board-meta .lg img { height: 30px; }
.board-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; margin-top: 16px; }
.board-team { display: flex; align-items: center; gap: 16px; min-width: 0; }
.board-away { flex-direction: row-reverse; text-align: right; }
.board-logo {
  width: 76px; height: 76px; flex: none; border-radius: 0; background: var(--white);
  display: flex; align-items: center; justify-content: center; padding: 9px;
}
.board-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.board-name { font-size: 22px; font-weight: 700; line-height: 1.15; }
.board-score {
  font: 700 64px/1 var(--font-score); font-variant-numeric: tabular-nums; letter-spacing: .02em;
  padding: 6px 22px; border-radius: 0; background: #061430; color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(0, 174, 239, .35);
}
.board-vs {
  font: 700 30px/1 var(--font-score); letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255, 255, 255, .5); padding: 0 10px;
}
.board-title { font-size: 30px; margin: 14px 0 0; }
.board-sub { margin: 6px 0 0; color: rgba(255, 255, 255, .72); }

.album-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.album-info { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.album-info span { color: var(--muted); }
.album-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- галерея: кладка (masonry), фото целиком без обрезки ----
   Без JS — обычная сетка; pub.js добавляет .laid и высоту каждой плитки в рядах по 2px. */
.mg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 8px; row-gap: 8px; align-items: start; }
.mg.laid { grid-auto-rows: 2px; row-gap: 0; }
.mg-item { display: block; background: #dde6ee; align-self: start; }
.mg-item img { display: block; width: 100%; height: auto; }
.mg-item:hover img { opacity: .9; }

/* ---- просмотр ---- */
.viewer, .lb {
  position: fixed; inset: 0; z-index: 100; background: #050b17; color: var(--white);
  display: flex; flex-direction: column;
}
.viewer-bar, .lb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.viewer-title, .lb-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-meta .viewer-title { flex: none; }
.viewer-info { font-size: 12px; color: rgba(255, 255, 255, .6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer-pick { font-size: 18px; width: 40px; padding: 0; }
#viewer-pick.on { color: var(--cyan); }
.viewer-count, .lb-count { color: rgba(255, 255, 255, .62); font-variant-numeric: tabular-nums; }
.viewer-stage, .lb-stage { flex: 1 1 0; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; touch-action: pan-y; }
.viewer-stage img, .lb-stage img { max-width: 100%; max-height: calc(100dvh - 60px); object-fit: contain; user-select: none; }
.viewer-nav, .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 84px;
  border: 0; background: rgba(255, 255, 255, .08); color: var(--white); font-size: 38px; cursor: pointer; border-radius: 0;
}
.viewer-nav:hover, .lb-nav:hover { background: rgba(255, 255, 255, .18); }
.viewer-nav.prev, .lb-nav.prev { left: 10px; }
.viewer-nav.next, .lb-nav.next { right: 10px; }
.viewer .btn, .lb .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: var(--white); }
.viewer .btn.primary, .lb .btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }

/* ---- вход ---- */
.auth { min-height: calc(100vh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.auth-card { width: min(400px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 0; padding: 32px; }
.auth-logo { display: block; width: 200px; height: auto; margin: 0 auto 22px; }
.auth-title { font-size: 22px; margin-bottom: 4px; text-align: center; }
.auth-sub { color: var(--muted); margin: 0 0 22px; text-align: center; }
.auth-note { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.auth-back { font-size: 14px; }

/* ---- кабинет ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.back {
  display: inline-flex; align-items: center; gap: 12px; margin: 0 0 14px;
  font-size: 17px; font-weight: 700; color: var(--navy); text-decoration: none;
}
.back-ico { width: 36px; height: 36px; flex: none; background: var(--navy); position: relative; transition: background .15s; }
.back-ico::before {
  content: ""; position: absolute; left: 15px; top: 13px; width: 9px; height: 9px;
  border: solid var(--white); border-width: 0 0 2.5px 2.5px; transform: rotate(45deg);
}
.back:hover { color: var(--navy); }
.back:hover .back-ico { background: var(--cyan); }
.back:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.days { display: flex; flex-direction: column; gap: 22px; }
.day-head { display: flex; align-items: baseline; gap: 10px; font-size: 15px; margin: 0 0 8px; }
.day-head span { color: var(--muted); font-weight: 500; }
.day-head em { font-style: normal; color: var(--white); background: var(--cyan); padding: 0 8px; border-radius: 0; font-size: 12px; font-weight: 700; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: 0; overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 52px 46px minmax(0, 1fr) 120px 130px; align-items: center; gap: 14px;
  padding: 10px 16px; color: inherit; text-decoration: none;
}
.row:hover { background: var(--cyan-tint); }
.row-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.row-count { text-align: right; color: var(--muted); font-size: 14px; }
.row .chip { justify-self: end; }
.row-match { grid-template-columns: 1fr 56px 1fr; }
.row-match .mt-score { text-align: center; font-size: 16px; }
.row-event { font-weight: 600; }
.row-match:has(.row-event) { display: flex; gap: 10px; }

.actions {
  position: sticky; top: 58px; z-index: 15;
  display: flex; align-items: center; min-height: 56px;
  margin: 0 -24px 18px; padding: 10px 24px;
  background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.actions-main, .actions-sel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.actions-state { margin-left: auto; color: var(--muted); font-size: 14px; }
.sel-count { font-weight: 700; color: var(--navy); margin-right: 8px; }

.tiles { display: grid; gap: 14px 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: start; }
.tiles.laid { grid-auto-rows: 2px; row-gap: 0; }
.tile {
  position: relative; min-width: 0; padding: 4px; cursor: default;
  user-select: none; -webkit-user-select: none;
  align-self: start;
}
.tile:hover { background: var(--white); }
.tile[aria-selected="true"] { background: var(--cyan-tint); box-shadow: inset 0 0 0 2px var(--navy); }
.tile-img { background: #dfe6ed; display: flex; align-items: center; justify-content: center; }
.tile-img.ph { aspect-ratio: 3 / 2; }
.tile-img img { width: 100%; height: auto; display: block; pointer-events: none; }
.tile-meta { padding: 7px 2px 2px; font-size: 13px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-check {
  position: absolute; top: 10px; left: 10px; z-index: 2; width: 22px; height: 22px;
  border: 2px solid var(--white); background: rgba(10, 31, 68, .4); cursor: pointer; opacity: 0;
}
.tile:hover .tile-check, .has-sel .tile-check, .tile:focus-within .tile-check { opacity: 1; }
.tile[aria-selected="true"] .tile-check { background: var(--navy); border-color: var(--navy); opacity: 1; }
.tile[aria-selected="true"] .tile-check::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
  border: solid var(--white); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
@media (pointer: coarse) { .tile-check { opacity: 1; } }
.tile-badges { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.tile-badge { padding: 2px 7px; font-size: 11px; font-weight: 700; background: var(--cyan); color: var(--navy); }
.tile-badge.pick { background: var(--navy); color: var(--cyan); }
.tile-badge.hid { background: var(--navy); color: var(--white); }
.tile-badge.busy { background: var(--white); color: var(--navy); }
.tile.is-hidden .tile-img img { opacity: .4; }
.tile.is-pending .tile-img img { filter: grayscale(.6); opacity: .75; }
.tile.processing .tile-img::after { content: "Обработка…"; color: var(--muted); font-size: 13px; }
.tile.failed .tile-img { background: var(--red-tint); }
.tile.failed .tile-img::after { content: "Не удалось обработать"; color: var(--red); font-size: 13px; padding: 8px; text-align: center; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 31, 68, .78); color: var(--white); font-size: 22px; font-weight: 600;
  border: 4px dashed var(--cyan);
}

.uploads {
  position: fixed; right: 18px; bottom: 18px; z-index: 80; width: min(380px, calc(100vw - 36px));
  background: var(--white); border: 1px solid var(--line); border-radius: 0; padding: 14px 16px;
  box-shadow: none;
}
.up-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.progress { height: 6px; background: #e3eaf1; border-radius: 0; overflow: hidden; margin: 10px 0 6px; }
.progress span { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s; }
.up-sub { margin: 0; color: var(--muted); font-size: 13px; }
.up-errors { margin: 8px 0 0; padding-left: 18px; color: var(--red); font-size: 13px; max-height: 150px; overflow: auto; }

/* диалоги */
.dlg { border: 0; border-radius: 0; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: none; }
.dlg.wide { width: min(640px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(10, 31, 68, .5); }
.dlg-title { font-size: 19px; }
.dlg-text { color: var(--muted); margin: 0 0 6px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.move-filter { width: 100%; }
.move-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 0; }
.move-list li { padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.move-list li + li { border-top: 1px solid var(--line); }
.move-list li:hover { background: var(--cyan-tint); }
.move-list li[aria-selected="true"] { background: var(--navy); color: var(--white); }
.move-list .ml-date { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.move-list li[aria-selected="true"] .ml-date { color: rgba(255, 255, 255, .7); }
.move-list .ml-label { flex: 1; }

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: var(--white); padding: 10px 16px; border-radius: 0; box-shadow: none; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
.toast.error { background: var(--red); }
.toast-act { background: none; border: 0; color: var(--cyan); font: inherit; font-weight: 700; cursor: pointer; }

/* админка */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 0; padding: 20px 22px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.panel-head h2, .panel-head form { margin: 0; }
.league-list { display: flex; flex-direction: column; }
.league-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.league-item:first-child { border-top: 0; }
.league-main p { margin: 6px 0 0; font-size: 14px; }
.league-title { display: flex; align-items: center; gap: 10px; }
.league-title input { font-weight: 600; width: 240px; }
.wm { display: flex; gap: 14px; align-items: flex-start; }
.wm-preview {
  width: 150px; height: 90px; flex: none; border-radius: 0; display: flex; align-items: center; justify-content: center;
  background-color: #8a96a6; background-image: linear-gradient(45deg, #7c8899 25%, transparent 25%, transparent 75%, #7c8899 75%), linear-gradient(45deg, #7c8899 25%, transparent 25%, transparent 75%, #7c8899 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; padding: 8px;
}
.wm-preview img { max-width: 100%; max-height: 100%; }
.wm-preview span { color: var(--white); font-size: 13px; text-align: center; }
.wm-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wm-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 0; }
.wm-actions form { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.stats div { background: var(--ice); border-radius: 0; padding: 10px 14px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 2px 0 0; font: 700 22px/1.2 var(--font-score); font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.off td { opacity: .6; }
.td-actions { text-align: right; width: 1%; white-space: nowrap; }
details.edit[open] { white-space: normal; }
.edit-body {
  position: absolute; right: 24px; z-index: 10; width: min(560px, calc(100vw - 48px)); text-align: left;
  background: var(--white); border: 1px solid var(--line-strong); border-radius: 0; padding: 18px;
  box-shadow: none; display: flex; flex-direction: column; gap: 14px;
}
.add-user { margin-top: 16px; }
.add-user > form { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.roles { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.roles legend { width: 100%; }
.radio, .check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.team-filter { width: 100%; margin-bottom: 8px; }
.team-groups { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 10px; }
.team-group { display: flex; flex-direction: column; gap: 4px; }
.team-group-title { font-size: 12px; font-weight: 700; color: var(--muted); }

@media (max-width: 900px) {
  .top { gap: 10px; padding: 0 12px; flex-wrap: wrap; }
  .league-tabs, .nav { order: 3; width: 100%; overflow-x: auto; }
  .league-tabs a, .nav a { padding: 10px 12px; }
  .main { padding: 16px 16px 80px; }
  .foot { padding: 0 16px 32px; }
  .board { padding: 14px 14px 18px; }
  .board-teams { gap: 10px; }
  .board-team, .board-away { flex-direction: column; text-align: center; gap: 8px; }
  .board-logo { width: 56px; height: 56px; border-radius: 0; }
  .board-name { font-size: 15px; }
  .board-score { font-size: 40px; padding: 4px 12px; }
  .board-vs { font-size: 22px; padding: 0; }
  .mg { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 4px; row-gap: 4px; }
  .mg.laid { row-gap: 0; }
  .row { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "t m c" "l m s"; row-gap: 4px; }
  .row-time { grid-area: t; }
  .row .lg { grid-area: l; min-width: 0; }
  .row-match { grid-area: m; }
  .row-count { grid-area: c; }
  .row .chip { grid-area: s; }
  .league-item { grid-template-columns: 1fr; }
  .league-title input { width: 100%; }
  .edit-body { right: 12px; left: 12px; width: auto; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
  .tiles.laid { row-gap: 0; }
  .tile-meta { display: none; }
  .actions { position: static; margin: 0 -16px 14px; padding: 8px 16px; }
  .brand-text small { display: none; }
}

/* управление: вкладки и таблицы как в медиахранилище */
/* без overflow: иначе у полосы вкладок появляется лишний вертикальный скролл справа */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; box-shadow: inset 0 -1px 0 var(--line-strong); margin-bottom: 16px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; white-space: nowrap;
  color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--navy); }
.tabs a[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--cyan); }
.tab-count { background: #e6ecf2; color: var(--muted); border-radius: 0; padding: 1px 8px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
.table tr.is-off td { opacity: .55; }
.td-email { white-space: nowrap; }
.td-access { min-width: 220px; }
.access-sum { display: block; margin-bottom: 4px; }
.warn-text { color: var(--amber); }
.row-form { display: flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.row-form input:not([type="hidden"]) { min-width: 0; width: 170px; }
.row-form select { width: auto; }
.grid-form { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 14px; }
.user-new { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 0; }
.user-new > .btn { align-self: flex-start; }
.panel h3 { margin: 24px 0 10px; }
.panel-head p { margin: 0; }
.league-check img, .team-group-title img { height: 20px; width: auto; }
.league-shield { height: 44px; width: auto; flex: none; }
.team-groups {
  max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 0; padding: 12px;
  display: grid; gap: 14px 22px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: start;
}
.team-group { display: flex; flex-direction: column; gap: 5px; }
.team-group-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--navy); padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.team-group.covered .check { opacity: .45; }
.team-group.covered .team-group-title::after { content: "лига отмечена целиком"; font-weight: 500; color: var(--muted); margin-left: auto; font-size: 12px; }

/* ссылки для скачивания */
.share-new { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 10px; align-items: end; }
.share-result { padding: 12px 14px; background: var(--cyan-tint); border-left: 3px solid var(--cyan); }
.share-result-title { display: block; font-size: 13px; margin-bottom: 8px; color: var(--ink); }
.share-copy { display: flex; gap: 8px; }
.share-copy input { flex: 1; min-width: 0; font-size: 14px; background: var(--white); }
.share-active { padding: 12px 14px; background: var(--ice); }
.share-active-title { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.share-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.share-row:first-child { border-top: 0; }
.share-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.share-row-main small { color: var(--muted); font-size: 12px; }
.share-row .btn { min-height: 30px; }
.share-empty { color: var(--muted); font-size: 14px; padding: 4px 0; }
.share-note { margin: 0 0 14px; padding: 10px 14px; background: var(--white); border-left: 3px solid var(--cyan); font-size: 14px; color: var(--muted); }
.share-album { display: inline-flex; align-items: center; gap: 8px; }
.panel-note { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* публичные фильтры */
.pub-filters {
  flex-wrap: wrap; margin: -6px 0 22px; padding: 12px 14px;
  background: var(--white); border: 1px solid var(--line);
}
.pub-filters .filter { flex: 0 1 180px; }
.pub-filters .filter.grow { flex: 1 1 220px; }
.pub-filters select { width: 100%; }
.filter-reset { align-self: end; }
@media (max-width: 900px) {
  .share-new { grid-template-columns: 1fr; }
  .pub-filters .filter, .pub-filters .filter.grow { flex: 1 1 calc(50% - 12px); }
  .back { font-size: 16px; }
}


/* фотографы клуба */
.ph-group h2 { margin: 0; font-size: 18px; }
.ph-list { list-style: none; margin: 0 0 14px; padding: 0; }
.ph-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.ph-row:first-child { border-top: 0; }
.ph-row.is-off .ph-name input { color: var(--muted); text-decoration: line-through; }
.ph-name { flex: 1; }
.ph-name input:not([type="hidden"]) { width: min(320px, 100%); }
.ph-count { font-size: 13px; white-space: nowrap; }
.ph-add input:not([type="hidden"]) { width: min(320px, 100%); }
.row-count small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* загрузка с автокоррекцией */
.upload-group { display: inline-flex; align-items: center; gap: 12px; margin-right: 6px; }
.up-summary { border: 0; background: none; padding: 0; font: 500 13px/1.3 var(--font); color: var(--muted); cursor: pointer; text-align: left; max-width: 300px; }
.up-summary:hover { color: var(--navy); text-decoration: underline; }

.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:hover:not(:disabled) { position: relative; z-index: 1; }
#btn-rot-l, #btn-rot-r { font-size: 18px; width: 40px; padding: 0; }

/* вид альбома: фильтр отбора, порядок, время загрузки */
.viewbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: -6px 0 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); background: var(--white); }
.seg button { border: 0; background: none; padding: 7px 12px; font: 600 13px/1 var(--font); color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--navy); color: var(--white); }
.seg button span { font-weight: 500; opacity: .75; margin-left: 2px; }
.viewbar-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.viewbar-sort select { min-height: 32px; padding: 4px 8px; }
.viewbar-info { font-size: 13px; color: var(--muted); margin-left: auto; }
.keys-btn { width: 32px; min-height: 32px; padding: 0; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.keys dt { font-weight: 700; color: var(--navy); }
.keys dd { margin: 0; color: var(--muted); }

/* подпись фотографов */
.credits-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; border: 1px solid var(--line); padding: 8px 12px; }
.credits-item { padding: 5px 8px; margin: 0 -8px; }
.credits-item.is-match { border-left: 3px solid var(--cyan); padding-left: 5px; }
.credits-h { margin: 8px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.credits-h:first-child { margin-top: 0; }
.credits-search { width: 100%; }
.credits-item small { margin-left: auto; font-size: 12px; }
.credits-add { display: flex; gap: 8px; }
.credits-add input { flex: 1; min-width: 0; }
.credits-warn { margin: 0; font-size: 13px; padding: 8px 12px; background: var(--cyan-tint); border-left: 3px solid var(--cyan); }

/* редактор */
.editor { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: #050b17; }
.ed-stage { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 0; }
.ed-stage canvas { max-width: 100%; max-height: calc(100dvh - 48px); display: block; }
.ed-loading { color: rgba(255, 255, 255, .7); }
.ed-crop { position: absolute; box-shadow: 0 0 0 9999px rgba(5, 11, 23, .62); outline: 1px solid rgba(255, 255, 255, .9); cursor: move; touch-action: none;
  background-image: linear-gradient(rgba(255,255,255,.28), rgba(255,255,255,.28)), linear-gradient(rgba(255,255,255,.28), rgba(255,255,255,.28)),
    linear-gradient(rgba(255,255,255,.28), rgba(255,255,255,.28)), linear-gradient(rgba(255,255,255,.28), rgba(255,255,255,.28));
  background-size: 1px 100%, 1px 100%, 100% 1px, 100% 1px; background-position: 33.33% 0, 66.66% 0, 0 33.33%, 0 66.66%; background-repeat: no-repeat; }
.ed-h { position: absolute; width: 16px; height: 16px; background: var(--white); border: 2px solid var(--navy); }
.ed-h.nw { left: -8px; top: -8px; cursor: nwse-resize; } .ed-h.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.ed-h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .ed-h.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.ed-h.n { left: calc(50% - 8px); top: -8px; cursor: ns-resize; } .ed-h.s { left: calc(50% - 8px); bottom: -8px; cursor: ns-resize; }
.ed-h.w { top: calc(50% - 8px); left: -8px; cursor: ew-resize; } .ed-h.e { top: calc(50% - 8px); right: -8px; cursor: ew-resize; }
.ed-panel { background: var(--white); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ed-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-batch { margin: 0; padding: 10px 16px; font-size: 13px; background: var(--cyan-tint); }
.ed-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ed-sec h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.ed-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-row .btn:not(.ghost) { width: 40px; padding: 0; font-size: 17px; }
.ed-auto[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.ed-slider { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ed-slider span { display: flex; justify-content: space-between; color: var(--ink); }
.ed-slider output { color: var(--muted); font-variant-numeric: tabular-nums; }
.ed-slider input { width: 100%; accent-color: var(--navy); margin: 0; }
.ed-aspects { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-aspects button { border: 1px solid var(--line-strong); background: var(--white); padding: 5px 9px; font: 600 12px/1 var(--font); color: var(--navy); cursor: pointer; }
.ed-aspects button[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.ed-hint { margin: 0; font-size: 12px; color: var(--muted); }
.ed-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--white); }
.ed-spacer { flex: 1; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: 45dvh minmax(0, 1fr); }
  .ed-stage { padding: 10px; }
  .ed-stage canvas { max-height: calc(45dvh - 20px); }
  .viewbar-info { margin-left: 0; width: 100%; }
}

/* редактор: гистограмма, отмена, пипетка */
.ed-hist { display: block; width: calc(100% - 32px); height: 56px; margin: 12px 16px 12px; background: var(--navy); }
.ed-crop.locked { cursor: default; }
.ed-crop.locked .ed-h { display: none; }
.ed-foot .ed-icon { width: 36px; padding: 0; font-size: 17px; }
.ed-foot { flex-wrap: nowrap; }
.ed-head strong { flex: 1; min-width: 0; }
.ed-reset { min-height: 32px; padding: 0 10px; font-size: 13px; }
.ed-row { align-items: center; }
.ed-row .ed-aspects { margin-left: 6px; }
.ed-h3-tools { display: inline-flex; gap: 6px; text-transform: none; letter-spacing: 0; }
.ed-h3-tools .btn { min-height: 30px; padding: 0 10px; font-size: 13px; }
.ed-h3-tools .btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.ed-h3-tools [data-op="picker"][aria-pressed="true"] { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.ed-tip { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); margin: 0; padding: 8px 14px; background: var(--cyan); color: var(--navy); font-weight: 600; font-size: 14px; }
.editor .ed-stage:has(.ed-crop.picking), .ed-crop.picking { cursor: crosshair; }
.ed-crop.picking { pointer-events: none; }

/* окно «Быстрые правки при загрузке» */
.dlg.up-dlg { width: min(1040px, calc(100vw - 32px)); }
.up-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; margin: 6px 0 12px; }
.up-stage { background: var(--navy); min-height: 320px; display: flex; align-items: center; justify-content: center; }
.up-stage canvas { max-width: 100%; max-height: 58vh; display: block; }
.up-empty { color: rgba(255, 255, 255, .7); padding: 30px; text-align: center; margin: 0; }
.up-under { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.up-nav { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.up-opts { display: flex; flex-direction: column; gap: 14px; }
.up-opt { display: flex; flex-direction: column; gap: 5px; }
.up-opt > span { font-size: 13px; font-weight: 700; color: var(--navy); }
.up-opt small { color: var(--muted); font-size: 12px; }
.up-opt select { min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.seg-wrap { flex-wrap: wrap; }
.up-note { margin: 0; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .up-grid { grid-template-columns: 1fr; }
  .up-stage { min-height: 200px; }
}
.up-opt .seg { align-self: flex-start; }
#ed-compare[aria-pressed="true"], #upd-compare[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.editor { grid-template-columns: minmax(0, 1fr) 360px; }

/* лупа 100% */
.ed-stage.loupe-mode canvas { cursor: zoom-in; }
.ed-stage.loupe-mode .ed-crop { pointer-events: none; }
.ed-loupe { position: absolute; top: 16px; right: 16px; left: 16px; height: min(460px, 60%); background: var(--navy); border: 2px solid var(--white); overflow: hidden; cursor: zoom-out; z-index: 3; }
.ed-loupe.at-bottom { top: auto; bottom: 16px; }
.ed-loupe img { display: block; width: 100%; height: 100%; object-fit: none; }
.ed-loupe-tag { position: absolute; top: 8px; padding: 3px 8px; background: var(--navy); color: var(--white); font-size: 12px; font-weight: 700; }
.ed-loupe-tag.l { left: 8px; }
.ed-loupe-tag.r { left: calc(50% + 8px); background: var(--cyan); color: var(--navy); }
.ed-loupe-wait { position: absolute; left: 10px; bottom: 10px; padding: 3px 8px; background: var(--cyan); color: var(--navy); font-size: 12px; font-weight: 700; }
#ed-loupe[aria-pressed="true"] { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.ph-who { flex: 1; min-width: 0; }
.ph-club { font-size: 13px; min-width: 120px; }
.ph-note { font-size: 13px; margin: 0; }
.ph-sub { margin: 28px 0 4px; font-size: 18px; }
@media (max-width: 640px) { .ph-league .ph-row { flex-wrap: wrap; gap: 4px 12px; } .ph-who { flex-basis: 100%; } }
