/* ==========================================================================
   СБОРЫ v2 — единый современный интерфейс модальных окон
   Школы, участники, карточка участника, добавление/редактирование школы.
   ========================================================================== */

/* ---------------------------------------------------------------- Основа */
.cx-dialog {
  border-radius: 22px !important;
  border: 1px solid var(--c-border) !important;
  box-shadow: var(--c-shadow-lg) !important;
  overflow: hidden !important;
}

.cx-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  background: var(--c-surface);
}
.cx-head__title { flex: 1; min-width: 0; }
.cx-head__title h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.cx-head__title h2 > i { color: var(--c-brand); }
.cx-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 7px;
  font-size: .82rem;
  color: var(--c-muted);
}
.cx-head__meta b { color: var(--c-text-2); font-weight: 600; }
.cx-head__meta span { display: inline-flex; align-items: center; gap: 5px; }
.cx-head__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.cx-icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-text-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .9rem;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cx-icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.cx-icon-btn--danger:hover { background: rgba(220, 38, 38, .1); color: var(--c-danger); }
.cx-icon-btn--brand:hover { background: var(--c-brand-soft); color: var(--c-brand); border-color: rgba(37, 99, 235, .25); }

.cx-journal-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding-right: 8px;
}
.cx-journal-score span {
  font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c-muted);
}
.cx-journal-score b { font-size: 1.5rem; font-weight: 750; line-height: 1.1; color: var(--c-brand); }

.cx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 11px;
  padding: 10px 16px;
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.cx-btn:disabled { opacity: .5; cursor: not-allowed; }
.cx-btn--primary { background: var(--c-brand); color: #fff; box-shadow: 0 3px 10px -3px rgba(37, 99, 235, .55); }
.cx-btn--primary:hover { background: var(--c-brand-2); }
.cx-btn--ghost { background: var(--c-surface); color: var(--c-text-2); border-color: var(--c-border); }
.cx-btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.cx-btn--success { background: rgba(5, 150, 105, .12); color: #047857; border-color: rgba(5, 150, 105, .3); }
.cx-btn--success:hover { background: rgba(5, 150, 105, .2); }
.cx-btn--danger { background: transparent; color: var(--c-danger); border-color: rgba(220, 38, 38, .35); }
.cx-btn--danger:hover { background: rgba(220, 38, 38, .08); }
.cx-btn--soft { background: var(--c-brand-soft); color: var(--c-brand); border-color: rgba(37, 99, 235, .25); }
body.dark-theme .cx-btn--success { color: #6ee7b7; }

.cx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .73rem;
  font-weight: 650;
  line-height: 1.45;
  white-space: nowrap;
  border: 1px solid transparent;
}
.cx-chip i { font-size: .72rem; }
.cx-chip--neutral { background: var(--c-surface-2); color: var(--c-text-2); border-color: var(--c-border); }
.cx-chip--info { background: #eef4ff; color: #1d4ed8; border-color: rgba(37, 99, 235, .18); }
.cx-chip--brand { background: var(--c-brand-soft); color: var(--c-brand); border-color: rgba(37, 99, 235, .22); }
.cx-chip--success { background: rgba(5, 150, 105, .1); color: #047857; border-color: rgba(5, 150, 105, .2); }
.cx-chip--warning { background: rgba(217, 119, 6, .1); color: #b45309; border-color: rgba(217, 119, 6, .22); }
.cx-chip--danger { background: rgba(220, 38, 38, .08); color: #b91c1c; border-color: rgba(220, 38, 38, .2); }
.cx-chip--muted { background: transparent; color: var(--c-muted); border-color: var(--c-border); }
body.dark-theme .cx-chip--info { background: #16233c; color: #93c5fd; }
body.dark-theme .cx-chip--success { color: #6ee7b7; }
body.dark-theme .cx-chip--warning { color: #fcd34d; }
body.dark-theme .cx-chip--danger { color: #fca5a5; }

.cx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  background: var(--c-surface);
}
.cx-stat {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--c-surface-2);
  border: 1px solid transparent;
  min-width: 0;
}
.cx-stat__icon {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef4ff; color: #2563eb; font-size: .92rem;
}
.cx-stat--success .cx-stat__icon { background: rgba(5, 150, 105, .12); color: #059669; }
.cx-stat--warning .cx-stat__icon { background: rgba(217, 119, 6, .12); color: #d97706; }
.cx-stat--danger .cx-stat__icon { background: rgba(220, 38, 38, .1); color: #dc2626; }
.cx-stat--muted .cx-stat__icon { background: var(--c-surface-2); color: var(--c-muted); }
.cx-stat__value { font-size: 1.18rem; font-weight: 750; line-height: 1.05; letter-spacing: -.02em; }
.cx-stat__label { font-size: .71rem; font-weight: 600; color: var(--c-muted); margin-top: 2px; white-space: nowrap; }
body.dark-theme .cx-stat__icon { background: #16233c; color: #93c5fd; }

.cx-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: .83rem;
  line-height: 1.45;
  border: 1px solid transparent;
  margin: 12px 24px 0;
  flex-shrink: 0;
}
.cx-banner i { font-size: .95rem; flex: 0 0 auto; }
.cx-banner__text { flex: 1; min-width: 0; }
.cx-banner__text b { font-weight: 700; }
.cx-banner--warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.cx-banner--danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.cx-banner--info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.cx-banner .cx-btn { padding: 6px 11px; font-size: .78rem; }
.cx-confirm-list {
  max-height: 170px; overflow-y: auto; margin-top: 10px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  font-size: .8rem; line-height: 1.6; text-align: left;
}
body.dark-theme .cx-banner--warning { background: #2a2110; color: #fcd34d; border-color: #4a3a12; }
body.dark-theme .cx-banner--danger { background: #2a1414; color: #fca5a5; border-color: #4a1d1d; }
body.dark-theme .cx-banner--info { background: #101f38; color: #93c5fd; border-color: #1e3a5f; }

.cx-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 40px 20px; text-align: center; color: var(--c-muted);
}
.cx-empty i { font-size: 1.9rem; opacity: .45; }
.cx-empty h3 { margin: 0; font-size: 1rem; color: var(--c-text); font-weight: 650; }
.cx-empty p { margin: 0; font-size: .86rem; line-height: 1.5; max-width: 420px; }

/* ------------------------------------------------------ Окно «Список школ» */
#schoolsModal .modal-content.cx-dialog {
  width: min(1500px, 95vw) !important;
  max-width: 1500px !important;
  height: 90vh !important;
  display: flex !important;
  flex-direction: row !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.cx-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cx-side {
  flex: 0 0 364px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--c-surface-2);
  border-left: 1px solid var(--c-border);
  overflow: hidden;
}

.cx-table-wrap { flex: 1; overflow: auto; padding: 8px 16px 14px; }
.cx-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: .86rem; }
.cx-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 9px 10px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  text-align: left;
}
.cx-table thead th.is-center { text-align: center; }
.cx-table tbody td {
  padding: 11px 10px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.cx-table tbody td:first-child { border-left: 1px solid var(--c-border); border-radius: 12px 0 0 12px; }
.cx-table tbody td:last-child { border-right: 1px solid var(--c-border); border-radius: 0 12px 12px 0; }
.cx-table tbody tr { cursor: pointer; transition: transform .12s ease; }
.cx-table tbody tr:hover td { background: var(--c-brand-soft); }
.cx-table tbody tr:active { transform: scale(.998); }
.cx-table tbody tr.has-problems td { background: #fffdf5; }
.cx-table tbody tr.has-problems td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.cx-table tbody tr.has-problems:hover td { background: #fff8e6; }
body.dark-theme .cx-table tbody tr.has-problems td { background: #241f12; }
body.dark-theme .cx-table tbody tr.has-problems:hover td { background: #2c2514; }

.cx-school-cell { min-width: 0; }
.cx-school-name {
  display: flex; align-items: center; gap: 7px;
  font-weight: 650; line-height: 1.35; color: var(--c-text);
  min-width: 0;
}
.cx-school-name__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-school-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.cx-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 650; line-height: 1.4;
  border-radius: 6px; padding: 2px 6px;
  white-space: nowrap;
}
.cx-flag i { font-size: .64rem; }
.cx-flag--warning { background: rgba(217, 119, 6, .11); color: #b45309; }
.cx-flag--danger { background: rgba(220, 38, 38, .09); color: #b91c1c; }
.cx-flag--muted { background: var(--c-surface-2); color: var(--c-muted); }
body.dark-theme .cx-flag--warning { color: #fcd34d; background: rgba(251, 191, 36, .12); }
body.dark-theme .cx-flag--danger { color: #fca5a5; background: rgba(248, 113, 113, .12); }

.cx-num { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cx-num--ok { color: var(--c-success); }
.cx-num--bad { color: var(--c-danger); }
.cx-num--muted { color: var(--c-muted); font-weight: 600; }

.cx-row-actions { text-align: right; white-space: nowrap; }
.cx-row-actions .cx-icon-btn { width: 30px; height: 30px; }

.cx-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.cx-foot__spacer { flex: 1; }
.cx-foot__hint { font-size: .76rem; color: var(--c-muted); }

/* ----------------------------------------------------- Панель этапов */
.cx-side__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 10px;
  flex-shrink: 0;
}
.cx-side__head h3 {
  margin: 0; font-size: .98rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.cx-side__head h3 i { color: var(--c-brand); }
.cx-side__head .cx-chip { font-size: .68rem; }
.cx-side__scroll { flex: 1; overflow-y: auto; padding: 0 16px 14px; }

.cx-next {
  margin: 4px 16px 14px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--c-brand-soft), rgba(37, 99, 235, .04));
  border: 1px solid rgba(37, 99, 235, .22);
  flex-shrink: 0;
}
body.dark-theme .cx-next { background: #12203a; border-color: #1e3a5f; }
.cx-next__label {
  display: flex; align-items: center; gap: 6px;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 750; color: var(--c-brand); margin-bottom: 7px;
}
.cx-next__title { font-size: .95rem; font-weight: 700; line-height: 1.3; color: var(--c-text); }
.cx-next__text { margin: 5px 0 0; font-size: .79rem; line-height: 1.5; color: var(--c-text-2); }
.cx-next__actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.cx-next__actions .cx-btn { padding: 8px 12px; font-size: .8rem; }
.cx-next--done { background: rgba(5, 150, 105, .07); border-color: rgba(5, 150, 105, .25); }
.cx-next--done .cx-next__label { color: var(--c-success); }

.cx-docs {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(37, 99, 235, .18);
}
.cx-docs__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .7rem; font-weight: 750; color: var(--c-text-2);
  margin-bottom: 6px;
}
.cx-docs__head span { display: inline-flex; align-items: center; gap: 6px; }
.cx-docs__head i { color: var(--c-brand); }
.cx-docs__head b { font-size: .66rem; color: var(--c-muted); font-weight: 650; }
.cx-docs__list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.cx-doc {
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; line-height: 1.4;
}
.cx-doc i { width: 13px; text-align: center; font-size: .66rem; }
.cx-doc b { font-weight: 650; }
.cx-doc em { margin-left: auto; font-style: normal; font-size: .64rem; color: var(--c-muted); }
.cx-doc.is-ready em { color: var(--c-success); }
.cx-docs__stages { gap: 4px; }
.cx-docs__stages .cx-doc { padding: 1px 0; }
.cx-doc.is-ready { color: var(--c-success); }
.cx-doc.is-ready i { color: var(--c-success); }
.cx-doc.is-pending { color: var(--c-muted); }
.cx-doc.is-pending i { color: var(--c-border-strong); }
.cx-docs__note {
  font-size: .66rem;
  line-height: 1.35;
  color: var(--c-muted);
  margin: 1px 0 8px;
}
.cx-docs .cx-btn { width: 100%; justify-content: center; padding: 7px 10px; font-size: .76rem; }

.cx-stages { list-style: none; margin: 0; padding: 0; }
.cx-stage {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 0 0 16px;
}
.cx-stage:last-child { padding-bottom: 0; }
.cx-stage__rail {
  position: relative;
  flex: 0 0 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cx-stage__dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border-strong);
  color: var(--c-muted);
  z-index: 1;
  flex-shrink: 0;
}
.cx-stage__line {
  position: absolute; top: 26px; bottom: -2px; left: 50%;
  width: 2px; transform: translateX(-50%);
  background: var(--c-border);
  border-radius: 2px;
}
.cx-stage:last-child .cx-stage__line { display: none; }
.cx-stage__body { min-width: 0; padding-top: 1px; flex: 1; }
.cx-stage__title {
  font-size: .86rem; font-weight: 650; line-height: 1.3;
  color: var(--c-muted);
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.cx-stage__desc { font-size: .75rem; line-height: 1.45; color: var(--c-muted); margin-top: 3px; }
.cx-stage__date { font-size: .7rem; color: var(--c-muted); opacity: .8; margin-top: 2px; }

.cx-stage--done .cx-stage__dot { background: rgba(5, 150, 105, .12); border-color: rgba(5, 150, 105, .45); color: #059669; }
.cx-stage--done .cx-stage__line { background: rgba(5, 150, 105, .3); }
.cx-stage--done .cx-stage__title { color: var(--c-text); }
.cx-stage--done .cx-stage__desc { color: var(--c-text-2); }
.cx-stage--current .cx-stage__dot {
  background: var(--c-brand); border-color: var(--c-brand); color: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .16);
}
.cx-stage--current .cx-stage__title { color: var(--c-text); font-weight: 750; }
.cx-stage--current .cx-stage__desc { color: var(--c-text-2); }
.cx-stage__now {
  font-size: .62rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--c-brand); background: var(--c-brand-soft);
  border-radius: 999px; padding: 1px 7px;
}
.cx-side__foot {
  border-top: 1px solid var(--c-border);
  padding: 10px 16px;
  display: flex; flex-wrap: wrap; gap: 6px;
  flex-shrink: 0;
}
.cx-side__foot .cx-btn { padding: 7px 10px; font-size: .76rem; }

/* ------------------------------------------------------- Участники */
#peopleModal .modal-content.cx-people-dialog {
  width: min(1380px, 97vw) !important;
  max-width: 1380px !important;
  min-width: 0 !important;
  height: 90vh !important;
  display: flex !important;
  flex-direction: row !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 22px !important;
}
.cx-people-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cx-people-side {
  flex: 0 0 330px;
  display: flex; flex-direction: column;
  background: var(--c-surface-2);
  border-left: 1px solid var(--c-border);
  overflow: hidden;
}
.cx-people-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--c-border); flex-shrink: 0; }
.cx-people-head__top { display: flex; align-items: flex-start; gap: 12px; }
.cx-people-school { flex: 1; min-width: 0; }
.cx-people-school h2 {
  margin: 0 0 3px; font-size: 1.25rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cx-people-school p { margin: 0; font-size: .8rem; color: var(--c-muted); display: flex; flex-wrap: wrap; gap: 3px 12px; }
.cx-people-school p span { display: inline-flex; align-items: center; gap: 5px; }
.cx-people-school p i { font-size: .72rem; }
.cx-people-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
}
.cx-search {
  position: relative; display: flex; align-items: center;
  flex: 1 1 200px; min-width: 150px;
}
.cx-search i { position: absolute; left: 11px; color: var(--c-muted); font-size: .8rem; pointer-events: none; }
.cx-search input {
  width: 100%;
  padding: 9px 12px 9px 32px !important;
  border-radius: 10px !important;
  border: 1px solid var(--c-border) !important;
  background: var(--c-surface) !important;
  color: var(--c-text) !important;
  font: inherit; font-size: .84rem !important;
}
.cx-search input:focus { outline: none; border-color: var(--c-brand) !important; box-shadow: var(--c-ring) !important; }
.cx-seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--c-surface-2); border-radius: 10px; border: 1px solid var(--c-border);
}
.cx-seg button {
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 650; color: var(--c-text-2);
  padding: 6px 10px; border-radius: 8px;
  white-space: nowrap;
}
.cx-seg button.is-active { background: var(--c-surface); color: var(--c-brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

.cx-people-list { flex: 1; overflow: auto; padding: 6px 18px 12px; }
.cx-people-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: .85rem; }
.cx-people-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 8px 8px; text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.cx-people-table thead th.is-center { text-align: center; }
.cx-people-table tbody td {
  padding: 9px 8px;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  vertical-align: middle;
}
.cx-people-table tbody td:first-child { border-left: 1px solid var(--c-border); border-radius: 10px 0 0 10px; }
.cx-people-table tbody td:last-child { border-right: 1px solid var(--c-border); border-radius: 0 10px 10px 0; }
.cx-people-table tbody tr { cursor: pointer; }
.cx-people-table tbody tr:hover td { background: var(--c-brand-soft); }
.cx-person-name { font-weight: 600; line-height: 1.35; display: flex; align-items: center; gap: 7px; }
.cx-person-name i { color: var(--c-danger); font-size: .78rem; flex: 0 0 auto; }
.cx-people-table .cx-row-actions { text-align: right; }
.cx-people-table .cx-icon-btn { width: 29px; height: 29px; font-size: .8rem; }
.cx-people-foot {
  flex-shrink: 0;
  padding: 11px 20px 14px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex; gap: 8px;
}
.cx-people-foot .cx-btn { flex: 1; }

.cx-add-panel {
  margin: 10px 18px 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  flex-shrink: 0;
}
.cx-add-panel h4 { margin: 0 0 8px; font-size: .84rem; font-weight: 700; }
.cx-add-panel__row { display: flex; gap: 8px; flex-wrap: wrap; }
.cx-add-panel__row input { flex: 1 1 180px; }
.cx-add-panel__row .cx-btn { flex: 0 0 auto; }

.cx-history { flex: 1; overflow-y: auto; padding: 10px 18px 18px; }
.cx-history-group { margin-bottom: 14px; }
.cx-history-date {
  font-size: .66rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
  color: var(--c-muted); margin: 0 0 6px 2px;
}
.cx-history-item {
  display: flex; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--c-border);
}
.cx-history-item:last-child { border-bottom: none; }
.cx-history-icon {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-brand-soft); color: var(--c-brand); font-size: .7rem;
}
.cx-history-item--danger .cx-history-icon { background: rgba(220, 38, 38, .09); color: var(--c-danger); }
.cx-history-item--warning .cx-history-icon { background: rgba(217, 119, 6, .11); color: var(--c-warning); }
.cx-history-item--success .cx-history-icon { background: rgba(5, 150, 105, .1); color: var(--c-success); }
.cx-history-text { font-size: .8rem; line-height: 1.45; color: var(--c-text); min-width: 0; }
.cx-history-text del { color: var(--c-muted); }
.cx-history-time { font-size: .68rem; color: var(--c-muted); margin-top: 2px; }

/* --------------------------------------------------- Карточка участника */
#participantCardModal .modal-content.cx-card-dialog {
  width: min(1120px, 96vw) !important;
  max-width: 1120px !important;
  height: 88vh !important;
  display: flex !important;
  flex-direction: row !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 22px !important;
}
.cx-card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.cx-card-side {
  flex: 0 0 320px;
  display: flex; flex-direction: column;
  background: var(--c-surface-2);
  border-left: 1px solid var(--c-border);
  overflow: hidden;
}
.cx-card-hero {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; gap: 16px; align-items: flex-start;
  flex-shrink: 0;
}
.cx-avatar {
  width: 58px; height: 58px; border-radius: 16px; flex: 0 0 58px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-brand-soft); color: var(--c-brand);
  font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em;
  border: 1px solid rgba(37, 99, 235, .2);
}
.cx-card-hero__main { flex: 1; min-width: 0; }
.cx-card-hero h2 {
  margin: 0 0 5px;
  font-size: 1.45rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.25;
  overflow-wrap: anywhere;
}
.cx-card-hero__sub { font-size: .8rem; color: var(--c-muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cx-card-hero__sub span { display: inline-flex; align-items: center; gap: 5px; }
.cx-card-hero__status { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }

.cx-card-body { padding: 18px 26px 22px; }
.cx-card-section { margin-bottom: 18px; }
.cx-card-section:last-child { margin-bottom: 0; }
.cx-card-section__title {
  font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-muted);
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 8px;
}
.cx-card-section__title i { color: var(--c-brand); font-size: .78rem; }
.cx-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--c-border);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
}
.cx-info-item {
  background: var(--c-surface);
  padding: 9px 12px;
  min-width: 0;
}
.cx-info-item dt {
  font-size: .68rem; font-weight: 650; color: var(--c-muted);
  margin: 0 0 3px;
}
.cx-info-item dd {
  margin: 0;
  font-size: .84rem; line-height: 1.4; color: var(--c-text);
  overflow-wrap: anywhere;
}
.cx-info-item dd.is-muted { color: var(--c-muted); }
.cx-info-item dd.is-warning { color: #b45309; font-weight: 650; }
body.dark-theme .cx-info-item dd.is-warning { color: #fcd34d; }
.cx-info-item--wide { grid-column: 1 / -1; }

.cx-scores {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  font-size: .83rem;
}
.cx-scores th, .cx-scores td { padding: 7px 11px; text-align: left; border-bottom: 1px solid var(--c-border); }
.cx-scores th { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); background: var(--c-surface-2); }
.cx-scores td:last-child, .cx-scores th:last-child { text-align: center; width: 86px; font-weight: 700; }
.cx-scores tr:last-child td { border-bottom: none; }
.cx-scores__overall td { background: var(--c-brand-soft); font-weight: 750; }
.cx-score-value { font-weight: 750; font-variant-numeric: tabular-nums; }
.cx-score-value--5 { color: #059669; }
.cx-score-value--4 { color: #2563eb; }
.cx-score-value--3 { color: #d97706; }
.cx-score-value--low { color: #dc2626; }

.cx-card-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 26px 20px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.cx-card-actions .cx-btn { padding: 9px 13px; font-size: .82rem; }
.cx-card-actions__spacer { flex: 1; }

.cx-route-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cx-route-card {
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  padding: 11px 13px;
  min-width: 0;
}
.cx-route-card__head {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 5px;
}
.cx-route-card__head b { font-size: .82rem; font-weight: 700; }
.cx-route-card__head .cx-chip { margin-left: auto; font-size: .66rem; padding: 2px 7px; }
.cx-route-card__bus { font-size: .8rem; font-weight: 600; color: var(--c-text); }
.cx-route-card__plate { font-size: .76rem; color: var(--c-muted); }
.cx-route-card__path {
  margin-top: 7px; font-size: .76rem; line-height: 1.45; color: var(--c-text-2);
  display: flex; flex-direction: column; gap: 2px;
}
.cx-route-card__path span { display: flex; align-items: flex-start; gap: 6px; }
.cx-route-card__path i { margin-top: 3px; font-size: .64rem; color: var(--c-brand); }
.cx-route-card__time { margin-top: 7px; font-size: .72rem; color: var(--c-muted); }
.cx-route-card--empty { border-style: dashed; background: transparent; }
.cx-route-card--empty .cx-route-card__bus { color: var(--c-muted); font-weight: 500; }

.cx-timeline { flex: 1; overflow-y: auto; padding: 8px 18px 18px; }
.cx-timeline-item { position: relative; display: flex; gap: 10px; padding-bottom: 14px; }
.cx-timeline-item:last-child { padding-bottom: 0; }
.cx-timeline-item__dot {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-surface); border: 1.5px solid var(--c-border-strong);
  color: var(--c-muted); font-size: .58rem; z-index: 1;
}
.cx-timeline-item__line {
  position: absolute; top: 22px; bottom: -1px; left: 10px;
  width: 2px; background: var(--c-border);
}
.cx-timeline-item:last-child .cx-timeline-item__line { display: none; }
.cx-timeline-item--current .cx-timeline-item__dot {
  background: var(--c-brand); border-color: var(--c-brand); color: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}
.cx-timeline-item__body { min-width: 0; padding-top: 1px; }
.cx-timeline-item__title { font-size: .8rem; font-weight: 650; line-height: 1.3; }
.cx-timeline-item__time { font-size: .7rem; color: var(--c-muted); margin-top: 2px; }
.cx-timeline-empty { padding: 24px 8px; text-align: center; color: var(--c-muted); font-size: .82rem; }

/* ------------------------------------- Добавление / редактирование школы */
#addSchoolModal .modal-content.cx-form-dialog,
#editSchoolModal .modal-content.cx-form-dialog {
  width: min(780px, 96vw) !important;
  max-width: 780px !important;
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: 22px !important;
}
.cx-form-scroll { flex: 1; overflow-y: auto; padding: 16px 24px 0; min-height: 0; }
.cx-form-foot {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 24px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.cx-form-foot__spacer { flex: 1; }
.cx-form-foot__hint { font-size: .75rem; color: var(--c-muted); }

.cx-word-drop {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px dashed rgba(37, 99, 235, .4);
  background: linear-gradient(135deg, var(--c-brand-soft), rgba(37, 99, 235, .03));
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  margin-bottom: 16px;
}
.cx-word-drop:hover, .cx-word-drop.is-over {
  border-color: var(--c-brand);
  background: rgba(37, 99, 235, .1);
}
.cx-word-drop__icon {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-brand); color: #fff; font-size: 1.15rem;
}
.cx-word-drop__main { flex: 1; min-width: 0; }
.cx-word-drop__title { font-size: .92rem; font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cx-word-drop__title .cx-chip { font-size: .62rem; padding: 1px 6px; }
.cx-word-drop__hint { font-size: .76rem; color: var(--c-muted); margin-top: 2px; line-height: 1.4; }
.cx-word-drop__btn { flex: 0 0 auto; }
.cx-word-drop.is-loading { pointer-events: none; opacity: .75; }
.cx-word-drop.is-loading .cx-word-drop__icon i { animation: cx-spin 1s linear infinite; }
@keyframes cx-spin { to { transform: rotate(360deg); } }

.cx-parse-box {
  margin: 0 0 16px;
  border-radius: 13px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  overflow: hidden;
}
.cx-parse-box__head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 13px;
  border-bottom: 1px solid var(--c-border);
  font-size: .8rem; font-weight: 650;
}
.cx-parse-box__head i { color: var(--c-brand); }
.cx-parse-box__stats { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 9px 13px; font-size: .76rem; color: var(--c-text-2); }
.cx-parse-box__stats b { color: var(--c-text); }
.cx-warn-list { margin: 0; padding: 4px 13px 10px; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cx-warn-list li {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: .76rem; line-height: 1.45;
}
.cx-warn-list li i { margin-top: 2px; font-size: .72rem; flex: 0 0 auto; }
.cx-warn-list li.is-error { color: #b91c1c; }
.cx-warn-list li.is-warning { color: #b45309; }
.cx-warn-list li.is-info { color: var(--c-text-2); }
body.dark-theme .cx-warn-list li.is-error { color: #fca5a5; }
body.dark-theme .cx-warn-list li.is-warning { color: #fcd34d; }

.cx-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cx-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cx-field--wide { grid-column: 1 / -1; }
.cx-field label {
  font-size: .74rem; font-weight: 650; color: var(--c-text-2);
  display: flex; align-items: center; gap: 6px;
}
.cx-field label em { color: var(--c-danger); font-style: normal; }
.cx-field label .cx-req {
  font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--c-muted);
}
.cx-field input, .cx-field select, .cx-field textarea {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: .86rem;
  background: var(--c-surface);
  color: var(--c-text);
  min-width: 0;
}
.cx-field input:focus, .cx-field select:focus, .cx-field textarea:focus {
  outline: none; border-color: var(--c-brand); box-shadow: var(--c-ring);
}
.cx-field input.is-invalid, .cx-field textarea.is-invalid {
  border-color: var(--c-danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.cx-field__hint { font-size: .71rem; color: var(--c-muted); line-height: 1.4; }
.cx-field__hint.is-warning { color: #b45309; }
body.dark-theme .cx-field__hint.is-warning { color: #fcd34d; }
.cx-field textarea { resize: vertical; min-height: 92px; font-family: var(--c-font); }
.cx-field--people textarea { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.55; }

.cx-subhead {
  display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap;
  margin: 18px 0 9px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}
.cx-subhead h3 { margin: 0; font-size: .9rem; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.cx-subhead h3 i { color: var(--c-brand); }
.cx-subhead .cx-chip { font-size: .66rem; }

.cx-supervisor-row { display: flex; gap: 8px; margin-bottom: 7px; align-items: center; }
.cx-supervisor-row input { flex: 1 1 auto; }
.cx-supervisor-row input.cx-sup-phone { flex: 0 1 190px; }

.cx-form-error {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, .08);
  color: #b91c1c;
  font-size: .82rem;
  border: 1px solid rgba(220, 38, 38, .2);
}
.cx-form-error[hidden] { display: none; }
body.dark-theme .cx-form-error { color: #fca5a5; }

/* ---------------------------------------------- Список сборов (таблица) */
.collections-title-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.collections-title-area .cx-btn { padding: 10px 14px; }
.cx-filter-label {
  font-size: .78rem;
  font-weight: 650;
  color: var(--c-text-2);
  white-space: nowrap;
}
.collections-table { table-layout: fixed; }
.collections-table thead th { white-space: nowrap; }
.collections-table tbody td { vertical-align: middle; }
.coll-idx { width: 3.5%; }
.coll-period { width: 8.5%; }
.coll-period b { display: block; font-weight: 700; font-size: .84rem; line-height: 1.3; }
.coll-period span { display: block; font-size: .75rem; color: var(--c-muted); }
.coll-type { width: 7%; white-space: nowrap !important; }
.coll-status { width: 11.5%; white-space: normal !important; }
.coll-unit { width: 8.5%; }
.coll-unit b { display: block; font-weight: 650; }
.cx-sub { display: block; font-size: .72rem; color: var(--c-muted); margin-top: 1px; }
.coll-teacher { width: 10%; }
.coll-staff { width: 11.5%; white-space: normal !important; }
.coll-schools { width: 4.5%; }
.coll-plan { width: 4.5%; }
.coll-arrived { width: 6.5%; }
.coll-problems { width: 7.5%; }
.coll-progress-col { width: 7%; }
.coll-actions { width: 8%; }
.collections-table .edit-btn, .collections-table .delete-btn { width: 30px; height: 30px; }
.cx-status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.cx-next-hint {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 600; color: var(--c-muted);
  white-space: nowrap;
}
.cx-next-hint i { font-size: .6rem; color: var(--c-brand); }
.cx-problem-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .76rem; font-weight: 700; color: #b45309;
  background: rgba(217, 119, 6, .1);
  border-radius: 999px; padding: 2px 7px;
}
body.dark-theme .cx-problem-count { color: #fcd34d; background: rgba(251, 191, 36, .13); }
.cx-muted { color: var(--c-muted); }
.cx-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  overflow: hidden;
}
.cx-progress span { display: block; height: 100%; border-radius: inherit; background: var(--c-brand); transition: width .3s ease; }
.cx-progress.is-done span { background: var(--c-success); }
.cx-progress.is-mid span { background: #3b82f6; }
.cx-progress.is-low span { background: #f59e0b; }
.cx-progress-label { font-size: .68rem; color: var(--c-muted); font-weight: 650; margin-top: 3px; }

/* ----------------------------------------------------------- Гайд */
.cx-guide-list { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cx-guide-list li {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
}
.cx-guide-num {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  background: var(--c-brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .76rem; font-weight: 750;
}
.cx-guide-list b { font-size: .86rem; font-weight: 700; }
.cx-guide-list p { margin: 2px 0 0; font-size: .79rem; line-height: 1.5; color: var(--c-text-2); }

@media (max-width: 1100px) {
  .collections-table { min-width: 1080px; }
}

/* ------------------------------------------------------- Адаптивность */
@media (max-width: 1180px) {
  #schoolsModal .modal-content.cx-dialog { flex-direction: column !important; height: 92vh !important; }
  .cx-side { flex: 0 0 auto; max-height: 46%; border-left: none; border-top: 1px solid var(--c-border); }
  #peopleModal .modal-content.cx-people-dialog { flex-direction: column !important; height: 94vh !important; }
  .cx-people-side { flex: 0 0 auto; max-height: 38%; border-left: none; border-top: 1px solid var(--c-border); }
  #participantCardModal .modal-content.cx-card-dialog { flex-direction: column !important; height: 94vh !important; }
  .cx-card-side { flex: 0 0 auto; max-height: 36%; border-left: none; border-top: 1px solid var(--c-border); }
}

@media (max-width: 820px) {
  .cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 14px; }
  .cx-info-grid { grid-template-columns: 1fr; }
  .cx-form-grid { grid-template-columns: 1fr; }
  .cx-head { padding: 16px 16px 12px; }
  .cx-table-wrap { padding: 4px 8px 10px; }
  .cx-table { min-width: 640px; }
  .cx-people-list { padding: 4px 8px 10px; }
  .cx-people-table { min-width: 680px; }
  .cx-card-hero { padding: 16px 18px 12px; }
  .cx-card-body { padding: 14px 18px 18px; }
  .cx-card-actions { padding: 12px 18px 16px; }
  .cx-form-scroll { padding: 14px 16px 0; }
  .cx-form-foot { padding: 10px 16px; }
  .cx-side__head { padding: 12px 14px 8px; }
  .cx-next { margin: 4px 14px 12px; }
  .cx-side__scroll { padding: 0 14px 12px; }
  .cx-banner { margin: 10px 14px 0; }
  .cx-word-drop { flex-wrap: wrap; }
  .cx-word-drop__btn { width: 100%; }
  .cx-avatar { width: 48px; height: 48px; flex-basis: 48px; font-size: 1.1rem; }
  .cx-card-hero h2 { font-size: 1.2rem; }
  .cx-people-head { padding: 14px 16px 12px; }
  .cx-people-foot { padding: 10px 14px 12px; }
}

@media (max-width: 560px) {
  .cx-stats { grid-template-columns: 1fr 1fr; }
  .cx-stat { padding: 8px 9px; gap: 8px; }
  .cx-stat__icon { width: 32px; height: 32px; flex-basis: 32px; }
  .cx-stat__value { font-size: 1.02rem; }
  .cx-stat__label { font-size: .66rem; }
  .cx-head__title h2 { font-size: 1.05rem; }
  .cx-seg { width: 100%; }
  .cx-seg button { flex: 1; }
  .cx-people-toolbar { gap: 6px; }
  .cx-search { flex: 1 1 100%; }
  .cx-add-panel__row .cx-btn { flex: 1 1 100%; }
}

/* Карточка участника: вкладки и история участия */
.cx-card-tabs { display: flex; gap: 3px; padding: 0 18px; border-bottom: 1px solid var(--c-border); background: var(--c-surface); position: sticky; top: 0; z-index: 3; }
.cx-card-tabs button { border: none; background: transparent; color: var(--c-muted); font: inherit; font-size: .78rem; font-weight: 650; padding: 9px 10px; border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.cx-card-tabs button.is-active { color: var(--c-brand); border-bottom-color: var(--c-brand); }
.cx-tab-count { background: var(--c-surface-2); border-radius: 999px; padding: 1px 6px; font-size: .64rem; }
.cx-card-tabs button.is-active .cx-tab-count { background: var(--c-brand-soft); }
.cx-section-count { margin-left: 4px; color: var(--c-muted); font-size: .62rem; font-weight: 500; }
.cx-participation-list { display: flex; flex-direction: column; gap: 7px; margin-top: 7px; }
.cx-participation { border: 1px solid var(--c-border); border-radius: 10px; padding: 9px 11px; background: var(--c-surface); }
.cx-participation.is-current { border-color: color-mix(in srgb, var(--c-brand) 35%, var(--c-border)); background: color-mix(in srgb, var(--c-brand-soft) 45%, var(--c-surface)); }
.cx-participation__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cx-participation__head b { font-size: .82rem; }
.cx-participation__head > span { color: var(--c-muted); font-size: .7rem; }
.cx-badge-current { margin-left: 6px; font-size: .6rem; font-weight: 700; color: var(--c-brand); background: var(--c-brand-soft); border-radius: 999px; padding: 2px 6px; text-transform: uppercase; letter-spacing: .04em; }
.cx-participation__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; color: var(--c-text-2); font-size: .72rem; }
.cx-participation__meta i { color: var(--c-muted); margin-right: 3px; font-size: .66rem; }
.cx-participation__scores { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; color: var(--c-muted); font-size: .68rem; }
.cx-participation__scores b { color: var(--c-text); }

/* Сворачиваемая подсказка «Следующий шаг» */
.cx-side__tools { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.cx-side__tools .cx-icon-btn { width: 27px; height: 27px; font-size: .68rem; }
.cx-next-collapsed {
  display: none; align-items: center; gap: 6px; margin: 4px 16px 12px;
  padding: 8px 10px; border: 1px dashed var(--c-border-strong); border-radius: 10px;
  background: transparent; color: var(--c-muted); font: inherit; font-size: .72rem;
  cursor: pointer; text-align: left;
}
.cx-next-collapsed i { color: var(--c-brand); }
.cx-next-collapsed span { margin-left: auto; color: var(--c-brand); font-weight: 700; }
.cx-next-collapsed:hover { background: var(--c-brand-soft); border-color: var(--c-brand); }
.cx-side.is-next-collapsed #nextStepHost { display: none; }
.cx-side.is-next-collapsed .cx-next-collapsed { display: flex; }
.cx-side.is-next-collapsed .cx-side__scroll { padding-top: 4px; }

/* --------------------------------------------------- Сотрудники на сборе */

.cx-btn--sm {
  padding: 6px 10px;
  font-size: .76rem;
  gap: 5px;
}

.cx-staff-panel {
  margin: 0 0 14px;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  background: var(--c-surface);
  overflow: hidden;
}

.cx-staff-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: linear-gradient(90deg, var(--c-brand-soft), transparent 72%);
  border-bottom: 1px solid var(--c-border);
}

.cx-staff-panel__title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cx-staff-panel__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--c-brand);
  color: #fff;
  font-size: .8rem;
}

.cx-staff-panel__title b { display: block; font-size: .82rem; color: var(--c-text); }
.cx-staff-panel__title small { display: block; margin-top: 1px; font-size: .7rem; color: var(--c-muted); }
.cx-staff-panel__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.cx-staff-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 11px 14px 13px;
}

.cx-staff-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface-2);
}

.cx-staff-person__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: var(--c-brand-soft);
  color: var(--c-brand);
  font-size: .68rem;
  font-weight: 800;
}

.cx-staff-person__main { flex: 1; min-width: 0; }
.cx-staff-person__main b {
  display: block;
  overflow: hidden;
  font-size: .77rem;
  color: var(--c-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-staff-person__main small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: .66rem;
  color: var(--c-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-staff-person__meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  text-align: right;
}

.cx-staff-person__role { font-size: .66rem; font-weight: 700; color: var(--c-text-2); }
.cx-staff-person__dates { font-size: .62rem; color: var(--c-muted); white-space: nowrap; }

.cx-staff-empty {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
}

.cx-staff-empty__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-size: .9rem;
}

.cx-staff-empty > div { flex: 1; min-width: 0; }
.cx-staff-empty b { display: block; font-size: .8rem; color: var(--c-text); }
.cx-staff-empty p { margin: 3px 0 0; font-size: .72rem; line-height: 1.45; color: var(--c-muted); }

@media (max-width: 820px) {
  .cx-staff-list { grid-template-columns: 1fr; }
  .cx-staff-empty { flex-wrap: wrap; }
  .cx-staff-empty .cx-btn { width: 100%; justify-content: center; }
  .cx-staff-person__meta { align-items: flex-start; text-align: left; }
  .cx-staff-person { align-items: flex-start; }
}

/* ------------------------------------------------ Сотрудники слева от таблицы */

.cx-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.cx-staff-side {
  flex: 0 0 262px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 12px 10px;
  background: var(--c-surface-2);
  border-right: 1px solid var(--c-border);
  overflow-y: auto;
}

.cx-staff-side[hidden] { display: none; }

.cx-staff-side__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--c-border);
}

.cx-staff-side__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--c-brand);
  color: #fff;
  font-size: .72rem;
}

.cx-staff-side__title { min-width: 0; }
.cx-staff-side__title b { display: block; font-size: .78rem; color: var(--c-text); }
.cx-staff-side__title small { display: block; margin-top: 1px; font-size: .64rem; color: var(--c-muted); overflow-wrap: anywhere; }
.cx-staff-side__title > span { display: block; margin-top: 2px; font-size: .63rem; font-weight: 650; color: var(--c-brand); }

.cx-staff-side__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.cx-staff-side__actions .cx-btn {
  padding: 6px 7px;
  font-size: .67rem;
  gap: 4px;
  min-width: 0;
}

.cx-staff-side__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.cx-staff-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--c-border);
  border-radius: 9px;
  background: var(--c-surface);
}

.cx-staff-row__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--c-brand-soft);
  color: var(--c-brand);
  font-size: .62rem;
  font-weight: 800;
}

.cx-staff-row__body { flex: 1; min-width: 0; }
.cx-staff-row__body b {
  display: block;
  overflow: hidden;
  font-size: .71rem;
  color: var(--c-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-staff-row__body small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: .6rem;
  color: var(--c-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-staff-row__meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.cx-staff-row__meta .cx-chip { padding: 1px 6px; font-size: .58rem; border-radius: 6px; }
.cx-staff-row__role { font-size: .6rem; font-weight: 700; color: var(--c-text-2); }
.cx-staff-row__dates { display: block; margin-top: 1px; font-size: .58rem; color: var(--c-muted); white-space: nowrap; }
.cx-staff-row__edit { width: 22px; height: 22px; flex: 0 0 22px; font-size: .62rem; }

.cx-staff-side__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  text-align: center;
}

.cx-staff-side__empty-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-size: .8rem;
}

.cx-staff-side__empty b { font-size: .72rem; color: var(--c-text); }
.cx-staff-side__empty p { margin: 0 0 3px; font-size: .64rem; line-height: 1.4; color: var(--c-muted); }

@media (max-width: 1180px) {
  .cx-staff-side { flex-basis: 226px; }
}

@media (max-width: 900px) {
  .cx-body { flex-direction: column; }
  .cx-staff-side {
    flex: 0 0 auto;
    max-height: 230px;
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
  }
  .cx-staff-side__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .cx-staff-side { max-height: 210px; }
  .cx-staff-side__list { grid-template-columns: 1fr; }
}
.cx-staff-side { flex-basis: 240px; }
#schoolsTable thead th,
#schoolsTable tbody td { padding-left: 8px; padding-right: 8px; }
@media (max-width: 1180px) { .cx-staff-side { flex-basis: 218px; } }
.cx-staff-side { flex-basis: 220px; }
#schoolsModal .cx-table-wrap { padding-left: 8px; padding-right: 8px; }
@media (max-width: 1180px) { .cx-staff-side { flex-basis: 200px; } }
#schoolsModal .cx-side { flex-basis: 320px; }
.cx-staff-side { flex-basis: 210px; }
#schoolsModal .cx-side { flex-basis: 336px; }
@media (max-width: 1150px) {
  .cx-body { flex-direction: column; }
  .cx-staff-side {
    flex: 0 0 auto;
    max-height: 205px;
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
  }
  .cx-staff-side__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Отдельная левая колонка сотрудников: на всю высоту окна сбора */
#schoolsModal .cx-staff-side {
  flex: 0 0 230px;
  max-height: none;
  border-right: 1px solid var(--c-border);
  border-bottom: 0;
}
#schoolsModal .cx-side { flex-basis: 336px; }

@media (max-width: 1400px) {
  #schoolsModal .cx-staff-side { flex-basis: 210px; }
  #schoolsModal .cx-side { flex-basis: 330px; }
}

@media (max-width: 1200px) {
  #schoolsModal .cx-staff-side { flex-basis: 190px; }
  #schoolsModal .cx-side { flex-basis: 310px; }
}

@media (max-width: 937px) {
  #schoolsModal .cx-staff-side {
    flex: 0 0 auto;
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
  }
  .cx-staff-side__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .cx-staff-side__list { grid-template-columns: 1fr; }
}
@media (min-width: 938px) and (max-width: 1200px) {
  .cx-staff-side__list { display: flex; grid-template-columns: none; }
}

/* --------------------------------------------------- Наши сотрудники в сборах */
.coll-staff-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.coll-staff-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .73rem;
  font-weight: 700;
  color: var(--c-brand);
}
.coll-staff-count i { font-size: .64rem; }
.coll-staff-names {
  overflow: hidden;
  color: var(--c-text-2);
  font-size: .7rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coll-staff-empty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(217, 119, 6, .1);
  color: #b45309;
  font-size: .68rem;
  font-weight: 600;
  white-space: nowrap;
}
body.dark-theme .coll-staff-empty { color: #fcd34d; background: rgba(251, 191, 36, .13); }
.collections-table td:nth-child(6),
.collections-table td:nth-child(7) { min-width: 105px; }
.coll-staff-names {
  display: -webkit-box;
  overflow: hidden;
  color: var(--c-text-2);
  font-size: .7rem;
  line-height: 1.25;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.coll-staff-warn { color: #d97706 !important; font-size: .62rem !important; }
.cx-staff-side__alert {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid rgba(217, 119, 6, .28);
  border-radius: 8px;
  background: rgba(217, 119, 6, .08);
  color: #b45309;
  font-size: .65rem;
  font-weight: 600;
  line-height: 1.35;
}
.cx-staff-side__alert i { margin-top: 2px; font-size: .62rem; }
body.dark-theme .cx-staff-side__alert { color: #fcd34d; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .25); }

/* Кнопка скачивания Word-списка школы в таблице сбора */
.cx-icon-btn--word { color: #1d6f42; }
.cx-icon-btn--word:hover { background: rgba(29, 111, 66, .1); color: #14532d; border-color: rgba(29, 111, 66, .25); }

/* Адрес убытия в таблице школ сбора */
.cx-address-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text-2);
  font-size: .8rem;
}

/* Перемещение школы между сборами */
.cx-move-dialog { max-width: 560px; }
.cx-move-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid rgba(217, 119, 6, .25);
  border-radius: 12px;
  background: rgba(245, 158, 11, .08);
  color: var(--c-text-2);
  font-size: .82rem;
  line-height: 1.45;
}
.cx-move-note > i { color: #b45309; margin-top: 2px; }
.cx-move-note b { display: block; color: var(--c-text); margin-bottom: 2px; }
.cx-move-note span { display: block; }

/* Таблица школ в сборе: фиксированные колонки и всегда видимые действия */
#schoolsTable { table-layout: fixed; min-width: 760px; }
#schoolsTable th, #schoolsTable td { padding-left: 6px; padding-right: 6px; }
#schoolsTable td.cx-address-cell { max-width: none; }
.cx-num-sep { color: var(--c-muted); font-weight: 500; }
#schoolsTable th:last-child,
#schoolsTable td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--c-surface, #fff);
  box-shadow: -8px 0 12px -14px rgba(15, 23, 42, .5);
}
#schoolsTable th:last-child { z-index: 3; }
#schoolsTable tr:hover td:last-child { background: var(--c-brand-soft, #eff4ff); }
#schoolsTable tr.has-problems td:last-child { background: #fffaf0; }
body.dark-theme #schoolsTable th:last-child,
body.dark-theme #schoolsTable td:last-child { background: var(--c-surface, #1e293b); }
.schools-actions-cell { white-space: nowrap; text-align: right; }
.schools-actions-cell .cx-icon-btn {
  width: 26px; height: 26px; margin-left: 2px; vertical-align: middle;
}
.schools-actions__sep {
  display: inline-block; width: 1px; height: 18px; margin: 0 4px;
  background: var(--c-border); vertical-align: middle;
}
.cx-icon-btn--doc-ready { color: #047857; background: rgba(5, 150, 105, .09); border-color: rgba(5, 150, 105, .22); }
.cx-icon-btn--doc-ready:hover { background: rgba(5, 150, 105, .15); color: #065f46; }
.cx-icon-btn--doc-missing { color: var(--c-muted); opacity: .55; cursor: not-allowed; }
