:root {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-hover: #5a9dff;
  --danger: #e85d5d;
  --success: #3dd68c;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
  --body-gradient-spot: #1e3a5f;
  --control-faint: rgba(255, 255, 255, 0.04);
  --control-faint-hover: rgba(255, 255, 255, 0.06);
  --control-faint-strong: rgba(255, 255, 255, 0.1);
  --inset-bg: rgba(0, 0, 0, 0.12);
  --success-msg-fg: #9eecc4;
  --error-msg-fg: #ffb4b4;
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-popover: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-scope-popover: 0 12px 40px rgba(0, 0, 0, 0.35);
  --dashboard-fs-badge-bg: rgba(15, 23, 42, 0.92);
  --dashboard-fs-badge-border: rgba(148, 163, 184, 0.35);
  --dashboard-fs-badge-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  --badge-supervisor-fg: #e8c96b;
}

/* Светлая тема: сталь — графитовый текст, холодные серо-голубые плоскости. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #e4e9ef;
  --surface: #f2f5f9;
  --border: #b9c4d4;
  --text: #1a1f28;
  --muted: #5a6474;
  --accent: #3d5a80;
  --accent-hover: #2f4763;
  --danger: #b91c1c;
  --success: #2a6b45;
  --body-gradient-spot: #a8bdd4;
  --control-faint: rgba(26, 31, 40, 0.055);
  --control-faint-hover: rgba(26, 31, 40, 0.085);
  --control-faint-strong: rgba(26, 31, 40, 0.12);
  --inset-bg: rgba(26, 31, 40, 0.055);
  --success-msg-fg: #1a4d30;
  --error-msg-fg: #991b1b;
  --shadow-card: 0 8px 28px rgba(26, 36, 52, 0.1);
  --shadow-popover: 0 8px 24px rgba(26, 36, 52, 0.11);
  --shadow-scope-popover: 0 12px 32px rgba(26, 36, 52, 0.12);
  --dashboard-fs-badge-bg: rgba(242, 245, 249, 0.98);
  --dashboard-fs-badge-border: rgba(26, 31, 40, 0.12);
  --dashboard-fs-badge-shadow: 0 2px 12px rgba(26, 36, 52, 0.09);
  --badge-supervisor-fg: #5c4d2e;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, var(--body-gradient-spot) 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

body.app-logged-in {
  padding-top: 3.05rem;
  padding-bottom: 1rem;
}

.app-shell {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0.65rem 1.35rem 2.75rem 1.35rem;
  min-height: calc(100vh - 3.05rem - 1rem);
  box-sizing: border-box;
}

.sidebar-tab {
  display: inline-block;
  width: auto;
  text-align: center;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--control-faint);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.sidebar-tab:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--control-faint-hover);
}

.sidebar-tab.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.app-main {
  width: 100%;
  min-width: 0;
}

.tab-panel.hidden {
  display: none !important;
}

.admin-cabinet-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

/* Подвкладки первого уровня — справа (ЛК, список проектов, карточка проекта). */
.admin-cabinet-subnav--align-end {
  justify-content: flex-end;
}

.admin-subtab,
.admin-lk-subtab,
.admin-project-detail-tab {
  display: inline-block;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--control-faint);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.admin-subtab:hover,
.admin-lk-subtab:hover,
.admin-project-detail-tab:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--control-faint-hover);
}

.admin-subtab.is-active,
.admin-lk-subtab.is-active,
.admin-project-detail-tab.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

@media (max-width: 720px) {
  .app-shell {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .session-exit-bar {
    justify-content: center;
  }

  .session-exit-nav {
    justify-content: center;
    width: 100%;
  }

  .session-exit-user-actions {
    width: 100%;
    justify-content: center;
  }

  .sidebar-tab {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
}

.session-exit {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 0.4rem 0.95rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.session-exit-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  max-width: 100%;
  pointer-events: auto;
}

.session-exit-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.session-exit-user-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
  margin: 0;
  max-height: 90vh;
  overflow: auto;
}

.modal-dialog-wide {
  max-width: 520px;
}

/* Окно «Новый проект»: ~в 3 раза шире прежнего (520px → 1560px), как основная область «СВ и Менеджеры» */
.modal-dialog-create-project {
  max-width: min(96vw, 1560px);
  width: 100%;
}

.modal-dialog-staff-employee {
  max-width: min(96vw, 768px);
  width: 100%;
}

.staff-employee-form-subheading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--muted);
}

.create-project-table-scroll {
  max-height: min(42vh, 20rem);
  overflow: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.create-project-table-scroll table {
  margin: 0;
}

.create-project-table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  box-shadow: 0 1px 0 var(--border);
}

th.create-project-col-check {
  width: 2.75rem;
}

/* Кнопка «Создать проект» на вкладке «Проекты»: компактная, справа (scale 0,64) */
.admin-projects-list-subnav {
  margin-top: 0.35rem;
}

.admin-projects-subpanel {
  margin-top: 0.25rem;
}

/* Вкладка «Проекты»: заголовок и кнопка — соседи в .header-row; сабнави справа */
.admin-projects-list-header-row {
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem 1rem;
}

.admin-projects-list-header-row .section-title {
  margin: 0;
}

.admin-projects-list-header-row .admin-projects-list-subnav {
  margin-left: auto;
}

.admin-projects-create-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 10px;
  line-height: 1;
  font-weight: 800;
  border: 1px solid color-mix(in srgb, var(--success) 50%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.admin-projects-create-btn:hover {
  background: color-mix(in srgb, var(--success) 26%, transparent);
  border-color: color-mix(in srgb, var(--success) 65%, var(--border));
  color: var(--success);
}

.admin-projects-create-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--success) 70%, var(--border));
  outline-offset: 2px;
}

/* .btn.btn-primary.btn-create-project-micro — больше не используется */

.admin-profiles-compact-toolbar {
  margin: 0 0 0.75rem;
}

.admin-projects-table {
  margin-top: 0.75rem;
}

.employee-projects-table {
  margin-top: 0.35rem;
}

.admin-projects-table th,
.admin-projects-table td {
  padding: 0.45rem 0.55rem;
}

.admin-projects-table td:last-child {
  text-align: center;
  vertical-align: middle;
  width: 3.25rem;
}

.admin-projects-table thead th:last-child {
  width: 3.25rem;
}

.admin-project-list-payout-delta {
  font-weight: 500;
  white-space: nowrap;
}

.admin-project-list-payout-delta--up {
  color: var(--success);
}

.admin-project-list-payout-delta--down {
  color: var(--danger);
}

.admin-project-list-payout-delta--flat {
  color: var(--muted);
}

.admin-project-row {
  cursor: pointer;
}

.admin-project-staff-row {
  cursor: pointer;
}

.admin-project-staff-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

.admin-project-staff-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* МК: бейдж в шапке таблицы исполнителей; в сверках — справа от ФИО */
.admin-project-staff-mk-badge,
.recon-emp-mk-text-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.06rem 0.32rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  vertical-align: middle;
  color: #d4a0a8;
  background: rgba(200, 90, 105, 0.16);
  border: 1px solid rgba(200, 90, 105, 0.32);
  border-radius: 4px;
  flex-shrink: 0;
}

.admin-project-staff-mk-badge--th-summary {
  margin-left: 0;
  align-self: center;
}

.admin-project-staff-fio-th-mk-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  opacity: 0.92;
}

.admin-project-staff-fio-th-mk-summary .admin-project-staff-fio-th-indicator-value {
  margin-left: 0;
}

/* Давность последней смены по сверкам: точка справа от ФИО (зелёный / жёлтый / синий / красный) */
.admin-project-staff-payout-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 0.28rem;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  vertical-align: middle;
}

.admin-project-staff-payout-dot--last {
  background: #34c759;
  box-shadow: 0 0 7px rgba(52, 199, 89, 0.95), 0 0 2px rgba(52, 199, 89, 0.5);
}

.admin-project-staff-payout-dot--penultimate {
  background: #e6c82a;
  box-shadow: 0 0 7px rgba(230, 200, 42, 0.9), 0 0 2px rgba(230, 200, 42, 0.45);
}

.admin-project-staff-payout-dot--never {
  background: #0a84ff;
  box-shadow: 0 0 7px rgba(10, 132, 255, 0.9), 0 0 2px rgba(10, 132, 255, 0.45);
}

.admin-project-staff-payout-dot--absent {
  background: #ff453a;
  box-shadow: 0 0 7px rgba(255, 69, 58, 0.85), 0 0 2px rgba(255, 69, 58, 0.45);
}

.admin-project-staff-fio-th-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
  max-width: 100%;
  margin-left: 0.55rem;
}

.admin-project-staff-fio-label-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  text-align: inherit;
  border-radius: 4px;
  line-height: inherit;
}

.admin-project-staff-fio-label-btn:hover {
  color: var(--accent);
}

.admin-project-staff-fio-label-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-project-staff-fio-label-btn.is-active {
  font-weight: 700;
}

.admin-project-staff-fio-th-indicators {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: 1cm;
  line-height: 1;
  font-weight: 600;
  font-size: calc(0.75rem * 1.3);
  opacity: 0.92;
}

.admin-project-staff-fio-th-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

button.admin-project-staff-fio-th-indicator {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  line-height: inherit;
  opacity: 0.92;
}

button.admin-project-staff-fio-th-indicator:hover {
  opacity: 1;
}

button.admin-project-staff-fio-th-indicator:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.admin-project-staff-fio-th-indicator.is-active {
  opacity: 1;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}

.admin-project-staff-fio-th-indicator .admin-project-staff-payout-dot {
  margin-left: 0;
}

.admin-project-staff-fio-th-indicator-value {
  min-width: calc(1.2rem * 1.3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-project-staff-fio-th-indicator-kill {
  margin: 0;
  padding: 0 0.3rem;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1.1;
  opacity: 0.92;
}

.admin-project-staff-fio-th-indicator-kill:hover {
  opacity: 1;
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

.admin-project-staff-fio-th-indicator-kill:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.admin-project-staff-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.admin-project-staff-sort-btn:hover {
  color: var(--accent);
}

.admin-project-staff-sort-btn.is-active {
  color: var(--accent);
}

.admin-project-staff-table-wrap.admin-project-staff--col-supervisor-hidden .admin-projects-table th:nth-child(3),
.admin-project-staff-table-wrap.admin-project-staff--col-supervisor-hidden .admin-projects-table td:nth-child(3),
.admin-project-staff-table-wrap.admin-project-staff--col-manager-hidden .admin-projects-table th:nth-child(4),
.admin-project-staff-table-wrap.admin-project-staff--col-manager-hidden .admin-projects-table td:nth-child(4) {
  display: none;
}

.admin-project-staff-table-wrap .admin-project-staff-sort-btn[aria-pressed="true"] {
  opacity: 0.6;
}

.admin-project-staff-sort-ind {
  font-size: 0.75rem;
  opacity: 0.85;
}

.admin-project-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

.admin-project-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.admin-project-row--inactive {
  opacity: 0.92;
}

/* Вкладки справа в одной строке с блоком заголовка, по нижнему краю с названием проекта */
.admin-project-detail-header.header-row {
  align-items: flex-end;
  margin-bottom: 1rem;
}

.admin-project-detail-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Кнопки дашборда в шапке проекта: один размер с «глазом» (26×26), стиль сохранения как у карточки исполнителя */
.admin-project-detail-title-row .admin-project-dashboard-save-btn.admin-project-staff-tool-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  max-width: none;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 0;
  border-radius: 10px;
}

.admin-project-detail-title-row .admin-project-dashboard-save-btn .admin-project-staff-tool-btn__icon svg {
  width: 16px;
  height: 16px;
}

.admin-dashboard-saved-list-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.admin-dashboard-saved-list-btn__icon svg {
  display: block;
}

.admin-project-detail-header .admin-project-detail-tabs {
  flex: 0 0 auto;
  margin-bottom: 0;
  align-self: flex-end;
}

.admin-project-detail-header-main {
  flex: 1 1 12rem;
  min-width: 0;
}

.admin-project-dashboard-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: flex-end;
  align-items: stretch;
  flex: 0 1 auto;
  max-width: 100%;
}

.admin-project-dashboard-kpi-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 720px) {
  .admin-project-dashboard-kpi-bar {
    grid-template-columns: 1fr;
  }
}

.admin-project-dashboard-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem 0.5rem;
  min-width: 6.75rem;
  text-align: right;
  border-left-width: 3px;
}

.admin-project-dashboard-kpi--staff {
  border-left-color: #5a9dff;
}

.admin-project-dashboard-kpi--output {
  border-left-color: #3dd68c;
}

.admin-project-dashboard-kpi--salary {
  border-left-color: #c9a227;
}

.admin-project-dashboard-kpi-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.admin-project-dashboard-kpi-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

button.admin-project-dashboard-kpi {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

button.admin-project-dashboard-kpi:hover {
  filter: brightness(1.06);
  border-color: color-mix(in srgb, var(--border) 70%, var(--text));
}

button.admin-project-dashboard-kpi:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.admin-project-dashboard-kpi[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #5a9dff 45%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, #5a9dff 12%);
}

.admin-project-detail-title-line {
  margin-top: 0.25rem;
}

.admin-project-placeholder {
  margin: 0.75rem 0 0;
  padding: 1rem 0;
}

.admin-project-staff-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1.75rem;
  margin-bottom: 0.35rem;
}

.admin-project-staff-toolbar-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1.1rem;
  flex: 0 0 auto;
}

.admin-project-staff-import-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.56rem;
  min-width: 0;
}

/* Компактные кнопки действий в тулбаре персонала: иконки в один ряд */
.admin-project-staff-import-actions > .btn.btn-ghost {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin-top: 0;
}

.admin-project-staff-import-actions .admin-project-staff-tool-btn.btn-small {
  padding: 0.12rem 0.36rem;
  font-size: 0.65rem;
}

.admin-project-staff-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.24rem;
  height: 3.24rem;
  padding: 0.16rem 0.44rem;
  line-height: 1;
}

.admin-project-staff-tool-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-project-staff-tool-btn__icon svg {
  display: block;
  width: 28px;
  height: 28px;
}

.admin-project-staff-tool-btn__label-api {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--muted);
}

.admin-project-staff-tool-btn:hover .admin-project-staff-tool-btn__label-api {
  color: var(--text);
}

/* Текстовая метка «JSON» (модалка экспорта / API), в духе кнопки «API» */
.admin-project-staff-tool-btn__label-json {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--muted);
  text-transform: uppercase;
}

.admin-project-staff-tool-btn:hover .admin-project-staff-tool-btn__label-json {
  color: var(--text);
}

.admin-project-staff-search-field {
  flex: 1 1 18rem;
  display: flex;
  flex-direction: column;
  min-width: min(100%, 14rem);
}

/* Отступ от укрупнённых кнопок тулбара, чтобы поле поиска не наезжало */
#admin-project-staff-list-block .admin-project-staff-toolbar > .admin-project-staff-search-field {
  margin-left: 1.25rem;
}

.admin-project-staff-search-label {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.3;
}

.admin-project-staff-search-input {
  max-width: none;
  width: 100%;
  margin-bottom: 0;
}

.admin-project-staff-import-feedback:not(.hidden) {
  margin: 0.35rem 0 0.2rem;
  line-height: 1.4;
  white-space: pre-line;
}

/* Список исполнителей: не меньше ~15 видимых строк тела таблицы + шапка; шире обычного create-project-table-scroll */
.admin-project-staff-table-wrap.create-project-table-scroll {
  --admin-staff-thead: 2.875rem;
  --admin-staff-row: 2.4375rem;
  min-height: calc(var(--admin-staff-thead) + 15 * var(--admin-staff-row));
  max-height: min(78vh, 56rem);
  margin-top: 0.35rem;
  margin-bottom: 0.65rem;
}

.admin-project-staff-table-wrap.create-project-table-scroll .admin-projects-table {
  margin-top: 0;
}

.admin-project-staff-phone-th-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.admin-project-staff-phone-th-title {
  font-weight: 600;
}

.admin-project-staff-show-hidden-cols-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.admin-project-staff-show-hidden-cols-btn:hover {
  text-decoration: underline;
}

/* Сверки: скрытие колонок СВ / менеджер (основная таблица и «пропавшие смены») */
#admin-project-recon-panel.admin-project-recon--col-supervisor-hidden .admin-projects-table th:nth-child(3),
#admin-project-recon-panel.admin-project-recon--col-supervisor-hidden .admin-projects-table td:nth-child(3),
#admin-project-recon-panel.admin-project-recon--col-manager-hidden .admin-projects-table th:nth-child(4),
#admin-project-recon-panel.admin-project-recon--col-manager-hidden .admin-projects-table td:nth-child(4) {
  display: none;
}

#admin-project-recon-panel .admin-project-staff-sort-btn[data-recon-col-toggle][aria-pressed="true"] {
  opacity: 0.6;
}

/* Исполнители проекта: колонка «Статус API» — компактная, по центру (точка + копирование) */
.admin-project-staff-table-wrap .admin-projects-table td.admin-project-staff-main-api-status-cell,
.admin-project-staff-table-wrap .admin-projects-table thead th.admin-project-staff-main-api-status-th {
  text-align: center;
  width: 3.25rem;
  min-width: 3rem;
  vertical-align: middle;
  box-sizing: border-box;
}

.admin-project-staff-table-wrap .admin-projects-table thead th.admin-project-staff-main-api-status-th {
  font-weight: 600;
}

.modal-dialog-staff-import {
  max-width: 36rem;
}

.modal-dialog-staff-export {
  max-width: min(97vw, 58rem);
  width: 100%;
}

/* Экспорт / API: заголовок и компактные кнопки в одну строку (как тулбар персонала) */
.admin-project-staff-export-modal-head.header-row {
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  flex-wrap: nowrap;
}

.admin-project-staff-export-modal-head .admin-project-staff-export-modal-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.admin-project-staff-export-modal-head .admin-project-staff-export-modal-actions {
  flex-shrink: 0;
  margin-left: 0.35rem;
}

.admin-project-staff-export-modal-tool.admin-project-staff-tool-btn {
  margin-top: 0;
  width: auto;
  max-width: none;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0.1rem 0.28rem;
}

.admin-project-staff-export-modal-tool .admin-project-staff-tool-btn__icon svg {
  width: 22px;
  height: 22px;
}

#btn-admin-project-staff-export-copy-json.admin-project-staff-export-modal-tool {
  min-width: 3rem;
}

.modal-dialog-staff-export .btn-primary.admin-project-staff-export-modal-confirm,
.modal-dialog-recon-payout-detail-builder .btn-primary.admin-project-staff-export-modal-confirm {
  width: auto;
  border: none;
  color: #fff;
}

.modal-dialog-staff-export .btn-primary.admin-project-staff-export-modal-confirm:hover,
.modal-dialog-recon-payout-detail-builder .btn-primary.admin-project-staff-export-modal-confirm:hover {
  color: #fff;
}

.admin-project-staff-export-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1.25rem;
  margin-bottom: 0.4rem;
}

.admin-project-staff-export-search-field {
  flex: 1 1 14rem;
  display: flex;
  flex-direction: column;
  min-width: min(100%, 12rem);
}

.admin-project-staff-export-search-input {
  max-width: none;
  margin-bottom: 0;
}

.admin-project-staff-export-select-all-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.admin-project-staff-export-select-all-wrap input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

/* Колонки: чекбокс | ФИО (гибко) | телефон | дата создания | статус API */
.admin-project-staff-export-list {
  --export-cols: 2.1rem minmax(10rem, 1fr) minmax(10.5rem, 12.5rem) minmax(11rem, 14rem) 3.1rem;
  display: flex;
  flex-direction: column;
  max-height: min(68vh, 42rem);
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-project-staff-export-head {
  display: grid;
  grid-template-columns: var(--export-cols);
  align-items: center;
  column-gap: 0.65rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 88%, var(--border));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-project-staff-export-head-spacer {
  display: block;
}

.admin-project-staff-export-list-body {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.admin-project-staff-export-list-body--empty {
  padding: 1rem 0.85rem;
}

.admin-project-staff-export-list-body--empty p {
  margin: 0;
}

.admin-project-staff-export-row {
  display: grid;
  grid-template-columns: var(--export-cols);
  align-items: center;
  column-gap: 0.65rem;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
}

.admin-project-staff-export-row input[type="checkbox"] {
  justify-self: start;
  align-self: center;
  margin: 0;
  flex-shrink: 0;
}

.admin-project-staff-export-row:last-child {
  border-bottom: 0;
}

.admin-project-staff-export-row:hover {
  background: rgba(61, 139, 253, 0.06);
}

.admin-project-staff-export-row.hidden {
  display: none !important;
}

.admin-project-staff-export-name {
  font-weight: 500;
  line-height: 1.35;
  min-width: 0;
  word-break: break-word;
}

.admin-project-staff-export-phone,
.admin-project-staff-export-created {
  font-size: 0.875rem;
  color: var(--muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-project-staff-export-created {
  font-variant-numeric: tabular-nums;
}

.admin-project-staff-export-api-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  min-width: 2rem;
  min-height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.admin-project-staff-export-api-status:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--border));
}

.admin-project-staff-export-api-status:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-project-staff-api-status-dot {
  display: block;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-project-staff-api-status-dot--neutral {
  background: color-mix(in srgb, var(--muted) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 80%, transparent);
}

.admin-project-staff-api-status-dot--ok {
  background: var(--success, #3dd68c);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success, #3dd68c) 40%, var(--border));
}

.admin-project-staff-api-status-dot--err {
  background: var(--danger, #e85d5d);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger, #e85d5d) 35%, var(--border));
}

.staff-import-modal-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.staff-import-modal-options label.staff-import-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

.staff-import-modal-options input[type="checkbox"] {
  margin: 0.2rem 0 0;
  width: auto;
}

.staff-import-preview-row {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.staff-import-preview-row:last-child {
  border-bottom: none;
}

.admin-project-staff-detail-back {
  margin-bottom: 0;
}

.admin-project-staff-detail-title {
  margin-top: 0.25rem;
}

.admin-project-staff-detail-head.header-row {
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.admin-project-staff-detail-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.35rem;
}

.admin-project-staff-detail-head-actions-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-left: auto;
}

/* Поле «Битрикс ссылка» в шапке между «Сохранить» и «Уволить» */
.admin-project-staff-bitrix-url-toolbar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 22rem;
}

.admin-project-staff-bitrix-url-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
  white-space: nowrap;
}

.admin-project-staff-bitrix-url-toolbar input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.35rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1.25;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
}

.admin-project-staff-detail-head .admin-project-staff-detail-title {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.admin-detail-head-row {
  align-items: center;
  margin-bottom: 0.5rem;
}

.admin-detail-ellipsis.btn-ghost {
  width: auto;
  margin-top: 0;
  padding: 0.15rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: 10px;
}

.admin-detail-ellipsis.btn-ghost.btn-small {
  padding: 0.1rem 0.45rem;
  font-size: 0.9rem;
}

.admin-project-staff-detail-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  align-items: center;
}

/* Панель «Фото и файлы»: одна строка — заголовок, назад, загрузка (рядом) */
.admin-project-staff-media-panel-head.header-row {
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem 1rem;
}

.admin-project-staff-media-head-start {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: wrap;
}

/* Перебить .section-title { margin: 1.5rem … } ниже по файлу */
.admin-project-staff-media-head-start .admin-project-staff-media-panel-title.section-title {
  margin: 0;
  line-height: 1.3;
}

/* Как у #admin-project-staff-detail-back: не растягивать .btn-ghost { width: 100% } на всю строку */
.admin-project-staff-media-head-start #admin-project-staff-media-panel-back,
.admin-project-staff-media-head-start #admin-project-staff-media-add-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  align-self: center;
  width: auto;
  max-width: none;
  margin-top: 0;
}

.staff-media-formats-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.staff-media-add-wrap {
  position: relative;
  display: inline-block;
}

.staff-media-kind-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: auto;
  top: calc(100% + 4px);
  min-width: min(100vw - 2rem, 20rem);
  max-height: min(70vh, 22rem);
  overflow-y: auto;
  padding: 0.25rem;
  margin: 0;
  list-style: none;
  /* Непрозрачный фон (раньше был несуществующий --card-bg). */
  background-color: var(--surface);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-popover, 0 8px 28px rgba(0, 0, 0, 0.35));
}

.staff-media-kind-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.6rem;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.staff-media-kind-item:hover,
.staff-media-kind-item:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  outline: none;
}

.staff-media-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.staff-media-group {
  margin: 0;
}

.staff-media-group-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.staff-media-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.staff-media-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
}

.staff-media-row-main {
  flex: 1;
  min-width: 0;
}

.staff-media-row-name {
  font-weight: 500;
  word-break: break-word;
}

.staff-media-row-name--open {
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: left;
}

.staff-media-row-name--open:hover {
  color: var(--accent-hover);
}

.staff-media-row-name--open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.staff-media-row-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.staff-media-row-actions {
  display: inline-flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.staff-detail-deactivate-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.staff-detail-deactivate-btn {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.staff-detail-deactivate-btn:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

/* Иконка «Отключить» в шапке карточки исполнителя */
.admin-project-staff-tool-btn--danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.admin-project-staff-tool-btn--danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.admin-project-staff-tool-btn__label {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.staff-detail-edit-form {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  background: var(--inset-bg);
}

.staff-detail-card {
  margin-top: 0.75rem;
}

.staff-detail-subheading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
}

.staff-detail-subheading:first-of-type {
  margin-top: 0;
}

.staff-detail-subheading-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.staff-detail-subheading--row {
  margin: 1.25rem 0 0.5rem;
}

.staff-payout-period-select {
  flex: 0 1 auto;
  min-width: 13.5rem;
  max-width: min(100%, 18rem);
  width: auto;
}

.staff-detail-subheading-row--payout-header {
  align-items: center;
}

.staff-payout-summary-metrics--header {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.staff-payout-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--inset-bg);
}

.staff-payout-summary-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.staff-payout-summary-metrics {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-variant-numeric: tabular-nums;
}

.staff-payout-summary--totals {
  margin-top: 0.65rem;
}

.staff-payout-summary-hint {
  display: block;
  width: 100%;
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.15rem;
}

.staff-detail-dl {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.staff-detail-dl-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 32%) 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.75rem;
  margin: 0;
  background: var(--surface);
  align-items: baseline;
}

.staff-detail-dl-row:last-child:nth-child(odd):not(:only-child) {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .staff-detail-dl {
    grid-template-columns: 1fr;
  }

  .staff-detail-dl-row:last-child:nth-child(odd):not(:only-child) {
    grid-column: auto;
  }
}

.staff-detail-dl dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.staff-detail-dl dd {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
}

.staff-detail-future {
  margin: 0 0 1rem;
  padding: 0.75rem 0;
  line-height: 1.45;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.btn-logout-subtle {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.38;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-logout-subtle:hover {
  opacity: 0.85;
  color: var(--text);
  background: var(--control-faint);
}

.btn-theme-toggle {
  min-width: 2.85rem;
  text-align: center;
}

.btn-logout-subtle:focus-visible {
  opacity: 1;
  outline: 1px solid var(--border);
  outline-offset: 2px;
}

a {
  color: var(--accent);
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.wide {
  max-width: 720px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.muted {
  color: var(--muted);
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

.hint-corner-actions {
  font-size: 0.82rem;
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
  opacity: 0.92;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.admin-profile-search-input {
  max-width: 32rem;
}

.admin-profile-search-feedback {
  margin: -0.5rem 0 1rem;
  max-width: 36rem;
  line-height: 1.45;
}

.admin-profile-search-feedback:not(.error) {
  color: var(--muted);
}

.admin-profile-search-results {
  margin-bottom: 1.35rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.admin-profile-results-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.85rem;
  color: var(--text);
}

.admin-profile-results-subtitle {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 1rem 0 0.45rem;
  color: var(--text);
}

.admin-profile-results-subtitle:first-of-type {
  margin-top: 0;
}

.admin-profile-result-intro {
  margin: 0 0 0.75rem !important;
  font-size: 0.9rem;
}

.admin-profile-results-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.35rem;
}

table.admin-profile-results-table {
  width: 100%;
  font-size: 0.88rem;
  margin-bottom: 0;
}

table.admin-profile-results-table th,
table.admin-profile-results-table td {
  padding: 0.45rem 0.55rem;
}

table.admin-profile-results-table tbody tr[role="button"] {
  cursor: pointer;
}

table.admin-profile-results-table tbody tr[role="button"]:hover {
  background: rgba(61, 139, 253, 0.08);
}

/* Кнопка «…» в строках таблиц: без раскрытия в таблице — меню всплывает у курсора */
.row-actions-cell {
  text-align: center;
  vertical-align: middle;
  padding: 0.35rem 0.45rem;
}

.row-actions-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--control-faint);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.row-actions-trigger:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--control-faint-hover);
}

.row-actions-popover {
  position: fixed;
  z-index: 360;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  max-width: none;
  pointer-events: none;
}

.row-actions-popover:not(.hidden) {
  pointer-events: auto;
}

.row-actions-popover-inner {
  margin: 0;
  padding: 0.65rem 0.75rem;
  min-width: 11rem;
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.row-actions-popover-inner .btn {
  width: 100%;
  justify-content: center;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 88px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 1rem;
  resize: vertical;
}

.success {
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid rgba(61, 214, 140, 0.35);
  color: var(--success-msg-fg);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-inline {
  width: auto;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  margin-top: 0.75rem;
  width: 100%;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* «Новый исполнитель»: компактная кнопка с зелёным «+» (ниже button,.btn — чтобы не перебивали padding) */
.admin-project-staff-toolbar-actions button.admin-project-staff-add-btn.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin-top: 0;
  min-width: 3.24rem;
  height: 3.24rem;
  padding: 0.12rem 0.4rem;
  line-height: 1;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--success) 50%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.admin-project-staff-toolbar-actions button.admin-project-staff-add-btn.btn:hover {
  background: color-mix(in srgb, var(--success) 26%, transparent);
  border-color: color-mix(in srgb, var(--success) 65%, var(--border));
  color: var(--success);
}

.admin-project-staff-toolbar-actions button.admin-project-staff-add-btn.btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--success) 70%, var(--border));
  outline-offset: 2px;
}

.admin-project-recon-toolbar button.admin-project-recon-upload-btn.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin-top: 0;
  min-width: 2.592rem;
  height: 2.592rem;
  padding: 0.1rem 0.32rem;
  line-height: 1;
  font-size: 0.64rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--success) 50%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.admin-project-recon-toolbar button.admin-project-recon-upload-btn .admin-project-staff-add-btn__plus {
  font-size: 1.88rem;
}

.admin-project-recon-toolbar button.admin-project-recon-upload-btn.btn:hover {
  background: color-mix(in srgb, var(--success) 26%, transparent);
  border-color: color-mix(in srgb, var(--success) 65%, var(--border));
  color: var(--success);
}

.admin-project-recon-toolbar button.admin-project-recon-upload-btn.btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--success) 70%, var(--border));
  outline-offset: 2px;
}

.admin-project-staff-add-btn__plus {
  display: block;
  font-size: 2.35rem;
  font-weight: 600;
  line-height: 1;
  margin-top: -0.05em;
}

.error {
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.35);
  color: var(--error-msg-fg);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(61, 139, 253, 0.2);
  color: var(--accent-hover);
}

.badge-employee {
  background: rgba(61, 214, 140, 0.15);
  color: var(--success);
}

.badge-supervisor {
  background: rgba(200, 170, 90, 0.2);
  color: var(--badge-supervisor-fg, #e8c96b);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
}

tr:last-child td {
  border-bottom: none;
}

.status-on {
  color: var(--success);
}

.status-off {
  color: var(--danger);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.section-title {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
}

.admin-sup-table tbody tr.sup-table-row {
  cursor: pointer;
}

.admin-sup-table tbody tr.sup-table-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

.sup-scope-popover,
.emp-scope-popover {
  position: fixed;
  z-index: 350;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  max-width: none;
}

.sup-scope-popover-inner,
.emp-scope-popover-inner {
  position: relative;
  min-width: 17rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 24rem);
  overflow: auto;
  padding: 0.85rem 2.25rem 1rem 1rem;
  box-shadow: var(--shadow-scope-popover);
}

.sup-scope-popover-x,
.emp-scope-popover-x {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 1;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  line-height: 1;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--control-faint-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.sup-scope-popover-x:hover,
.emp-scope-popover-x:hover {
  color: var(--text);
  background: var(--control-faint-strong);
}

.sup-scope-popover-title,
.emp-scope-popover-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
  padding-right: 0.5rem;
}

.sup-scope-section {
  margin-bottom: 0.85rem;
}

.sup-scope-section:last-child {
  margin-bottom: 0;
}

.sup-scope-heading {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.sup-scope-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
}

.sup-scope-empty {
  margin: 0;
  font-size: 0.88rem;
}

.sup-scope-loading,
.emp-scope-loading {
  margin: 0 0 0.5rem;
}

/* Заголовок «Супервайзеры» и кнопка на одной линии; блок выше на 1 см относительно прежнего .section-title */
.admin-sup-heading-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin-top: calc(1.5rem - 1cm);
  margin-bottom: 0.75rem;
}

.admin-sup-heading-line .admin-sup-section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Слот под scale: 0,62; размеры под фиксированную кнопку ниже */
.admin-create-sup-micro-slot--header {
  position: relative;
  flex: 0 0 auto;
  width: 7.5rem;
  height: 2.55rem;
  align-self: center;
}

/* Одна геометрия для «Создать СВ» и «Создать менеджера» (до scale) */
.btn.btn-primary.admin-create-sup-micro {
  position: absolute;
  right: 0;
  top: 50%;
  left: auto;
  transform: translateY(-50%) scale(0.62);
  transform-origin: center right;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.12;
  padding: 0.45rem 0.4rem;
  width: 10rem;
  min-height: 3.05rem;
  max-width: 10rem;
  white-space: normal;
  word-break: break-word;
}

.admin-create-sup-collapsible {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--inset-bg);
}

.admin-emp-heading-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.75rem;
}

.admin-emp-heading-line .admin-emp-section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.admin-create-emp-collapsible {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--inset-bg);
}

.admin-emp-table tbody tr.emp-table-row {
  cursor: pointer;
}

.admin-emp-table tbody tr.emp-table-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

/* Режим супервайзера: карточка проекта из админки, но с урезанным управлением. */
#admin-project-detail-view.project-detail--supervisor #btn-admin-project-recon-upload,
#admin-project-detail-view.project-detail--supervisor #admin-project-recon-file,
#admin-project-detail-view.project-detail--supervisor #btn-admin-project-recon-import-config,
#admin-project-detail-view.project-detail--supervisor #btn-admin-project-recon-delete,
#admin-project-detail-view.project-detail--supervisor #btn-admin-project-recon-payout,
#admin-project-detail-view.project-detail--supervisor #btn-admin-dashboard-save,
#admin-project-detail-view.project-detail--supervisor .admin-project-dashboard-actions,
#admin-project-detail-view.project-detail--supervisor .admin-project-recon-payout-slot,
#admin-project-detail-view.project-detail--supervisor .recon-vanished-remove-th,
#admin-project-detail-view.project-detail--supervisor .recon-vanished-actions-cell {
  display: none !important;
}

/* Режим менеджера: карточка проекта из админки, но с урезанным управлением (как у СВ). */
#admin-project-detail-view.project-detail--employee #btn-admin-project-recon-upload,
#admin-project-detail-view.project-detail--employee #admin-project-recon-file,
#admin-project-detail-view.project-detail--employee #btn-admin-project-recon-import-config,
#admin-project-detail-view.project-detail--employee #btn-admin-project-recon-delete,
#admin-project-detail-view.project-detail--employee #btn-admin-project-recon-payout,
#admin-project-detail-view.project-detail--employee #btn-admin-dashboard-save,
#admin-project-detail-view.project-detail--employee .admin-project-dashboard-actions,
#admin-project-detail-view.project-detail--employee .admin-project-recon-payout-slot,
#admin-project-detail-view.project-detail--employee .recon-vanished-remove-th,
#admin-project-detail-view.project-detail--employee .recon-vanished-actions-cell {
  display: none !important;
}

/* Карточка проекта: индикаторы-полоски (Исполнители, Сверки) */
#admin-project-detail-view {
  --recon-indicator-inactive: hsl(350 30% 56%);
  --recon-indicator-missing: hsl(34 36% 56%);
  --recon-indicator-duplicate: hsl(355 52% 42%);
}

/* Сверки: зарплата в таблице и в модалке */
#admin-project-detail-view,
#admin-project-recon-salary-modal {
  --recon-salary-down: hsl(352 32% 50%);
  --recon-salary-down-hover: hsl(352 36% 44%);
  --recon-salary-up: hsl(156 26% 42%);
  --recon-salary-up-hover: hsl(156 30% 36%);
  --recon-salary-violet: hsl(275 24% 52%);
}

.admin-project-recon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
}

.admin-project-recon-select-wrap {
  display: flex;
  flex: 1 1 16rem;
  align-items: flex-end;
  min-width: 0;
}

.admin-project-recon-view-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem 0.5rem;
  width: 100%;
  min-width: 0;
}

.admin-project-recon-month-select {
  flex: 0 0 auto;
  min-width: 11.5rem;
  max-width: min(100%, 14rem);
}

.admin-project-recon-select-slot {
  display: flex;
  align-items: center;
  flex: 1 1 12rem;
  min-width: 0;
  gap: 0.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.admin-project-recon-select-slot select {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: max(10rem, 100%);
  width: max-content;
  max-width: none;
}

.admin-project-recon-delete-trailing {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
}

.admin-project-recon-tool-x + .admin-project-recon-delete-trailing {
  margin-left: 0;
}

.admin-project-recon-payout-brief-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
  flex: 0 1 auto;
  min-width: 0;
}

.admin-project-recon-payout-detail-btn-slot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-project-recon-payout-brief {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin-left: 0;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.35;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Полноэкранная модалка «Детализация выплаты» */
.modal-recon-payout-detail {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.modal-recon-payout-detail .modal-backdrop {
  border-radius: 0;
}

.modal-dialog-recon-payout-detail {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  max-height: none;
  border-radius: 0;
  margin: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  border: none;
  box-sizing: border-box;
}

.modal-dialog-recon-payout-detail .admin-project-recon-payout-detail-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
}

/* Полноэкранный конструктор колонок детализации выплаты */
.modal-recon-payout-detail-builder {
  z-index: 450;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.modal-recon-payout-detail-builder .modal-backdrop {
  border-radius: 0;
}

.modal-dialog-recon-payout-detail-builder {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  max-height: none;
  border-radius: 0;
  margin: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  border: none;
  box-sizing: border-box;
}

/* Карточки колонок слева направо, как заголовки таблицы */
.recon-payout-detail-builder-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.75rem;
  margin-bottom: 0;
  padding: 0.15rem 0.15rem 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.recon-payout-detail-builder-row {
  flex: 0 0 auto;
  width: 14rem;
  min-width: 12rem;
  padding: 0.85rem 0.75rem;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.recon-payout-detail-builder-row-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
  flex: 1 1 auto;
}

.recon-payout-detail-builder-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 0;
}

.recon-payout-detail-builder-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.recon-payout-detail-builder-field input,
.recon-payout-detail-builder-field select {
  width: 100%;
  margin: 0;
}

.recon-payout-detail-builder-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.35rem;
}

.modal-dialog-recon-month-payouts {
  max-width: min(96vw, calc(52rem * 1.3));
}

.admin-project-recon-month-payouts-table-wrap {
  max-height: min(calc(55vh * 1.3), calc(24rem * 1.3));
  margin-bottom: 0.75rem;
}

/* Не применять «узкую центрированную» последнюю колонку списка проектов — здесь последняя колонка числовая, как ФОТ. */
.admin-project-recon-month-payouts-table-wrap .admin-projects-table td:last-child,
.admin-project-recon-month-payouts-table-wrap .admin-projects-table thead th:last-child {
  text-align: start;
  width: auto;
  min-width: 8.5rem;
  vertical-align: middle;
}

.admin-project-recon-month-payouts-total td {
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  padding-top: 0.65rem;
}

.admin-project-recon-payout-detail-table-wrap {
  margin-bottom: 0;
}

.recon-payout-detail-tfoot.hidden {
  display: none;
}

.admin-project-recon-payout-detail-table-wrap .recon-payout-detail-tfoot td {
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  padding-top: 0.65rem;
  vertical-align: middle;
}

.admin-project-recon-payout-detail-table-wrap .recon-payout-detail-tfoot .recon-payout-detail-tfoot-label {
  white-space: nowrap;
}

.recon-payout-detail-th-name {
  white-space: nowrap;
}

.recon-payout-detail-name-td {
  white-space: nowrap;
}

.recon-payout-detail-name-text {
  vertical-align: baseline;
}

.recon-payout-detail-manual-warn {
  display: inline-block;
  margin-left: 0.35rem;
  color: hsl(352 55% 48%);
  font-weight: 800;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: super;
}

.recon-payout-detail-manual-warn--legend {
  vertical-align: middle;
  margin-left: 0.3rem;
  font-size: 1em;
}

html[data-theme="light"] .recon-payout-detail-manual-warn {
  color: hsl(352 70% 40%);
}

.admin-project-recon-payout-brief-line {
  margin: 0;
  white-space: nowrap;
}

.admin-project-recon-payout-brief-line:first-child {
  color: var(--text, inherit);
}

.admin-project-recon-payout-brief-line:last-child {
  margin-top: 0.15rem;
}

.admin-project-recon-delete-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.admin-project-recon-tool-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.admin-project-recon-tool-x:hover:not(:disabled) {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.admin-project-recon-tool-x:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.admin-project-recon-tool-x:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.admin-project-recon-delete-x:hover:not(:disabled) {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.admin-project-recon-delete-x:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.admin-project-recon-delete-x:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.admin-project-recon-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1.25rem;
  width: 100%;
}

.admin-project-recon-search-field-grow {
  flex: 1 1 14rem;
  min-width: 0;
}

.admin-project-recon-range-field {
  flex: 1 1 17rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: min(100%, 14rem);
}

.admin-project-recon-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.admin-project-recon-range-clear-x {
  align-self: center;
  flex-shrink: 0;
}

.admin-project-recon-date-input {
  flex: 1 1 8.75rem;
  min-width: 0;
  max-width: 11.5rem;
  margin-bottom: 0;
}

.admin-project-recon-range-dash {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.admin-project-recon-dashboard-send-slot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
  min-width: 9.5rem;
}

.admin-project-recon-payout-slot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
  min-width: 6.5rem;
}

.admin-project-dashboard-saved-access {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-project-dashboard-kpi-staff-slot {
  display: flex;
  min-width: 0;
  align-items: stretch;
}

.admin-project-dashboard-kpi-staff-slot .admin-project-dashboard-kpi--staff {
  flex: 1 1 auto;
}

.admin-project-dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-project-dashboard-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.admin-project-dashboard-meta-row .admin-project-dashboard-meta {
  flex: 1 1 16rem;
  margin: 0;
  min-width: 0;
  line-height: 1.45;
}

.admin-project-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: center;
}

#btn-admin-dashboard-save:disabled,
#btn-admin-dashboard-saved-list:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-dialog-admin-dashboard-saved {
  max-width: min(96vw, 760px);
  width: 100%;
}

.admin-project-dashboard-saved-table-wrap {
  max-height: min(52vh, 400px);
  margin-bottom: 0.35rem;
}

.admin-project-dashboard-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .admin-project-dashboard-charts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .admin-project-dashboard-charts {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.admin-project-dashboard-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem 0.5rem;
  min-width: 0;
}

.admin-project-dashboard-chart-title {
  display: block;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0;
  text-align: left;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.3;
}

.admin-project-dashboard-chart-title:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.admin-project-dashboard-chart-title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-dialog-admin-dashboard-chart {
  max-width: min(96vw, 1280px);
  width: 100%;
}

.admin-project-dashboard-chart-modal-head.header-row {
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: nowrap;
}

.admin-project-dashboard-chart-modal-head .admin-project-dashboard-chart-modal-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.admin-project-dashboard-chart-modal-head .admin-project-staff-detail-head-actions {
  flex-shrink: 0;
  margin-left: 0.35rem;
}

.admin-project-dashboard-fullscreen-canvas-wrap {
  position: relative;
  width: 100%;
  height: min(72vh, 780px);
  min-height: 280px;
  margin-bottom: 0.25rem;
}

.admin-project-dashboard-fullscreen-period {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  max-width: min(46%, 15rem);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius, 8px);
  background: var(--dashboard-fs-badge-bg);
  border: 1px solid var(--dashboard-fs-badge-border);
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: right;
  pointer-events: none;
  box-shadow: var(--dashboard-fs-badge-shadow);
}

.admin-project-dashboard-fullscreen-period-sv {
  color: var(--muted, #94a3b8);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
  word-break: break-word;
}

.admin-project-dashboard-fullscreen-period-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text, #e7ecf3);
}

.admin-project-dashboard-chart-canvas-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}

.admin-project-dashboard-bar-canvas-wrap {
  position: relative;
  height: 200px;
  width: 100%;
  margin-top: 0.35rem;
}

#btn-admin-project-recon-payout:disabled {
  background: hsl(220 6% 28%) !important;
  border-color: hsl(220 5% 38%) !important;
  color: hsl(220 8% 62%) !important;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

#btn-admin-project-recon-payout:disabled:hover {
  background: hsl(220 6% 28%) !important;
  border-color: hsl(220 5% 38%) !important;
  color: hsl(220 8% 62%) !important;
}

html[data-theme="light"] #btn-admin-project-recon-payout:disabled,
html[data-theme="light"] #btn-admin-project-recon-payout:disabled:hover {
  background: hsl(216 16% 90%) !important;
  border-color: hsl(215 14% 78%) !important;
  color: hsl(218 12% 38%) !important;
}

#admin-project-recon-select.admin-project-recon-select--payout-used {
  background-color: hsl(145 32% 18% / 0.9);
  border-color: hsl(145 40% 36%);
}

html[data-theme="light"] #admin-project-recon-select.admin-project-recon-select--payout-used {
  background-color: hsl(158 20% 88%);
  border-color: hsl(158 24% 38%);
}

/* Пункты с выплатами в выпадающем списке (в Safari часть стилей к option не применяется — есть префикс «Выплата ·» в тексте). */
#admin-project-recon-select option.recon-select-option--has-payout {
  background-color: hsl(145 28% 20%);
  color: hsl(145 30% 94%);
  font-weight: 500;
}

html[data-theme="light"] #admin-project-recon-select option.recon-select-option--has-payout {
  background-color: hsl(152 32% 88%);
  color: hsl(152 55% 20%);
  font-weight: 500;
}

.staff-payout-table-wrap {
  margin-top: 0.35rem;
}

.staff-payout-month-row {
  cursor: pointer;
}

.staff-payout-month-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

.staff-payout-month-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.staff-payout-month-cell {
  font-weight: 600;
}

.staff-payout-amount--negative {
  color: hsl(352 45% 58%);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.staff-payout-th-actions {
  width: 2.75rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.staff-payout-data-row td {
  vertical-align: top;
}

.staff-payout-actions-cell {
  width: 2.75rem;
  text-align: center;
}

/* Перебивает .admin-projects-table td:last-child { vertical-align: middle } — иначе ✎ по центру всей строки, а не у суммы ФОТ */
.staff-payout-table.admin-projects-table td.staff-payout-actions-cell {
  vertical-align: top;
}

.staff-payout-actions-cell .btn-ghost.staff-payout-edit-btn {
  margin-top: 0;
}

.staff-payout-actions-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.staff-payout-manual-del-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.staff-payout-manual-action-del.btn-ghost {
  width: auto;
  margin-top: 0;
  min-width: 2rem;
  padding: 0.2rem 0.35rem;
  font-size: 1rem;
  line-height: 1;
  display: none;
}

.staff-payout-data-row.staff-payout-row--manual-open .staff-payout-manual-action-del.btn-ghost {
  display: inline-flex;
}

.staff-payout-edit-btn {
  min-width: 2rem;
  padding: 0.2rem 0.35rem;
  font-size: 1rem;
  line-height: 1;
}

.staff-payout-period-dates {
  font-variant-numeric: tabular-nums;
}

.staff-payout-fot-cell {
  text-align: right;
}

.staff-payout-fot-amount {
  font-variant-numeric: tabular-nums;
}

.staff-payout-manual-under-fot {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border, rgba(148, 163, 184, 0.45));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.staff-payout-manual-under-fot-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  font-size: 0.8rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  gap: 0.15rem;
}

.staff-payout-manual-under-fot-line-head {
  display: block;
  text-align: right;
}

.staff-payout-manual-under-fot-amt {
  font-weight: 600;
}

.staff-payout-manual-under-fot-comment {
  color: var(--muted-fg, hsl(215 14% 58%));
  word-break: break-word;
  max-width: 14rem;
}

.staff-payout-manual-inner {
  padding: 0.5rem 0.35rem 0.35rem;
  background: var(--inset-bg);
  border-radius: calc(var(--radius) - 2px);
}

.staff-payout-manual-form {
  margin-bottom: 0.35rem;
}

.staff-payout-manual-form-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: wrap;
  width: 100%;
}

.staff-payout-manual-form-row .staff-payout-manual-amount {
  flex: 0 0 auto;
  width: 8rem;
  max-width: min(8rem, 100%);
}

.staff-payout-manual-form-row .staff-payout-manual-comment-inp {
  flex: 1 1 12rem;
  min-width: 0;
}

.staff-payout-manual-form-row .staff-payout-manual-add.btn-ghost {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
}

.admin-project-recon-summary-row th {
  font-weight: 600;
  font-size: 0.875rem;
  padding-top: 0.22rem;
  padding-bottom: 0.06rem;
  border-bottom: none;
  vertical-align: bottom;
}

.admin-project-recon-summary-row .admin-project-recon-summary-corner,
.admin-project-recon-summary-row .admin-project-recon-summary-filler {
  font-weight: 400;
}

.admin-project-recon-summary-cell {
  color: var(--text, inherit);
  white-space: nowrap;
}

.admin-project-recon-summary-staff-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

/* Как у чисел выработки в строках таблицы (не последняя колонка). */
#admin-project-recon-summary-output {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

#admin-project-recon-summary-salary {
  text-align: right;
}

.admin-project-recon-table-wrap {
  margin-top: 0.35rem;
  max-height: min(72vh, 48rem);
}

/* Вторая строка шапки: без этого th по умолчанию middle — кнопки визуально выше «Исполнитель» */
.admin-project-recon-table-wrap thead tr:not(.admin-project-recon-summary-row) th {
  vertical-align: bottom;
  padding-top: 0.28rem;
}

.admin-project-recon-vanished-section .admin-project-recon-table-wrap {
  max-height: min(40vh, 24rem);
}

.recon-vanished-remove-th {
  width: 2.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.recon-vanished-actions-cell {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.admin-project-recon-vanished-section .recon-vanished-name-cell[title] {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}

.recon-vanished-remove-x {
  margin: 0 auto;
}

.admin-project-recon-vanished-section .admin-projects-table td:last-child,
.admin-project-recon-vanished-section .admin-projects-table thead th:last-child {
  text-align: center;
  min-width: 0;
  width: 2.25rem;
}

.admin-project-recon-table-wrap .admin-projects-table td:last-child,
.admin-project-recon-table-wrap .admin-projects-table thead th:last-child {
  width: auto;
  min-width: 6.5rem;
  text-align: right;
}

.admin-project-recon-table-wrap thead th:last-child .admin-project-recon-salary-th-btn {
  width: 100%;
  justify-content: flex-end;
}

/* Сводный кружок над «Дата смены»: отключённые / нет в учёте / всё в порядке */
.recon-shift-date-th {
  vertical-align: bottom;
}

.recon-shift-date-th-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.2;
}

/* Пока все группы исполнителей свёрнуты, в шапке не показываем подписи колонок уровня смены (строка исполнителя — шеврон, объединённая ячейка «N смен» и т.д.). */
#admin-project-recon-table-wrap.admin-project-recon--all-shift-groups-collapsed .recon-th-label-shift-rows {
  display: none;
}

.recon-performer-th {
  vertical-align: bottom;
}

.recon-performer-th-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem; /* как у .recon-emp-name-inner — подпись «Исполнитель» с тем же отступом, что ФИО после полоски */
  line-height: 1.2;
}

/* «!» у «Исполнитель»: пропавшие смены с исполнителями по текущим фильтрам */
.recon-table-vanished-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 11px;
  min-height: 11px;
  padding: 0 1px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  border-radius: 2px;
  box-sizing: border-box;
}

.recon-table-vanished-warn--on {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 0 6px color-mix(in srgb, var(--danger) 55%, transparent);
}

.recon-table-vanished-warn--off {
  color: color-mix(in srgb, var(--muted, #888) 92%, var(--text, #fff));
  background: color-mix(in srgb, var(--border) 35%, transparent);
  border: 1px solid var(--border);
  opacity: 0.9;
}

html[data-theme="light"] .recon-table-vanished-warn--off {
  color: #5c6570;
  background: rgba(0, 0, 0, 0.06);
  border-color: #b9c4d4;
}

.recon-table-staff-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-right: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: var(--text, #fff);
  border: 1px solid transparent;
  box-sizing: border-box;
}

.recon-table-staff-status-dot--on {
  opacity: 1;
}

.recon-table-staff-status-dot--off {
  display: none;
}

.recon-table-staff-status-dot--inactive {
  background: var(--recon-indicator-inactive);
  box-shadow: 0 0 6px color-mix(in srgb, var(--recon-indicator-inactive) 70%, transparent);
}

.recon-table-staff-status-dot--missing {
  background: var(--recon-indicator-missing);
  box-shadow: 0 0 6px color-mix(in srgb, var(--recon-indicator-missing) 70%, transparent);
}

.recon-table-staff-status-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  color: var(--text, #fff);
  background: color-mix(in srgb, var(--border) 45%, transparent);
  border: 1px solid var(--border);
}

html[data-theme="light"] .recon-table-staff-status-count {
  color: #1a1d24;
  background: rgba(0, 0, 0, 0.06);
  border-color: #b9c4d4;
}

.recon-emp-name-cell {
  vertical-align: middle;
}

.recon-emp-name-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.2em;
}

.recon-emp-staff-bar {
  flex: 0 0 3px;
  width: 3px;
  height: 1em;
  align-self: center;
  border-radius: 2px;
}

.recon-emp-staff-bar--inactive {
  background: var(--recon-indicator-inactive);
}

.recon-emp-staff-bar--missing {
  background: var(--recon-indicator-missing);
}

.recon-emp-staff-bar--duplicate {
  background: var(--recon-indicator-duplicate);
}

/* Резерв ширины под полоску, чтобы ФИО в колонке выровнялись */
.recon-emp-staff-bar--placeholder {
  visibility: hidden;
  background: transparent;
}

.recon-emp-name-text {
  font-weight: 500;
}

.recon-emp-row {
  cursor: pointer;
  font-weight: 500;
}

.recon-emp-row:hover {
  background: rgba(61, 139, 253, 0.1);
}

.recon-emp-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.recon-emp-chevron-cell {
  width: 1.75rem;
  padding-right: 0.15rem !important;
  vertical-align: middle;
}

.recon-emp-chevron {
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
}

.recon-emp-row.is-expanded .recon-emp-chevron {
  transform: rotate(90deg);
}

.recon-shift-row {
  background: var(--inset-bg);
}

.recon-shift-row td {
  font-weight: normal;
}

.recon-shift-date-cell {
  padding-left: 1.35rem !important;
  font-variant-numeric: tabular-nums;
}

.recon-shift-placeholder-cell {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Итог зарплаты по исполнителю, если есть смены с индикатором (красный приоритетнее зелёного) */
.recon-emp-total-salary {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.recon-emp-total-salary--down {
  color: var(--recon-salary-down);
}

.recon-emp-total-salary--up {
  color: var(--recon-salary-up);
}

.recon-emp-total-salary--purple {
  color: var(--recon-salary-violet);
}

.recon-salary-zero {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.recon-salary-zero--purple {
  color: var(--recon-salary-violet);
}

.recon-legend--down {
  color: var(--recon-salary-down);
  font-weight: 600;
}

.recon-legend--up {
  color: var(--recon-salary-up);
  font-weight: 600;
}

.recon-legend--purple {
  color: var(--recon-salary-violet);
  font-weight: 600;
}

.recon-legend-bar {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  border-radius: 2px;
  vertical-align: -0.12em;
  margin: 0 0.12em;
}

.recon-legend-bar--inactive {
  background: var(--recon-indicator-inactive);
}

.recon-legend-bar--miss {
  background: var(--recon-indicator-missing);
}

.recon-legend-bar--duplicate {
  background: var(--recon-indicator-duplicate);
}

/* Сброс глобального `button, .btn`: только цвет цифры и подчёркивание, без «плашки» */
.admin-projects-table button.recon-salary-hit {
  display: inline;
  padding: 0;
  margin: 0;
  width: auto;
  min-width: 0;
  background: transparent !important;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: inherit;
  vertical-align: baseline;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.admin-projects-table button.recon-salary-hit:hover,
.admin-projects-table button.recon-salary-hit:focus-visible {
  background: transparent !important;
  box-shadow: none;
}

.admin-projects-table button.recon-salary-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.recon-salary-hit--down {
  color: var(--recon-salary-down) !important;
}

.recon-salary-hit--up {
  color: var(--recon-salary-up) !important;
}

.admin-projects-table button.recon-salary-hit.recon-salary-hit--down:hover,
.admin-projects-table button.recon-salary-hit.recon-salary-hit--down:focus-visible {
  color: var(--recon-salary-down-hover) !important;
}

.admin-projects-table button.recon-salary-hit.recon-salary-hit--up:hover,
.admin-projects-table button.recon-salary-hit.recon-salary-hit--up:focus-visible {
  color: var(--recon-salary-up-hover) !important;
}

.recon-salary-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  align-items: baseline;
  font-size: 0.95rem;
}

.recon-salary-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: normal;
}

.recon-salary-dl dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.recon-salary-delta--neg {
  color: var(--recon-salary-down);
  font-weight: 600;
}

.recon-salary-delta--pos {
  color: var(--recon-salary-up);
  font-weight: 600;
}

/* Персонал проекта: импорт / Excel / API — один горизонтальный ряд (перебивает width:100% у .btn-ghost при сбое кэша/порядка правил) */
#admin-project-staff-list-block .admin-project-staff-import-actions {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

#admin-project-staff-list-block .admin-project-staff-import-actions > .btn {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  margin-top: 0 !important;
}
