/* Минималистичный слой поверх Bootstrap в духе Яндекса:
   белый фон, серые акценты, круглые края, много воздуха. */

:root {
  --ya-bg: #f5f5f7;
  --ya-surface: #ffffff;
  --ya-border: #ebebef;
  --ya-text: #1f1f1f;
  --ya-muted: #8f8f8f;
  --ya-muted-2: #b3b3b3;
  --ya-accent: #1f1f1f;
  --ya-accent-contrast: #ffffff;
  --ya-chip: #f0f0f3;
  --ya-chip-active: #1f1f1f;
  --ya-danger: #e5484d;
  --ya-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
  --ya-shadow-2: 0 8px 24px rgba(0, 0, 0, 0.06);
  --ya-radius-sm: 10px;
  --ya-radius: 14px;
  --ya-radius-lg: 20px;

  --bs-body-bg: var(--ya-bg);
  --bs-body-color: var(--ya-text);
  --bs-border-color: var(--ya-border);
}

html,
body {
  background: var(--ya-bg);
  color: var(--ya-text);
  font-family:
    "YS Text", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

/* Типографика */
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  color: var(--ya-text);
  letter-spacing: -0.015em;
  font-weight: 600;
}

.small,
small,
.text-secondary {
  color: var(--ya-muted) !important;
}

code {
  background: var(--ya-chip);
  color: var(--ya-text);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* Шапка */
.navbar {
  --bs-navbar-padding-y: 0.9rem;
  background: var(--ya-surface) !important;
  border-bottom: 1px solid var(--ya-border) !important;
  box-shadow: none !important;
}

.navbar-brand {
  font-size: 1.02rem;
  font-weight: 600;
}

/* Навигационные пиллы */
.nav-pills {
  background: transparent;
  padding: 4px;
  border-radius: var(--ya-radius);
}

.nav-pills .nav-link {
  border-radius: 999px;
  color: var(--ya-muted);
  padding: 0.5rem 1rem;
  font-weight: 500;
  font-size: 0.92rem;
  background: transparent;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.nav-pills .nav-link:hover {
  background: var(--ya-chip);
  color: var(--ya-text);
}

.nav-pills .nav-link.active {
  background-color: var(--ya-accent) !important;
  color: var(--ya-accent-contrast) !important;
}

/* Карточки — высокие, с воздухом */
.card {
  border: 1px solid var(--ya-border) !important;
  border-radius: var(--ya-radius-lg) !important;
  background: var(--ya-surface);
  box-shadow: var(--ya-shadow-1);
  transition: box-shadow 0.18s ease;
}

.card:hover {
  box-shadow: var(--ya-shadow-2);
}

.card-body {
  padding: 1.75rem 1.75rem;
}

@media (min-width: 768px) {
  .card-body {
    padding: 2rem 2rem;
  }
}

.card h1,
.card h2,
.card h3,
.card .h4,
.card .h5,
.card .h6 {
  margin-bottom: 0.75rem;
}

.card > .card-body > *:last-child {
  margin-bottom: 0;
}

/* Форма входа */
#app-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-block: 2.5rem;
}

#app-login > .row {
  width: 100%;
}

@media (min-width: 640px) {
  #app-login {
    justify-content: center;
  }
}

#app-login .card-body {
  padding: 1.75rem 1.5rem;
}

@media (min-width: 480px) {
  #app-login .card-body {
    padding: 2.25rem 2rem;
  }
}

.login-card {
  max-width: 420px;
  margin-inline: auto;
}

.login-logo {
  display: flex;
  justify-content: center;
  padding-block: 4px 10px;
}

.login-logo img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
}

.navbar-logo {
  height: 36px;
  width: 36px;
  object-fit: contain;
  display: block;
}

.navbar-brand {
  padding: 0;
}

/* Кнопка "показать/скрыть" пароль */
.password-group .form-control {
  border-right: 0 !important;
}

.password-group .form-control:focus {
  z-index: 3;
}

.password-toggle.btn.btn-outline-secondary {
  background: var(--ya-surface) !important;
  border: 1px solid var(--ya-border) !important;
  border-left: 0 !important;
  color: var(--ya-muted) !important;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: var(--ya-radius-sm) !important;
  border-bottom-right-radius: var(--ya-radius-sm) !important;
}

.password-toggle.btn.btn-outline-secondary:hover,
.password-toggle.btn.btn-outline-secondary:focus {
  background: var(--ya-chip) !important;
  color: var(--ya-text) !important;
  border-color: var(--ya-border) !important;
}

.password-group:focus-within .form-control,
.password-group:focus-within .password-toggle {
  border-color: var(--ya-text) !important;
}

.password-group:focus-within {
  box-shadow: 0 0 0 3px rgba(31, 31, 31, 0.08);
  border-radius: var(--ya-radius-sm);
}

.password-group:focus-within .form-control:focus {
  box-shadow: none !important;
}

/* Невалидное состояние без иконок bootstrap */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--ya-danger) !important;
  background-image: none !important;
  padding-right: 0.9rem !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12) !important;
}

.password-group.is-invalid .form-control,
.password-group.is-invalid .password-toggle {
  border-color: var(--ya-danger) !important;
}

/* Кнопка submit со спиннером */
#btn-login[disabled] {
  opacity: 0.8;
  cursor: progress;
}

#btn-login .btn-label {
  display: inline-block;
}

/* Блок демо-входа (свернутый по умолчанию) */
.demo-login-block {
  border-top: 1px solid var(--ya-border);
  padding-top: 1rem;
}

.demo-login-block > summary {
  cursor: pointer;
  color: var(--ya-muted);
  font-weight: 500;
  list-style: none;
  user-select: none;
  padding: 0.15rem 0;
  transition: color 0.15s ease;
}

.demo-login-block > summary::-webkit-details-marker {
  display: none;
}

.demo-login-block > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  color: var(--ya-muted-2);
  transition: transform 0.15s ease;
}

.demo-login-block[open] > summary::before {
  transform: rotate(90deg);
}

.demo-login-block > summary:hover,
.demo-login-block[open] > summary {
  color: var(--ya-text);
}

.demo-login-block > summary:focus-visible {
  outline: 2px solid var(--ya-text);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Поля ввода */
.form-control,
.form-select {
  border-radius: var(--ya-radius-sm) !important;
  border-color: var(--ya-border) !important;
  background: var(--ya-surface);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  color: var(--ya-text);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ya-text) !important;
  box-shadow: 0 0 0 3px rgba(31, 31, 31, 0.08) !important;
}

.form-control::placeholder {
  color: var(--ya-muted-2);
}

.form-label {
  color: var(--ya-text);
  font-weight: 500;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  text-transform: none;
}

.form-check-label {
  color: var(--ya-text);
}

textarea.form-control {
  min-height: 96px;
}

/* Кнопки */
.btn {
  border-radius: var(--ya-radius-sm) !important;
  font-weight: 500;
  padding: 0.6rem 1.1rem;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-dark,
.btn-dark:focus {
  background: var(--ya-accent) !important;
  border-color: var(--ya-accent) !important;
  color: var(--ya-accent-contrast) !important;
}

.btn-dark:hover {
  background: #000 !important;
  border-color: #000 !important;
}

.btn-outline-dark {
  color: var(--ya-text) !important;
  border-color: var(--ya-border) !important;
  background: var(--ya-surface);
}

.btn-outline-dark:hover {
  background: var(--ya-chip);
  border-color: var(--ya-border) !important;
  color: var(--ya-text) !important;
}

.btn-outline-secondary {
  color: var(--ya-text) !important;
  background: var(--ya-chip);
  border-color: transparent !important;
}

.btn-outline-secondary:hover {
  background: #e6e6ea;
  color: var(--ya-text) !important;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

/* Бейдж рассчитанного возраста в модалке деталей */
.md-age-badge {
  min-width: 72px;
  justify-content: center;
  background: var(--ya-chip);
  border-color: var(--ya-border);
  color: var(--ya-text);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

/* Плашка активного мероприятия над формой бригады */
.primary-event-banner {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  background: var(--ya-chip);
  border: 1px solid var(--ya-border);
  border-radius: var(--ya-radius-sm);
  font-size: 0.95rem;
}

.primary-event-banner .peb-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  color: var(--ya-muted);
  font-weight: 600;
}

.primary-event-banner .peb-value {
  color: var(--ya-text);
}

.primary-event-banner .peb-value strong {
  font-weight: 600;
}

.primary-event-banner .peb-sub {
  color: var(--ya-muted);
  font-size: 0.88rem;
  margin-left: 0.25rem;
}

.primary-event-banner[data-empty="true"] {
  background: #fff7d6;
  border-color: #f0d98b;
}

.primary-event-banner[data-empty="true"] .peb-value {
  color: #8a6a00;
}

/* Быстрый выбор события — компактная таблица */
.quick-events-table {
  --bs-table-bg: var(--ya-surface);
  margin-bottom: 0;
}

.quick-events-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ya-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--ya-border);
  padding: 0.55rem 0.6rem;
  white-space: nowrap;
}

.quick-events-table tbody td {
  vertical-align: middle;
  padding: 0.55rem 0.6rem;
  border-top: 1px solid var(--ya-border);
}

.quick-events-table .qe-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.quick-events-table .qe-row:hover {
  background: var(--ya-chip);
}

.quick-events-table .qe-row.is-active {
  background: var(--ya-accent);
  color: var(--ya-accent-contrast);
}

.quick-events-table .qe-row.is-active .text-secondary {
  color: rgba(255, 255, 255, 0.7) !important;
}

.quick-events-table .qe-row.is-active .badge {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
  border-color: transparent !important;
}

.quick-events-table .qe-row.is-active a[href^="tel:"] {
  color: inherit;
}

.quick-events-table a[href^="tel:"] {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.quick-events-table .qe-situation-line {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.quick-events-table .countdown {
  font-weight: 600;
  font-size: 0.92rem;
}

.quick-events-table .qe-pills {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.quick-events-table .qv-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.72rem;
  white-space: nowrap;
}

.quick-events-table .qe-row.is-active .qv-pill {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.quick-events-table .qv-pill.is-hosp {
  background: rgba(212, 33, 33, 0.12);
  color: #a3221d;
}

.quick-events-table .qe-row.is-active .qv-pill.is-hosp {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.quick-ev-roles-btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  line-height: 1.2;
}

.quick-events-table .qe-row.is-active .quick-ev-roles-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

/* Адаптив: на узких экранах таблица превращается в стек карточек */
@media (max-width: 720px) {
  .quick-events-table thead {
    display: none;
  }
  .quick-events-table,
  .quick-events-table tbody,
  .quick-events-table tr,
  .quick-events-table td {
    display: block;
    width: 100%;
  }
  .quick-events-table .qe-row {
    border: 1px solid var(--ya-border);
    border-radius: var(--ya-radius);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.6rem;
    background: var(--ya-surface);
  }
  .quick-events-table .qe-row.is-active {
    border-color: var(--ya-accent);
  }
  .quick-events-table tbody td {
    border-top: 0;
    padding: 0.25rem 0;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0.5rem;
    align-items: start;
  }
  .quick-events-table tbody td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ya-muted);
    font-weight: 500;
    padding-top: 0.1rem;
  }
  .quick-events-table .qe-row.is-active td::before {
    color: rgba(255, 255, 255, 0.7);
  }
  .quick-events-table .qe-actions {
    grid-template-columns: 1fr;
    text-align: left !important;
  }
  .quick-events-table .qe-actions::before {
    display: none;
  }
}

/* Бейджи */
.badge {
  font-weight: 500;
  padding: 0.35em 0.7em;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.badge.text-bg-secondary {
  background: var(--ya-chip) !important;
  color: var(--ya-text) !important;
}

.badge.text-bg-light {
  background: var(--ya-chip) !important;
  color: var(--ya-muted) !important;
  border: 0 !important;
}

/* Таблицы отчётов */
.table {
  --bs-table-bg: var(--ya-surface);
  --bs-table-border-color: var(--ya-border);
  border-radius: var(--ya-radius-sm);
  overflow: hidden;
  margin-bottom: 0;
}

.table thead th {
  background: var(--ya-chip);
  color: var(--ya-muted);
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--ya-border);
}

.table tbody td {
  vertical-align: middle;
  border-color: var(--ya-border);
}

/* Оперативный JSON-отчёт */
#operational-report {
  background: var(--ya-chip) !important;
  border: 1px solid var(--ya-border);
  border-radius: var(--ya-radius-sm);
  padding: 1rem 1.1rem !important;
  color: var(--ya-text);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Ошибки */
.text-danger {
  color: var(--ya-danger) !important;
}

/* Главная: полоса мероприятий главврача */
.chief-summary-fullbleed {
  width: 100vw;
  max-width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
}

.chief-summary-banner {
  background: var(--ya-chip, #f4f4f5);
  border-radius: 0;
}

.chief-summary-banner-title {
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.chief-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--ya-surface, #fff);
  border: 1px solid var(--ya-border, #e5e5e5);
  font-size: 0.875rem;
  white-space: nowrap;
}

.chief-summary-pill--muted {
  white-space: normal;
  max-width: 100%;
}

.chief-summary-pill--danger {
  border-color: rgba(220, 53, 69, 0.35);
  color: var(--ya-danger, #dc3545);
}

/* Кабинет бригады (staff): форма слева, «Мои карточки» справа (grid, не Bootstrap col-xl) */
.brigade-staff-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  width: 100%;
  align-items: start;
}

.brigade-staff-main {
  min-width: 0;
}

.brigade-staff-sidebar {
  min-width: 0;
}

@media (min-width: 768px) {
  .brigade-staff-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 400px);
  }

  .brigade-staff-incidents-card {
    position: sticky;
    top: 1rem;
  }

  .brigade-staff-incidents-scroll {
    max-height: calc(100vh - 9rem);
    overflow: auto;
  }
}

.chief-home-stack {
  width: 100%;
}

.chief-cards-section {
  width: 100%;
  max-width: 100%;
}

.chief-strip-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.chief-strip-grid--all {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.chief-strip-card {
  border-radius: var(--ya-radius);
  border: 1px solid var(--ya-border);
  box-shadow: var(--ya-shadow-1);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.chief-strip-card:hover {
  background: var(--ya-chip);
}

.chief-strip-card.is-active {
  border-color: var(--ya-text);
  box-shadow: var(--ya-shadow-1), 0 0 0 1px var(--ya-text);
}

/* Кнопка настроек на карточке главврача: контурная иконка, без «зажатой» заливки */
.chief-ev-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.5rem;
  line-height: 0;
  border-radius: var(--ya-radius-sm);
}

.chief-ev-gear-btn svg {
  flex-shrink: 0;
}

.chief-strip-stats {
  line-height: 1.35;
}

.chief-strip-stat-line + .chief-strip-stat-line {
  margin-top: 0.2rem;
}

.chief-strip-countdown {
  border-top: 1px solid var(--ya-border);
  padding-top: 0.5rem;
}

#home-head-row {
  --bs-gutter-y: 0.75rem;
}

/* Списки инцидентов */
.incident-list {
  overflow-x: auto;
  margin: 0;
}

.incident-table {
  --bs-table-bg: var(--ya-surface);
  width: 100%;
  margin-bottom: 0;
}

.incident-table thead th {
  background: transparent;
  color: var(--ya-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--ya-border);
  padding: 0.6rem 0.75rem;
}

.incident-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.incident-table tbody tr:hover {
  background: var(--ya-chip);
}

.incident-table td {
  padding: 0.8rem 0.75rem;
  border-color: var(--ya-border);
  font-size: 0.92rem;
}

.incident-table--compact thead th {
  padding: 0.35rem 0.45rem;
  font-size: 0.68rem;
}

.incident-table--compact td {
  padding: 0.4rem 0.45rem;
  font-size: 0.82rem;
  vertical-align: middle;
}

.incident-table--compact .status-badge {
  font-size: 0.72rem;
  padding: 0.2em 0.45em !important;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
}

.btn-sm.btn-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.btn-icon svg {
  flex-shrink: 0;
}

/* Бейджи статусов */
.status-badge {
  background: var(--ya-chip) !important;
  color: var(--ya-text) !important;
  border: 0 !important;
}

.status-badge.status-draft {
  background: #fff6db !important;
  color: #8a6a00 !important;
}

.status-badge.status-confirmed {
  background: #e6f4ff !important;
  color: #0a5bb0 !important;
}

.status-badge.status-closed {
  background: #e9f7e9 !important;
  color: #1f6c33 !important;
}

.status-badge.status-archived {
  background: var(--ya-chip) !important;
  color: var(--ya-muted) !important;
}

/* Модалка редактирования */
.modal-content {
  border-radius: var(--ya-radius-lg) !important;
  border: 1px solid var(--ya-border) !important;
  background: var(--ya-surface);
  box-shadow: var(--ya-shadow-2);
}

.modal-header,
.modal-footer {
  border-color: var(--ya-border) !important;
  padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.form-check-input {
  border-color: var(--ya-border);
}

.form-check-input:checked {
  background-color: var(--ya-accent);
  border-color: var(--ya-accent);
}

/* Системные мелочи */
hr {
  border-color: var(--ya-border);
  opacity: 1;
}

::selection {
  background: rgba(31, 31, 31, 0.12);
}

/* ===== Админка: чипы дистанций и список забегов ===== */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  background: var(--ya-chip);
  color: var(--ya-text);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.chip:hover {
  background: #e6e6ea;
}

.chip.chip-active {
  background: var(--ya-accent);
  color: var(--ya-accent-contrast);
}

.chip.chip-active:hover {
  background: #000;
}

.chip.chip-custom {
  border: 1px dashed var(--ya-accent);
}

.custom-distance-group {
  max-width: 320px;
}

.races-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.race-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--ya-border);
  border-radius: var(--ya-radius);
  background: var(--ya-surface);
}

.race-row-distance .badge {
  font-size: 0.82rem;
  padding: 0.4em 0.7em;
}

.race-row-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(140px, 1fr) 120px;
  gap: 0.6rem;
}

@media (max-width: 720px) {
  .race-row {
    grid-template-columns: 1fr auto;
  }
  .race-row-distance {
    grid-column: 1 / -1;
  }
  .race-row-fields {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
}

.race-field label {
  display: block;
}

.race-field .form-control-sm {
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
}

.race-remove {
  align-self: start;
}

/* ===== Главная: ближайшие старты и сводка по городам ===== */
.upcoming-starts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.start-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--ya-border);
  border-radius: var(--ya-radius);
  background: var(--ya-surface);
}

.start-row-title {
  font-weight: 600;
  font-size: 0.96rem;
}

.start-row-sub {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.start-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ya-text);
}

.countdown.is-soon {
  color: #b36a00;
}

.countdown.is-past {
  color: var(--ya-muted);
}

.timing-badge {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  background: var(--ya-chip);
  color: var(--ya-muted);
  white-space: nowrap;
}

.timing-badge.timing-pending {
  background: var(--ya-chip);
  color: var(--ya-text);
}

.timing-badge.timing-running {
  background: #e6f4ff;
  color: #0a5bb0;
}

.timing-badge.timing-done,
.timing-badge.timing-started {
  background: #e9f7e9;
  color: #1f6c33;
}

.timing-badge.timing-ontime {
  background: #e9f7e9;
  color: #1f6c33;
}

.timing-badge.timing-late {
  background: #fdecec;
  color: #a4272b;
}

.timing-badge.timing-early {
  background: #fff6db;
  color: #8a6a00;
}

/* ===== Сводка по городам ===== */
.cities-digest {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.city-block {
  border: 1px solid var(--ya-border);
  border-radius: var(--ya-radius);
  padding: 0.9rem 1rem;
  background: var(--ya-surface);
}

.city-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.city-head .fw-semibold {
  font-size: 1rem;
}

.city-events {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.city-events li {
  font-size: 0.9rem;
  line-height: 1.4;
}

.city-events a[href^="tel:"] {
  color: var(--ya-text);
  text-decoration: none;
  border-bottom: 1px dashed var(--ya-border);
}

.city-events a[href^="tel:"]:hover {
  border-bottom-color: var(--ya-text);
}

/* Админ-таблица мероприятий */
.admin-events-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ya-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--ya-border);
}

.admin-events-table tbody td {
  vertical-align: top;
  border-top: 1px solid var(--ya-border);
}

.admin-events-table a[href^="tel:"] {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

/* Модалка «Ответственные» */
.roles-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.roles-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--ya-border);
  border-radius: 0.6rem;
  background: var(--ya-surface);
}

.roles-row-user .fw-semibold {
  font-size: 0.95rem;
  line-height: 1.25;
}

.roles-row-role .badge {
  font-weight: 500;
}

@media (max-width: 420px) {
  .roles-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "user role"
      "actions actions";
  }
  .roles-row-user {
    grid-area: user;
  }
  .roles-row-role {
    grid-area: role;
  }
  .roles-row-actions {
    grid-area: actions;
    justify-self: end;
  }
}
