/* Судейство — тёмная высококонтрастная тема (референс пользователя 25.10.2026: чёрный фон, карточки
   #1a1a1a, салатовый #abf732 для активного/выбранного). Цвета номинаций — стандартная палитра Google Таблиц;
   на них — тёмный текст, как в бумажном расписании. Салатовый — только выделение и действия. */

:root,
[data-bs-theme="dark"] {
  --bd-bg: #000000;
  --bd-side: #111111;
  --bd-card: #1a1a1a;
  --bd-raised: #222222;
  --bd-raised-2: #2c2c2c;
  --bd-field: #141414;
  --bd-line: rgba(255, 255, 255, 0.08);
  --bd-line-strong: rgba(255, 255, 255, 0.16);
  --bd-text: #ffffff;
  --bd-muted: #9a9a9a;
  --bd-faint: #626262;
  --bd-accent: #abf732;
  --bd-accent-hover: #c0fa66;
  --bd-accent-ink: #0a0a0a;
  --bd-accent-soft: rgba(171, 247, 50, 0.22);
  --bd-ink: #121212; /* текст на цветах номинаций */
  --bd-ok: #abf732;
  --bd-warn: #fbbf24;
  --bd-err: #ff6b6b;
  --bd-radius: 14px;
  --bd-radius-lg: 22px;

  --bs-body-bg: var(--bd-bg);
  --bs-body-color: var(--bd-text);
  --bs-body-font-family: "Inter Variable", "Segoe UI", Roboto, system-ui, sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-border-color: var(--bd-line-strong);
  --bs-secondary-color: var(--bd-muted);
  --bs-secondary-bg: var(--bd-raised);
  --bs-tertiary-bg: var(--bd-side);
  --bs-emphasis-color: #fff;
  --bs-link-color: var(--bd-accent);
  --bs-link-hover-color: var(--bd-accent-hover);
  --bs-link-color-rgb: 171, 247, 50;
  --bs-link-hover-color-rgb: 192, 250, 102;
  --bs-focus-ring-color: rgba(171, 247, 50, 0.45);
  --bs-border-radius: var(--bd-radius);
}

html,
body {
  min-height: 100%;
}
body {
  background: var(--bd-bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
::selection {
  background: var(--bd-accent);
  color: var(--bd-accent-ink);
}
:focus-visible {
  outline: 2px solid var(--bd-accent);
  outline-offset: 2px;
}
.text-muted,
.muted {
  color: var(--bd-muted) !important;
}
.faint {
  color: var(--bd-faint);
}
.tabnum {
  font-variant-numeric: tabular-nums;
}
.min-w-0 {
  min-width: 0;
}

/* ---------------------------------------------------------------- каркас админки */

.app-shell {
  display: grid;
  grid-template-columns: 72px 248px minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  background: var(--bd-bg);
  border-right: 1px solid var(--bd-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail a,
.rail button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--bd-muted);
  font-size: 1.15rem;
  background: none;
  border: 0;
  text-decoration: none;
}
.rail a:hover,
.rail button:hover {
  color: #fff;
  background: var(--bd-raised);
}
.rail a.active {
  color: var(--bd-accent-ink);
  background: var(--bd-accent);
}
/* Логотип — нейтральный (белый значок, как в референсе): салатовый остаётся только за активным. */
.rail-logo,
.rail a.rail-logo,
.rail a.rail-logo:hover {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1.5px solid var(--bd-line-strong);
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 14px;
}
.rail .rail-bottom {
  margin-top: auto;
}

.side {
  --bs-offcanvas-bg: var(--bd-side);
  padding: 22px 14px;
}
@media (min-width: 992px) {
  /* Bootstrap делает .offcanvas-lg прозрачной на широком экране (!important) — возвращаем фон. */
  .side.offcanvas-lg {
    background-color: var(--bd-side) !important;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}
.side .event-card {
  padding: 12px 14px;
  border-radius: var(--bd-radius);
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  margin-bottom: 18px;
}
.side .event-card:hover {
  border-color: var(--bd-line-strong);
}
.side .event-card .label {
  font-size: 12px;
  color: var(--bd-muted);
}
.side .event-card .name {
  font-weight: 600;
  line-height: 1.3;
}
.nav-group + .nav-group {
  border-top: 1px solid var(--bd-line);
  margin-top: 12px;
  padding-top: 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--bd-text);
  text-decoration: none;
  font-size: 15px;
}
.nav-item i {
  color: var(--bd-muted);
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}
.nav-item:hover {
  background: var(--bd-raised);
  color: #fff;
}
.nav-item.active,
.nav-item.active:hover {
  background: var(--bd-accent);
  color: var(--bd-accent-ink);
  font-weight: 600;
}
.nav-item.active i {
  color: var(--bd-accent-ink);
}

.main-wrap {
  min-width: 0;
  background: var(--bd-bg);
}
.main {
  min-width: 0;
  padding: 28px clamp(16px, 3vw, 40px) 64px;
}
.topbar {
  display: none;
}

@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    display: none;
  }
  .side.offcanvas-lg {
    --bs-offcanvas-width: 290px;
    overflow-y: auto;
  }
  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--bd-line);
    position: sticky;
    top: 0;
    z-index: 1020;
  }
  .topbar .title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .main {
    padding-top: 20px;
  }
}

/* ---------------------------------------------------------------- заголовки и секции */

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--bd-line);
  margin-bottom: 8px;
}
.page-head h1 {
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  margin-right: auto;
}
.page-head .sub {
  width: 100%;
  color: var(--bd-muted);
  font-size: 14px;
  margin-top: -4px;
}
.section {
  padding: 20px 0;
  border-bottom: 1px solid var(--bd-line);
}
.section:last-child {
  border-bottom: 0;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
}
.section-desc {
  color: var(--bd-muted);
  font-size: 13.5px;
  margin: 0 0 14px;
  max-width: 68ch;
}
.empty {
  color: var(--bd-muted);
  padding: 22px 0;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: var(--bd-raised);
  color: var(--bd-text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.pill:hover {
  background: var(--bd-raised-2);
  color: #fff;
}
.pill:disabled,
.pill.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.pill.accent {
  background: var(--bd-accent);
  color: var(--bd-accent-ink);
  font-weight: 600;
}
.pill.accent:hover {
  background: var(--bd-accent-hover);
  color: var(--bd-accent-ink);
}
.pill.outline {
  background: transparent;
  border-color: var(--bd-line-strong);
}
.pill.outline:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
}
.pill.danger {
  background: transparent;
  color: var(--bd-err);
  border-color: rgba(255, 107, 107, 0.4);
}
.pill.danger:hover {
  background: rgba(255, 107, 107, 0.12);
}
.pill.sm {
  padding: 5px 12px;
  font-size: 13px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--bd-raised);
  color: var(--bd-text);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: var(--bd-raised-2);
  color: #fff;
}
.icon-btn.sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.icon-btn.plain {
  background: transparent;
}
.icon-btn.plain:hover {
  background: var(--bd-raised);
}

/* ---------------------------------------------------------------- формы */

.form-control,
.form-select {
  background-color: var(--bd-field);
  border: 1px solid var(--bd-line-strong);
  color: var(--bd-text);
  border-radius: 12px;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--bd-field);
  border-color: var(--bd-accent);
  color: var(--bd-text);
  box-shadow: 0 0 0 3px var(--bd-accent-soft);
}
.form-control::placeholder {
  color: var(--bd-faint);
}
.form-label {
  font-size: 13.5px;
  color: var(--bd-muted);
  margin-bottom: 6px;
}
.form-check-input {
  background-color: transparent;
  border: 1.5px solid #6e6e6e;
}
.form-check-input:focus {
  box-shadow: 0 0 0 3px var(--bd-accent-soft);
  border-color: var(--bd-accent);
}
.form-check-input:checked {
  background-color: var(--bd-accent);
  border-color: var(--bd-accent);
}
/* Галочка и точка — тёмные на салатовом. */
.form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230a0a0a' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-check-input:checked[type="radio"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%230a0a0a'/%3e%3c/svg%3e");
}

/* Переключатель крупнее стандартного — отступ под него тоже шире. */
.form-switch {
  padding-left: 3.2em;
}
.form-switch .form-check-input {
  width: 2.6em;
  height: 1.4em;
  margin-top: 0.05em;
  margin-left: -3.2em;
  background-color: var(--bd-raised-2);
  border-color: transparent;
}
.form-switch .form-check-input,
.form-switch .form-check-input:focus,
[data-bs-theme="dark"] .form-switch .form-check-input:not(:checked):not(:focus) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23bdbdbd'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
  background-color: var(--bd-accent);
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230a0a0a'/%3e%3c/svg%3e");
}
.form-control-color {
  width: 3rem;
  padding: 4px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.swatch[aria-pressed="true"] {
  border-color: var(--bd-accent);
  box-shadow: 0 0 0 2px var(--bd-bg);
}

.account-form {
  max-width: 460px;
}
/* Подсказка у поля пароля: Caps Lock / русская раскладка. */
.pw-hint {
  display: flex;
  gap: 7px;
  align-items: baseline;
  color: var(--bd-warn);
  font-size: 13px;
  margin-top: 6px;
}
.pw-hint[hidden] {
  display: none;
}
.form-text {
  font-size: 12.5px;
  margin-top: 6px;
}

/* Выбор номинаций: видимые чекбоксы/радио в плитках — понятно, куда нажимать. */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.check-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--bd-line-strong);
  background: var(--bd-card);
  cursor: pointer;
  user-select: none;
  font-size: 14.5px;
  line-height: 1.25;
}
.check-tile:hover {
  border-color: rgba(255, 255, 255, 0.35);
}
.check-tile .form-check-input {
  margin: 0;
  width: 1.3em;
  height: 1.3em;
  flex: 0 0 auto;
  cursor: pointer;
}
.check-tile .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--c, var(--bd-muted));
  flex: 0 0 auto;
}
.check-tile:has(input:checked) {
  border-color: var(--c, var(--bd-accent));
  background: color-mix(in srgb, var(--c, var(--bd-accent)) 16%, var(--bd-card));
}

.check-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.check-tile.sm {
  min-height: 40px;
  padding: 7px 10px;
  font-size: 13.5px;
  border-width: 1px;
}

/* Редактор номеров команды. */
.num-row {
  background: var(--bd-side);
  border: 1px solid var(--bd-line);
  border-radius: 16px;
  padding: 10px 12px 12px;
  margin-bottom: 8px;
}
.num-row.invalid {
  border-color: var(--bd-err);
}
.num-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.num-idx {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--bd-raised);
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
}
.num-meta {
  margin-top: 8px;
  color: var(--bd-muted);
  font-size: 12.5px;
}
.team-numbers {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.team-numbers li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}
.team-numbers .where {
  color: var(--bd-muted);
  font-size: 12.5px;
}
.team-numbers .where.wait {
  color: var(--bd-warn);
}
.team-row {
  align-items: flex-start;
}

/* ---------------------------------------------------------------- чипы */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bd-raised);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, var(--bd-muted));
  flex: 0 0 auto;
}
/* Номинация: заливка её цветом, тёмный текст — как в расписании-таблице. */
.chip.cat {
  background: var(--c);
  color: var(--bd-ink);
  font-weight: 600;
}
.chip.cat .dot {
  display: none;
}
.chip.ooc {
  background: transparent;
  border: 1px dashed var(--bd-line-strong);
  color: var(--bd-muted);
}

/* Кольцо из точек — прогресс (как в референсе). */
.ring {
  display: block;
  flex: 0 0 auto;
}
.ring circle {
  fill: #3a3a3a;
}
.ring circle.on {
  fill: var(--bd-accent);
}

/* ---------------------------------------------------------------- списки */

.rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--bd-radius);
  min-height: 52px;
}
.row-item:hover {
  background: var(--bd-card);
}
.row-item .grow {
  flex: 1 1 auto;
  min-width: 0;
}
.row-item .name {
  font-weight: 500;
}
.row-item .meta {
  color: var(--bd-muted);
  font-size: 13px;
}
.row-item .actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.grip {
  color: var(--bd-faint);
  cursor: grab;
  font-size: 1.1rem;
  touch-action: none;
  padding: 4px 2px;
}
.grip:active {
  cursor: grabbing;
}
.sortable-ghost {
  opacity: 0.35;
}
.sortable-chosen,
.sortable-drag {
  background: var(--bd-raised-2) !important;
}
.row-item.inactive .name {
  color: var(--bd-faint);
  text-decoration: line-through;
}

/* ---------------------------------------------------------------- расписание */

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 991.98px) {
  .schedule-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.pool {
  position: sticky;
  top: 16px;
  background: var(--bd-side);
  border-radius: var(--bd-radius-lg);
  padding: 14px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}
@media (max-width: 991.98px) {
  .pool {
    position: static;
    max-height: 340px;
  }
}
.pool-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-right: 2px;
}
.pool-team {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--bd-card);
  cursor: grab;
  touch-action: none;
}
.pool-team:hover {
  background: var(--bd-raised);
}
.pool-team .t-name {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
}
.pool-team .t-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.pool-team .t-cats .chip {
  font-size: 12px;
  padding: 1px 8px;
}
.pool-team .t-cats .chip.placed {
  opacity: 0.4;
}
/* Карточки номеров в узком списке «Ждут расстановки». */
.pool .perf {
  flex-wrap: wrap;
  row-gap: 2px;
  padding: 8px 8px 8px 0;
  border-left-width: 4px;
}
.pool .perf .num {
  display: none;
}
.pool .perf .p-main {
  flex-basis: calc(100% - 40px);
}
.pool .perf .p-side {
  width: 100%;
  justify-content: flex-start;
  padding-left: 30px;
}
.pool .perf .unplace {
  display: none;
}
.pool-list:empty::before {
  content: "Все номера расставлены. Новые номера добавляются в карточке команды.";
  color: var(--bd-faint);
  font-size: 13.5px;
  border: 1px dashed var(--bd-line-strong);
  border-radius: var(--bd-radius);
  padding: 16px;
  text-align: center;
}

.sblock {
  background: var(--bd-side);
  border-radius: var(--bd-radius-lg);
  margin-bottom: 16px;
}
.sblock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bd-line);
}
.sblock-head .b-name {
  font-weight: 600;
  font-size: 16px;
}
.sblock-head .b-count {
  color: var(--bd-muted);
  font-size: 13px;
}
.sblock.locked .sblock-head .b-name::after {
  content: " \F47A"; /* bi-lock-fill */
  font-family: "bootstrap-icons";
  color: var(--bd-warn);
  font-size: 0.85em;
}
.sblock-list {
  padding: 8px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sblock-list:empty::before {
  content: "Перетащите сюда номер из списка «Ждут расстановки»";
  color: var(--bd-faint);
  font-size: 14px;
  border: 1px dashed var(--bd-line-strong);
  border-radius: var(--bd-radius);
  padding: 18px;
  text-align: center;
}
.sblock.collapsed .sblock-list {
  display: none;
}
.sblock.collapsed .chev {
  transform: rotate(-90deg);
}

.perf {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bd-card);
  border-radius: 12px;
  padding: 8px 10px 8px 0;
  border-left: 5px solid var(--c, var(--bd-line-strong));
  min-height: 50px;
}
.perf.ooc {
  border-left-style: dashed;
}
.perf .num {
  min-width: 42px;
  text-align: right;
  color: var(--bd-muted);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.perf .p-main {
  flex: 1 1 auto;
  min-width: 0;
}
.perf .p-team {
  font-weight: 500;
  line-height: 1.25;
}
.perf .p-title {
  color: var(--bd-muted);
  font-size: 13px;
}
.perf .p-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.perf .scored {
  font-size: 12px;
  color: var(--bd-muted);
}
@media (max-width: 575.98px) {
  .perf {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .perf .num {
    min-width: 26px;
  }
  .perf .p-side {
    width: 100%;
    justify-content: flex-start;
    padding-left: 60px;
  }
}
/* Клон из списка команд, только что брошенный в блок, — до ответа сервера. */
.sblock-list .pool-team {
  opacity: 0.6;
}

/* ---------------------------------------------------------------- итоги */

.winners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 20px 0 6px;
}
.win-card {
  background: var(--bd-card);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.win-card > header {
  background: var(--c);
  color: var(--bd-ink);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.win-card > header b {
  font-size: 16px;
  font-weight: 700;
  margin-right: auto;
}
.win-card > header span {
  font-size: 12px;
  font-weight: 500;
}
.win-card ol {
  list-style: none;
  margin: 0;
  padding: 8px 10px 10px;
}
.win-card li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 5px 4px;
}
.win-card li .tm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.win-card li.p1 .tm {
  font-weight: 650;
}
.win-card li .sc {
  font-variant-numeric: tabular-nums;
  color: var(--bd-muted);
}
.win-card li.p1 .sc {
  color: #fff;
  font-weight: 650;
}
.win-card .pre {
  margin-top: auto;
  padding: 0 14px 10px;
  color: var(--bd-warn);
  font-size: 12.5px;
}

/* Значок места: 1–3 — в цвете номинации. */
.pbadge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--bd-muted);
}
.p1 .pbadge,
.p2 .pbadge,
.p3 .pbadge {
  background: var(--c);
  color: var(--bd-ink);
}
.p1 .pbadge {
  width: 34px;
  height: 34px;
  font-size: 17px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent);
}

.cat-section {
  margin-top: 26px;
  background: var(--bd-card);
  border-radius: 20px;
  overflow: hidden;
}
.cat-band {
  background: var(--c);
  color: var(--bd-ink);
  padding: 12px 18px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.cat-band h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.cat-band .cnt {
  font-size: 13px;
  font-weight: 500;
}
.cat-band .warn {
  font-size: 13px;
  font-weight: 600;
  margin-left: auto;
}
.cat-body {
  padding: 4px 8px 10px;
}
.rtable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.rtable th {
  color: var(--bd-muted);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--bd-line-strong);
  white-space: nowrap;
}
.rtable td {
  padding: 10px;
  border-bottom: 1px solid var(--bd-line);
  vertical-align: middle;
}
.rtable tr:last-child td {
  border-bottom: 0;
}
.rtable .r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rtable .place {
  width: 64px;
  white-space: nowrap;
}
.rtable .total {
  font-weight: 700;
  font-size: 16px;
}
/* Призовые места — строка подкрашена цветом номинации. */
.rtable tr.p1 td {
  background: color-mix(in srgb, var(--c) 30%, var(--bd-card));
}
.rtable tr.p2 td {
  background: color-mix(in srgb, var(--c) 18%, var(--bd-card));
}
.rtable tr.p3 td {
  background: color-mix(in srgb, var(--c) 10%, var(--bd-card));
}
.rtable tr.p1 td:first-child,
.rtable tr.p2 td:first-child,
.rtable tr.p3 td:first-child {
  border-radius: 12px 0 0 12px;
}
.rtable tr.p1 td:last-child,
.rtable tr.p2 td:last-child,
.rtable tr.p3 td:last-child {
  border-radius: 0 12px 12px 0;
}
.rtable tr.p1 .team-name {
  font-weight: 650;
  font-size: 15px;
}
.tie-mark {
  color: var(--bd-warn);
  font-weight: 700;
  margin-left: 4px;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cat-section .note {
  margin: 10px 8px 0;
}
.note {
  border-left: 3px solid var(--bd-warn);
  background: rgba(251, 191, 36, 0.08);
  padding: 8px 12px;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  margin-top: 8px;
  max-width: 90ch;
}
.state-ok {
  color: var(--bd-ok);
}
.state-warn {
  color: var(--bd-warn);
}
.state-err {
  color: var(--bd-err);
}
.progress-line {
  height: 6px;
  border-radius: 99px;
  background: var(--bd-raised-2);
  overflow: hidden;
  min-width: 120px;
}
.progress-line > span {
  display: block;
  height: 100%;
  background: var(--bd-accent);
  border-radius: 99px;
}
details.comments summary {
  color: var(--bd-muted);
  font-size: 12.5px;
  cursor: pointer;
  list-style: none;
}
details.comments summary::-webkit-details-marker {
  display: none;
}
details.comments ul {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--bd-muted);
}
.ooc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 8px;
}
.ooc-head h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.stat {
  background: var(--bd-card);
  border-radius: var(--bd-radius-lg);
  padding: 16px 18px;
}
.stat .v {
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .l {
  color: var(--bd-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ---------------------------------------------------------------- модальные окна, тосты */

.modal {
  --bs-modal-bg: var(--bd-card);
  --bs-modal-border-color: var(--bd-line-strong);
  --bs-modal-border-radius: var(--bd-radius-lg);
  --bs-modal-header-border-color: var(--bd-line);
  --bs-modal-footer-border-color: var(--bd-line);
}
.modal-backdrop {
  --bs-backdrop-opacity: 0.7;
}
.modal-title {
  font-weight: 600;
}
.toast {
  --bs-toast-bg: var(--bd-raised);
  --bs-toast-border-color: var(--bd-line-strong);
  --bs-toast-color: var(--bd-text);
  --bs-toast-border-radius: var(--bd-radius);
}
.toast.err {
  border-left: 3px solid var(--bd-err);
}
.toast.ok {
  border-left: 3px solid var(--bd-accent);
}
.credentials {
  background: #fff;
  color: #0f0f0f;
  border-radius: var(--bd-radius);
  padding: 18px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.credentials .qr img {
  display: block;
  width: 150px;
  height: 150px;
}
.credentials .kv {
  font-size: 15px;
}
.credentials .kv b {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.credentials .url {
  font-size: 13px;
  color: #4b5563;
  word-break: break-all;
}
@media print {
  /* Печать карточки судьи из окна «Данные для входа». */
  body.print-cred * {
    visibility: hidden;
  }
  body.print-cred #credCard,
  body.print-cred #credCard * {
    visibility: visible;
  }
  body.print-cred #credCard {
    position: fixed;
    left: 0;
    top: 0;
    border: 1px solid #999;
  }
}

/* ---------------------------------------------------------------- вход */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bd-card);
  border-radius: 26px;
  padding: 32px 28px;
}
.login-card h1 {
  font-size: 30px;
  font-weight: 500;
  margin: 18px 0 4px;
}
.login-card .form-control {
  padding: 12px 14px;
  font-size: 16px;
}

/* ---------------------------------------------------------------- страница судьи */

.judge-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 96px;
}
.jbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bd-line);
}
.jbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.jbar .who {
  min-width: 0;
  flex: 1 1 auto;
}
.jbar .who .ev {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jbar .who .me {
  color: var(--bd-muted);
  font-size: 13px;
}
.jprogress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.jprogress b {
  color: var(--bd-text);
  font-size: 17px;
  font-weight: 600;
}
.jtools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0 6px;
  align-items: center;
}
.banner {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: var(--bd-radius);
  background: var(--bd-raised);
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.banner.warn {
  background: rgba(251, 191, 36, 0.14);
}
.banner.err {
  background: rgba(255, 107, 107, 0.16);
}

.jblock {
  margin-top: 18px;
}
.jblock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  color: inherit;
  padding: 10px 2px;
  text-align: left;
  border-bottom: 1px solid var(--bd-line);
}
.jblock-head h2 {
  font-size: 21px;
  font-weight: 600;
  margin: 0;
}
.jblock-head .cnt {
  color: var(--bd-muted);
  font-size: 13px;
  margin-left: auto;
}
.chev {
  transition: transform 0.18s ease;
  color: var(--bd-muted);
}
.collapsed > .jblock-head .chev,
.jperf.collapsed .chev {
  transform: rotate(-90deg);
}
.jblock.collapsed > .jblock-body {
  display: none;
}

.jperf {
  background: var(--bd-card);
  border-radius: var(--bd-radius-lg);
  margin-top: 10px;
  border-left: 5px solid var(--c, var(--bd-line-strong));
  overflow: hidden;
}
.jperf-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: 0;
  color: inherit;
  padding: 12px 14px 12px 12px;
  text-align: left;
}
.jperf-head .num {
  font-variant-numeric: tabular-nums;
  color: var(--bd-muted);
  min-width: 34px;
  font-size: 15px;
}
.jperf-head .ttl {
  flex: 1 1 auto;
  min-width: 0;
}
.jperf-head .team {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
}
.jperf-head .sub {
  color: var(--bd-muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.jstatus {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.jstatus .score {
  font-size: 22px;
  font-weight: 600;
}
.jstatus .part {
  color: var(--bd-warn);
  font-size: 13px;
}
.jperf.complete .jstatus .score {
  color: var(--bd-accent);
}
.jperf.collapsed .jperf-body {
  display: none;
}
.jperf.ooc {
  border-left-style: dashed;
  opacity: 0.7;
}
.jperf-body {
  padding: 4px 14px 16px 16px;
}
.crit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
}
.crit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.crit label {
  font-size: 13px;
  color: var(--bd-muted);
  line-height: 1.25;
  min-height: 2.5em;
  display: flex;
  align-items: flex-end;
}
.score-field {
  position: relative;
}
.score-input {
  width: 100%;
  height: 54px;
  border-radius: 16px;
  border: 1.5px solid var(--bd-line-strong);
  background: var(--bd-raised);
  color: var(--bd-text);
  font-size: 23px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0 28px;
}
.score-input::placeholder {
  color: var(--bd-faint);
  font-weight: 400;
  font-size: 16px;
}
.score-input:focus {
  outline: none;
  border-color: var(--bd-accent);
  box-shadow: 0 0 0 3px var(--bd-accent-soft);
}
.score-input:disabled {
  opacity: 0.55;
}
.score-field .st {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}
.score-field.is-saved .st::before {
  content: "\F26E"; /* bi-check */
  font-family: "bootstrap-icons";
  color: var(--bd-accent);
}
.score-field.is-saving .st::before {
  content: "\F130"; /* bi-arrow-repeat */
  font-family: "bootstrap-icons";
  color: var(--bd-muted);
  display: inline-block;
  animation: spin 0.9s linear infinite;
}
.score-field.is-queued .st::before {
  content: "\F297"; /* bi-cloud-arrow-up */
  font-family: "bootstrap-icons";
  color: var(--bd-warn);
}
.score-field.is-error .score-input {
  border-color: var(--bd-err);
}
.score-field.is-error .st::before {
  content: "\F333"; /* bi-exclamation-circle */
  font-family: "bootstrap-icons";
  color: var(--bd-err);
}
.score-field .err-msg {
  color: var(--bd-err);
  font-size: 12.5px;
  margin-top: 4px;
  display: none;
}
.score-field.is-error .err-msg {
  display: block;
}
.comment-wrap {
  margin-top: 14px;
}
.comment-wrap textarea {
  min-height: 64px;
  resize: vertical;
  font-size: 15px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 575.98px) {
  /* На телефоне: критерий строкой — подпись слева, поле справа. */
  .crit-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .crit {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .crit label {
    flex: 1 1 auto;
    min-height: 0;
    font-size: 14px;
    color: var(--bd-text);
  }
  .crit .score-field {
    flex: 0 0 112px;
  }
  .score-input {
    height: 52px;
    font-size: 22px;
  }
  .jperf-head .team {
    font-size: 15px;
  }
  .jstatus .score {
    font-size: 19px;
  }
  .jprogress .lbl {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .chev,
  .score-field.is-saving .st::before {
    transition: none;
    animation: none;
  }
}

/* ---------------------------------------------------------------- страница ошибки */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.error-page .code {
  font-size: 64px;
  font-weight: 300;
  color: var(--bd-muted);
}
