:root {
  --bg: #0e1014;
  --surface: #161920;
  --surface-2: #1d2129;
  --surface-3: #252a34;
  --border: #2b313c;
  --text: #eceef2;
  --muted: #9aa3b2;
  --faint: #6b7483;
  --accent: #ff6a1a;
  --accent-ink: #1a0d05;
  --keep: #34c779;
  --reject: #f0524f;
  --warn: #f5a524;
  --info: #5aa9ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }

/* ---------- кнопки, поля, чипы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff7d38; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-icon { width: 40px; padding: 0; }

.input {
  height: 42px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--faint); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.is-on b { color: var(--bg); }
button.chip { cursor: pointer; }
.chip-keep { color: var(--keep); border-color: rgba(52, 199, 121, .35); background: rgba(52, 199, 121, .08); }
.chip-reject { color: var(--reject); border-color: rgba(240, 82, 79, .35); background: rgba(240, 82, 79, .08); }
.chip-warn { color: var(--warn); border-color: rgba(245, 165, 36, .35); background: rgba(245, 165, 36, .08); }
.chip-live { color: var(--accent); border-color: rgba(255, 106, 26, .4); background: rgba(255, 106, 26, .1); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 24px; background: rgba(14, 16, 20, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  display: inline-grid; place-items: center; height: 30px; padding: 0 8px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; letter-spacing: .5px;
}
.brand-text { font-size: 17px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.is-active { color: var(--text); background: var(--surface-2); }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.upload-mini {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 106, 26, .12); color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
}
.upload-mini .bar { width: 90px; height: 4px; }

.app { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- вход ---------- */
.login-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.login {
  width: min(400px, 100%); padding: 32px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.login .brand { margin-bottom: 24px; }
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login .btn { width: 100%; margin-top: 22px; height: 44px; }
.form-error { color: var(--reject); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* ---------- страница матчей ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.week { display: flex; align-items: center; gap: 8px; }
.week-label { min-width: 170px; text-align: center; font-weight: 700; }
.period { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.period-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.period-links .btn-ghost.is-active { background: var(--surface-2); color: var(--text); }
.dates { margin: -8px 0 22px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.dates-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.dates-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.dates-field .input { width: 180px; color: var(--text); color-scheme: dark; }
.dates-field .input::-webkit-date-and-time-value { text-align: left; }
.dates-row .btn { height: 42px; }
.dates-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dates-quick .chip { color: var(--text); }
.dates-quick .chip:hover { border-color: var(--accent); }
.dates-quick .chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dates-hint { color: var(--faint); font-size: 13px; margin-top: 12px; }
.dates .form-error { min-height: 0; margin-top: 6px; }
.dates .form-error:empty { display: none; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar .input { max-width: 360px; }
.day { margin-bottom: 34px; }
.day-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.day-head h2 { margin: 0; font-size: 20px; }
.stadium { margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stadium-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.stadium-head h3 { margin: 0; font-size: 15px; }
.stadium-head .addr { color: var(--faint); font-size: 13px; }
.stadium-head .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); margin: 0 -1px -1px 0; }
.game {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); transition: background .12s;
}
.game:hover { background: var(--surface-2); }
.game-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.game-time small { display: block; color: var(--faint); font-weight: 500; font-size: 12px; margin-top: 2px; }
.game-teams { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; }
.game-teams .team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-teams .goals { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.game-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.game-meta .champ { color: var(--faint); font-size: 12px; margin-right: 4px; }
.game.is-planned { cursor: default; }
.game.is-planned:hover { background: none; }
.game.is-planned .game-time, .game.is-planned .game-teams { color: var(--muted); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- набор ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.back:hover { color: var(--text); }
.set-title { margin: 0; font-size: 28px; letter-spacing: -.3px; }
.set-title .score { color: var(--accent); margin: 0 8px; font-variant-numeric: tabular-nums; }
.set-sub { color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 14px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 22px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  min-height: 180px; border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; transition: border-color .15s, background .15s;
}
.drop.is-over { border-color: var(--accent); background: rgba(255, 106, 26, .06); }
.drop h3 { margin: 0; font-size: 18px; }
.drop p { margin: 0; color: var(--muted); }
.drop .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.drop.compact { min-height: 0; flex-direction: row; justify-content: space-between; padding: 14px 18px; text-align: left; }
.drop.compact .actions { margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.step-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.step-name { font-weight: 700; }
.step-val { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.step.is-done .step-name::before { content: "✓ "; color: var(--keep); }
.step.is-active { border-color: rgba(255, 106, 26, .5); }
.step .bar { margin-top: 10px; }
.step-note { color: var(--faint); font-size: 12px; margin-top: 8px; min-height: 16px; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s; }
.bar.is-keep > i { background: var(--keep); }
.upload-errors { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(240, 82, 79, .08); border: 1px solid rgba(240, 82, 79, .3); }
.upload-errors ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; max-height: 120px; overflow: auto; }
.upload-errors .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.big-num { display: flex; align-items: baseline; gap: 8px; margin-right: 18px; }
.big-num b { font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.big-num.keep b { color: var(--keep); }
.big-num.reject b { color: var(--reject); }

.tabs { display: flex; gap: 6px; margin: 26px 0 14px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--text); border-bottom-color: var(--accent); }
.tab small { color: var(--faint); font-weight: 600; margin-left: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  cursor: zoom-in; border: 1px solid var(--border);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile.is-portrait img { object-fit: contain; background: #000; }
.tile:hover img { transform: scale(1.03); }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.tile .tag {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; background: rgba(0, 0, 0, .72); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile .tag.reject { color: #ffb4b2; }
.tile .tag.keep { color: #9df0c3; }
.tile .corner { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.tile .badge { padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .72); color: #fff; }
.tile .badge.warn { color: var(--warn); }
.tile.is-reject img { opacity: .78; }
.tile.is-hl { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ---------- просмотр ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 8, .96); display: grid; grid-template-columns: 1fr 340px; }
.lb-stage { position: relative; display: grid; place-items: center; min-width: 0; padding: 24px 70px; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 48px); object-fit: contain; border-radius: 6px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: #fff; font-size: 22px; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .16); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-close { position: absolute; top: 14px; right: 14px; }
.lb-side { background: var(--surface); border-left: 1px solid var(--border); padding: 20px; overflow: auto; }
.lb-side h3 { margin: 0 0 4px; font-size: 16px; word-break: break-all; }
.lb-side .pos { color: var(--faint); font-size: 13px; }
.lb-block { margin-top: 18px; }
.lb-block h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.verdict.keep { color: var(--keep); }
.verdict.reject { color: var(--reject); }
.reasons { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.reasons li { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.reasons li.warn { color: var(--warn); }
.reasons a { color: var(--accent); cursor: pointer; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.meter { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; }

/* ---------- мои наборы ---------- */
.set-list { display: grid; gap: 10px; }
.set-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.set-row:hover { background: var(--surface-2); }
.set-row h3 { margin: 0 0 4px; font-size: 16px; }
.set-row .right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: min(560px, calc(100% - 32px));
}
.toast.is-error { border-color: rgba(240, 82, 79, .5); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; }

@media (max-width: 900px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .brand-text, .user span { display: none; }
  .app { padding: 20px 16px 60px; }
  .steps { grid-template-columns: 1fr; }
  .games { grid-template-columns: 1fr; }
  .period { width: 100%; }
  .period .week { width: 100%; justify-content: space-between; }
  .dates-row { display: grid; grid-template-columns: 1fr 1fr; }
  .dates-field .input { width: 100%; }
  .dates-row .btn { grid-column: 1 / -1; }
  .lightbox { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .lb-stage { padding: 12px 56px; }
  .lb-side { max-height: 40vh; border-left: 0; border-top: 1px solid var(--border); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .drop.compact { flex-direction: column; align-items: stretch; }
}

/* ---------- одобрение и публикация ---------- */
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--muted); font: 600 11px/17px var(--font); text-align: center;
}
.btn kbd { margin-left: 4px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn-keep { background: rgba(52, 199, 121, .16); border-color: rgba(52, 199, 121, .6); color: var(--keep); }
.btn-reject { background: rgba(240, 82, 79, .14); border-color: rgba(240, 82, 79, .55); color: var(--reject); }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
.bad { color: var(--reject); }
.good { color: var(--keep); }
.big-num.manual b { color: var(--warn); }

.album-panel .summary { margin-bottom: 16px; }
.approve { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; padding-top: 16px; border-top: 1px solid var(--border); }
.approve-fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.approve-fields label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.approve-go { max-width: 360px; }
.approve-go .hint { margin-top: 8px; }
.album-head h3 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.album-link { margin: 4px 0 14px; font-size: 16px; word-break: break-all; }
.album-link a { color: var(--info); }
.album-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.tile-act {
  position: absolute; right: 8px; bottom: 8px; height: 30px; padding: 0 10px; border-radius: 8px; border: 0;
  font-size: 13px; font-weight: 700; cursor: pointer; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
  background: rgba(0, 0, 0, .78); color: #fff;
}
.tile:hover .tile-act, .tile-act:focus-visible { opacity: 1; transform: none; }
.tile-act.to-reject:hover { background: var(--reject); }
.tile-act.to-keep:hover { background: var(--keep); color: #04150b; }
.tile .badge.cover { background: var(--accent); color: var(--accent-ink); }
@media (hover: none) { .tile-act { opacity: 1; transform: none; } }

.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-actions .btn { height: 36px; padding: 0 12px; font-size: 14px; }
.lb-links { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 900px) {
  .approve { grid-template-columns: 1fr; }
  .approve-fields { grid-template-columns: 1fr; }
  .approve-go { max-width: none; }
}

/* ---------- настройки ---------- */
.panel-title { margin: 0 0 12px; font-size: 17px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.plaque-previews { display: grid; grid-template-columns: 3fr 1.3fr; gap: 14px; align-items: end; }
.plaque-previews figure { margin: 0; }
.plaque-previews img { width: 100%; border-radius: 8px; display: block; background: var(--surface-2); }
.plaque-previews figcaption { color: var(--faint); font-size: 12px; margin-top: 6px; }
.user-form { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr 1fr auto; gap: 8px; margin-top: 14px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.warnbox { background: rgba(245, 165, 36, .08); border-color: rgba(245, 165, 36, .35); margin-bottom: 14px; }
.approve-fields .wide { grid-column: 1 / -1; }
.input.static { display: flex; align-items: center; color: var(--muted); }
select.input { appearance: auto; }
@media (max-width: 900px) { .user-form, .plaque-previews { grid-template-columns: 1fr; } }

/* ---------- настройки: поля, сообщества и правила ---------- */
.btn-danger { color: var(--reject); }
.btn-danger:hover:not(:disabled) { border-color: var(--reject); background: rgba(240, 82, 79, .08); }
.btn:disabled { opacity: .45; cursor: default; }
.opt-row { display: grid; grid-template-columns: 200px 1fr; gap: 6px 18px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.opt-row:first-of-type { border-top: 0; }
.opt-label { color: var(--muted); font-size: 14px; padding-top: 10px; }
.opt-field .input { width: 100%; max-width: 420px; }
.opt-field input[type=number] { max-width: 140px; }
.opt-field textarea.input { max-width: 100%; height: auto; padding: 10px 12px; font: inherit; resize: vertical; }
.opt-help { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.opt-help a { color: var(--accent); }
.opt-error, .opt-error:empty { color: var(--reject); font-size: 13px; }
.opt-error:not(:empty) { margin-top: 6px; }
.opt-sep { height: 1px; background: var(--border); margin: 18px 0 4px; }
.with-unit { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.range { display: flex; align-items: center; gap: 12px; max-width: 420px; padding-top: 8px; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { min-width: 48px; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex; align-items: center; gap: 10px; padding-top: 10px; cursor: pointer; color: var(--muted); font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.sub-title { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.comm-row, .rule-row { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.comm-row > *, .rule-row > *, .opt-field { min-width: 0; }
.comm-row .input, .rule-row .input { width: 100%; }
select.input { color: var(--text); font-size: 15px; }
.table-wrap { overflow-x: auto; }
.comm-row { grid-template-columns: 1.4fr 1fr 1.4fr auto; }
.rule-row { grid-template-columns: 22px 1.3fr 150px 1.3fr 1.6fr auto; }
.rule-n { color: var(--faint); font-size: 13px; text-align: right; }
.rule-btns { display: flex; gap: 2px; }
.users-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.users-table tr.is-off td { color: var(--faint); }
@media (max-width: 900px) {
  .opt-row { grid-template-columns: 1fr; gap: 4px; }
  .opt-label { padding-top: 0; }
  .comm-row { grid-template-columns: 1fr auto; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
  .comm-row [data-f=name], .comm-row [data-f=url] { grid-column: 1 / -1; }
  .comm-row [data-f=id] { grid-column: 1; grid-row: 2; }
  .comm-row [data-rm] { grid-column: 2; grid-row: 2; }
  .rule-row { grid-template-columns: 1fr 1fr; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
  .rule-n { display: none; }
  .rule-row [data-f=champ], .rule-row [data-f=stadium] { grid-column: 1 / -1; }
  .rule-btns { grid-column: 1 / -1; justify-content: flex-end; }
  .users-table .row-actions { flex-wrap: wrap; }
}
/* узкий телефон: название сервиса длиннее «AFL», у админа три пункта меню — меню листается внутри шапки */
@media (max-width: 520px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand-mark { font-size: 12px; padding: 3px 6px; }
  .nav { min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px; white-space: nowrap; font-size: 14px; }
  .user { flex-shrink: 0; gap: 4px; }
  .user .btn { padding: 0 8px; }
  .users-table th:nth-child(2), .users-table td:nth-child(2) { display: none; }
}
.learn-row .learn-text { font-size: 14px; padding-top: 10px; color: var(--muted); }
.learn-row .spinner { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- загрузка по ссылке ---------- */
.link-form { margin-top: 14px; }
.link-row { display: flex; gap: 10px; }
.link-row .input { flex: 1; min-width: 0; }
.link-form .hint { margin-top: 8px; }
.import-box { margin-top: 14px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.import-box.is-active { border-color: rgba(255, 106, 26, .5); }
.import-box.is-failed { background: rgba(240, 82, 79, .08); border-color: rgba(240, 82, 79, .3); }
.import-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.import-head h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.import-title { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.import-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-url { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-url:hover { color: var(--info); }
.import-box .bar { margin-top: 12px; }
.import-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.import-meta b { color: var(--text); }
.import-error { margin-top: 8px; font-weight: 600; }
.import-list { margin-top: 10px; font-size: 13px; }
.import-list summary { cursor: pointer; color: var(--muted); }
.import-list ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); max-height: 160px; overflow: auto; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .link-row { flex-wrap: wrap; }
  .link-row .input { flex-basis: 100%; }
  .link-row .btn { flex: 1; }
}

/* ---------- MVP матча ---------- */
.badge.mvp, .chip-mvp { background: #f5c542; color: #1a1405; border-color: transparent; font-weight: 700; }
.mvp-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mvp-head h3 { margin: 0; font-size: 17px; }
.mvp-strip { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.mvp-thumb { position: relative; flex: 0 0 auto; width: 150px; height: 100px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.mvp-thumb.is-main { border-color: #f5c542; }
.mvp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mvp-thumb .badge { position: absolute; left: 6px; top: 6px; }

/* альбом, залитый в ВК руками */
.manual-form, .manual-album { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.manual-form .link-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.manual-form .link-row .input { flex: 1 1 320px; min-width: 0; }
.manual-album { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }

/* рамка кадра в альбоме поверх превью */
.lb-img { position: relative; display: inline-block; line-height: 0; overflow: hidden; border-radius: 6px; max-width: 100%; }
.lb-img img { display: block; }
.crop-box { position: absolute; border: 2px solid #ffd54a; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5); cursor: move; transform-origin: center; touch-action: none; }
.crop-head { font-weight: 600; margin-bottom: 8px; }
.crop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.crop-tilt { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.crop-tilt input { flex: 1; }

/* метки кадра: болельщики, вратарь, радость (analysis/tags.py) */
.tag-filters { align-items: center; }
.tile .badge.tag-fans, .chip-tag-fans { background: #3b82c4; color: #fff; border-color: transparent; }
.tile .badge.tag-goalkeeper, .chip-tag-goalkeeper { background: #2e9d6a; color: #fff; border-color: transparent; }
.tile .badge.tag-joy, .chip-tag-joy { background: #d9468f; color: #fff; border-color: transparent; }
.chip.chip-tag-fans.is-on, .chip.chip-tag-goalkeeper.is-on, .chip.chip-tag-joy.is-on, .chip.chip-tag-mvp.is-on { outline: 2px solid var(--text); outline-offset: 1px; }
.chip-tag-mvp { background: #f5c542; color: #1a1405; border-color: transparent; }
.chip-tag-fans b, .chip-tag-goalkeeper b, .chip-tag-joy b { color: inherit; }
.mvp-side { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.warn-text { color: var(--warn); }
