/* ==========================================================================
   Раздел «Пользователи»: таблица, карточки, заявки, журнал, модалки
   ========================================================================== */

.au-page { display: flex; flex-direction: column; gap: 18px; animation: au-in .22s ease both; }
@keyframes au-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.au-muted { color: var(--c-muted, #94a3b8); }
.au-nowrap { white-space: nowrap; }
.au-note { margin: 8px 0 0; font-size: .76rem; color: var(--c-muted, #64748b); line-height: 1.5; }

/* ---------- Кнопки ---------- */
.au-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--c-surface, #fff);
  color: var(--c-text-2, #475569);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.au-btn i { font-size: .82rem; }
.au-btn:disabled { opacity: .6; cursor: not-allowed; }
.au-btn--primary {
  background: var(--c-brand, #2563eb);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
}
.au-btn--primary:hover { background: var(--c-brand-2, #1d4ed8); }
.au-btn--ghost { background: var(--c-surface, #fff); border-color: var(--c-border, #e6eaf2); color: var(--c-text-2, #475569); }
.au-btn--ghost:hover { background: var(--c-surface-2, #f8fafc); color: var(--c-text, #0f172a); border-color: var(--c-border-strong, #d5dceb); }
.au-btn--danger { background: #dc2626; color: #fff; }
.au-btn--danger:hover { background: #b91c1c; }
.au-btn--sm { padding: 6px 10px; font-size: .76rem; border-radius: 7px; }
.au-btn--icon { padding: 8px; width: 34px; height: 34px; }
.au-link { border: 0; background: none; padding: 0; color: var(--c-brand, #2563eb); font: inherit; font-size: .76rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.au-link:hover { text-decoration: underline; }

/* ---------- Шапка ---------- */
.au-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.au-header__title { display: flex; align-items: center; gap: 13px; }
.au-header__icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #dbeafe, #ede9fe);
  color: var(--c-brand, #2563eb);
  font-size: 1.15rem;
  border: 1px solid #dbeafe;
}
.au-header h2 { margin: 0; font-size: 1.42rem; font-weight: 750; letter-spacing: -.02em; color: var(--c-text, #0f172a); }
.au-header p { margin: 3px 0 0; font-size: .82rem; color: var(--c-muted, #64748b); }
.au-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Статистика ---------- */
.au-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.au-stat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 14px;
  background: var(--c-surface, #fff);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15, 23, 42, .05));
}
.au-stat:hover { transform: translateY(-2px); box-shadow: var(--c-shadow, 0 6px 20px -8px rgba(15, 23, 42, .2)); border-color: var(--c-border-strong, #d5dceb); }
.au-stat__icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: .95rem;
}
.au-stat--brand .au-stat__icon { background: #eff4ff; color: #2563eb; }
.au-stat--success .au-stat__icon { background: #ecfdf5; color: #059669; }
.au-stat--warning .au-stat__icon { background: #fffbeb; color: #d97706; }
.au-stat--violet .au-stat__icon { background: #f5f3ff; color: #7c3aed; }
.au-stat__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.au-stat__value { font-size: 1.35rem; font-weight: 750; color: var(--c-text, #0f172a); letter-spacing: -.02em; line-height: 1.15; }
.au-stat__label { font-size: .74rem; font-weight: 600; color: var(--c-text-2, #475569); }
.au-stat__hint { font-size: .68rem; color: var(--c-muted, #94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Вкладки ---------- */
.au-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--c-surface-2, #f8fafc);
  border: 1px solid var(--c-border, #e6eaf2);
  align-self: flex-start;
  flex-wrap: wrap;
}
.au-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--c-text-2, #475569);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.au-tab i { color: var(--c-muted, #94a3b8); font-size: .82rem; }
.au-tab:hover { color: var(--c-text, #0f172a); }
.au-tab.is-active { background: var(--c-surface, #fff); color: var(--c-brand, #2563eb); box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15, 23, 42, .08)); }
.au-tab.is-active i { color: var(--c-brand, #2563eb); }
.au-tab__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--c-surface-2, #f1f5f9);
  color: var(--c-muted, #64748b);
  font-size: .66rem;
  font-weight: 700;
  text-align: center;
}
.au-tab.is-active .au-tab__count { background: var(--c-brand-soft, #eff4ff); color: var(--c-brand, #2563eb); }
.au-tab__count--alert { background: #dc2626; color: #fff; }
.au-tab.is-active .au-tab__count--alert { background: #dc2626; color: #fff; }

/* ---------- Панель и тулбар ---------- */
.au-tab-panel { display: flex; flex-direction: column; gap: 12px; }
.au-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.au-toolbar--stack { align-items: stretch; flex-direction: column; }
.au-toolbar__filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.au-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 30px 8px 11px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 9px;
  background-color: var(--c-surface, #fff);
  color: var(--c-text-2, #475569);
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.au-toolbar select:focus { outline: none; border-color: var(--c-brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

.au-search {
  position: relative;
  flex: 1 1 320px;
  min-width: 220px;
  display: flex;
  align-items: center;
}
.au-toolbar--stack .au-search { flex: 0 0 auto; width: 100%; }
.au-search > i { position: absolute; left: 12px; color: var(--c-muted, #94a3b8); font-size: .82rem; pointer-events: none; }
.au-search input {
  width: 100%;
  padding: 9px 34px 9px 34px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 9px;
  background: var(--c-surface, #fff);
  color: var(--c-text, #0f172a);
  font: inherit;
  font-size: .84rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.au-search input:focus { outline: none; border-color: var(--c-brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.au-search__clear { position: absolute; right: 5px; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--c-muted, #94a3b8); cursor: pointer; }
.au-search__clear:hover { background: var(--c-surface-2, #f1f5f9); color: var(--c-text, #0f172a); }

/* ---------- Массовые действия ---------- */
.au-bulk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  flex-wrap: wrap;
}
.au-bulk__count { font-size: .8rem; color: #1d4ed8; }
.au-bulk__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Таблица ---------- */
.au-table-wrap {
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 13px;
  overflow: auto;
  background: var(--c-surface, #fff);
  box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15, 23, 42, .05));
}
.au-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 900px; }
.au-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  text-align: left;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--c-muted, #64748b);
  background: var(--c-surface-2, #f8fafc);
  border-bottom: 1px solid var(--c-border, #e6eaf2);
  white-space: nowrap;
}
.au-table td { padding: 10px 12px; border-bottom: 1px solid var(--c-border, #eef2f9); vertical-align: middle; color: var(--c-text, #0f172a); }
.au-table tbody tr:last-child td { border-bottom: 0; }
.au-table tbody tr { transition: background .12s ease; }
.au-table tbody tr:hover td { background: var(--c-surface-2, #f8fafc); }
.au-table tbody tr.is-selected td { background: #f0f7ff; }
.au-check-cell { width: 38px; text-align: center; }
.au-check-cell input { width: 15px; height: 15px; accent-color: var(--c-brand, #2563eb); cursor: pointer; }
.au-actions-cell { width: 1%; text-align: right; white-space: nowrap; }

/* Таблица пользователей: фиксированные колонки, действия всегда видны */
.au-users-table { table-layout: fixed; min-width: 1000px; }
.au-users-table th:nth-child(1), .au-users-table td:nth-child(1) { width: 36px; }
.au-users-table th:nth-child(2), .au-users-table td:nth-child(2) { width: 24%; }
.au-users-table th:nth-child(3), .au-users-table td:nth-child(3) { width: 14%; }
.au-users-table th:nth-child(4), .au-users-table td:nth-child(4) { width: 10%; }
.au-users-table th:nth-child(5), .au-users-table td:nth-child(5) { width: 14%; }
.au-users-table th:nth-child(6), .au-users-table td:nth-child(6) { width: 9%; }
.au-users-table th:nth-child(7), .au-users-table td:nth-child(7) { width: 9%; }
.au-users-table th:nth-child(8), .au-users-table td:nth-child(8) { width: 100px; }
.au-users-table .au-user-cell { min-width: 0; }
.au-users-table .au-user-cell__info { min-width: 0; }
.au-users-table .au-user-link { max-width: 100%; }
.au-users-table .au-contacts { min-width: 0; }
.au-users-table .au-contacts span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.au-users-table .au-employee { min-width: 0; max-width: 100%; }
.au-users-table .au-employee span { min-width: 0; }
.au-users-table .au-employee b,
.au-users-table .au-employee small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.au-users-table .au-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.au-user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.au-user-cell__info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.au-user-link { border: 0; background: none; padding: 0; font: inherit; font-size: .86rem; font-weight: 650; color: var(--c-text, #0f172a); text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.au-user-link:hover { color: var(--c-brand, #2563eb); text-decoration: underline; }
.au-user-cell__info > span { font-size: .7rem; color: var(--c-muted, #94a3b8); }
.au-user-cell__info i { font-size: .64rem; }

.au-contacts { display: flex; flex-direction: column; gap: 2px; font-size: .76rem; color: var(--c-text-2, #475569); }
.au-contacts span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.au-contacts i { color: var(--c-muted, #94a3b8); font-size: .68rem; width: 12px; flex: 0 0 12px; }
.au-contact-text { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.au-employee { display: inline-flex; align-items: center; gap: 7px; }
.au-employee > i { color: var(--c-muted, #94a3b8); }
.au-employee span { display: flex; flex-direction: column; line-height: 1.25; }
.au-employee b { font-size: .78rem; font-weight: 600; color: var(--c-text, #0f172a); white-space: nowrap; }
.au-employee small { font-size: .68rem; color: var(--c-muted, #94a3b8); white-space: nowrap; }

.au-relative { font-size: .76rem; color: var(--c-text-2, #475569); white-space: nowrap; }

.au-row-actions { display: inline-flex; gap: 3px; }
.au-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--c-muted, #64748b);
  font-size: .78rem;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.au-icon-btn:hover { background: var(--c-surface-2, #f1f5f9); color: var(--c-brand, #2563eb); }
.au-icon-btn--warn:hover { background: #fffbeb; color: #d97706; }
.au-icon-btn--success { color: #059669; }
.au-icon-btn--success:hover { background: #ecfdf5; color: #047857; }
.au-icon-btn--danger:hover { background: #fef2f2; color: #dc2626; }

/* ---------- Чипы ---------- */
.au-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .69rem;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.5;
}
.au-chip i { font-size: .64rem; }
.au-chip--admin { background: #eff6ff; color: #1d4ed8; }
.au-chip--user { background: var(--c-surface-2, #f1f5f9); color: var(--c-text-2, #475569); }
.au-chip--success { background: #ecfdf5; color: #047857; }
.au-chip--danger { background: #fef2f2; color: #b91c1c; }
.au-chip--warning { background: #fffbeb; color: #b45309; }

/* ---------- Пагинация ---------- */
.au-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 2px; }
.au-pagination > span { font-size: .76rem; color: var(--c-muted, #64748b); }
.au-pagination__pages { display: flex; align-items: center; gap: 4px; }
.au-page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 7px;
  background: var(--c-surface, #fff);
  color: var(--c-text-2, #475569);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.au-page-btn:hover:not(:disabled) { border-color: var(--c-brand, #2563eb); color: var(--c-brand, #2563eb); }
.au-page-btn.is-active { background: var(--c-brand, #2563eb); border-color: var(--c-brand, #2563eb); color: #fff; }
.au-page-btn:disabled { opacity: .45; cursor: not-allowed; }
.au-page-dots { color: var(--c-muted, #94a3b8); font-size: .8rem; padding: 0 2px; }

/* ---------- Пустые состояния / загрузка ---------- */
.au-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 54px 22px;
  border: 1px dashed var(--c-border, #e6eaf2);
  border-radius: 14px;
  background: var(--c-surface, #fff);
  text-align: center;
}
.au-empty > i { font-size: 1.8rem; color: var(--c-muted, #94a3b8); opacity: .7; margin-bottom: 4px; }
.au-empty b { font-size: .95rem; color: var(--c-text, #0f172a); }
.au-empty p { margin: 0 0 8px; font-size: .8rem; color: var(--c-muted, #64748b); max-width: 380px; line-height: 1.5; }
.au-empty--error > i { color: #dc2626; }
.au-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 48px; font-size: .85rem; color: var(--c-muted, #64748b); }

.au-skeleton-block, .au-search--skeleton, .au-skeleton-row {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--c-surface-2, #f1f5f9), var(--c-border, #e6eaf2), var(--c-surface-2, #f1f5f9));
  background-size: 200% 100%;
  animation: au-shimmer 1.3s infinite;
}
.au-search--skeleton { height: 36px; flex: 1 1 320px; }
.au-skeleton-block { width: 130px; height: 34px; }
.au-skeleton-row { height: 56px; margin: 8px 0; }
@keyframes au-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Заявки ---------- */
.au-request-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.au-request-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 999px;
  background: var(--c-surface, #fff);
  color: var(--c-text-2, #475569);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.au-request-tab span { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--c-surface-2, #f1f5f9); font-size: .66rem; text-align: center; color: var(--c-muted, #64748b); }
.au-request-tab:hover { border-color: var(--c-brand, #2563eb); color: var(--c-brand, #2563eb); }
.au-request-tab.is-active { background: var(--c-brand, #2563eb); border-color: var(--c-brand, #2563eb); color: #fff; }
.au-request-tab.is-active span { background: rgba(255, 255, 255, .22); color: #fff; }

.au-request-list { display: flex; flex-direction: column; gap: 9px; }
.au-request {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 13px;
  background: var(--c-surface, #fff);
  box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15, 23, 42, .04));
  transition: border-color .15s ease, box-shadow .15s ease;
}
.au-request.is-pending { border-left: 3px solid #f59e0b; }
.au-request:hover { box-shadow: var(--c-shadow, 0 6px 20px -10px rgba(15, 23, 42, .2)); }
.au-request__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.au-request__user { display: flex; align-items: center; gap: 10px; }
.au-request__name { font-size: .9rem; font-weight: 700; color: var(--c-text, #0f172a); }
.au-request__login { font-size: .72rem; color: var(--c-muted, #64748b); margin-top: 1px; }
.au-request__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .75rem; color: var(--c-text-2, #475569); }
.au-request__meta span { display: inline-flex; align-items: center; gap: 5px; }
.au-request__meta i { color: var(--c-muted, #94a3b8); font-size: .68rem; }
.au-request__matched {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1d4ed8;
  font-size: .7rem;
  font-weight: 600;
}
.au-request__reason, .au-request__approved { display: flex; align-items: flex-start; gap: 6px; font-size: .74rem; line-height: 1.45; }
.au-request__reason { color: #b91c1c; }
.au-request__approved { color: #047857; }
.au-request__side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; flex: 0 0 auto; }
.au-request__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Модалка пользователя ---------- */
#userModal .modal-content.user-modal-content {
  width: min(900px, calc(100vw - 32px));
  max-width: 900px;
  max-height: min(92vh, 900px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
}
.user-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--c-border, #e6eaf2);
  flex-shrink: 0;
}
.user-modal-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-modal-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: linear-gradient(140deg, #dbeafe, #ede9fe);
  color: var(--c-brand, #2563eb);
  border: 1px solid #dbeafe;
}
.user-modal-heading h2 { margin: 0; font-size: 1.08rem; font-weight: 700; color: var(--c-text, #0f172a); }
.user-modal-heading p { margin: 2px 0 0; font-size: .74rem; color: var(--c-muted, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-modal-body { flex: 1; overflow-y: auto; padding: 18px 20px 22px; }
.user-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--c-border, #e6eaf2); background: var(--c-surface-2, #f8fafc); flex-shrink: 0; }

.au-form { display: flex; flex-direction: column; gap: 16px; }
.au-section { padding: 14px 16px; border: 1px solid var(--c-border, #e6eaf2); border-radius: 12px; background: var(--c-surface, #fff); display: flex; flex-direction: column; gap: 12px; }
.au-section--danger { border-color: #fecaca; background: #fffbfb; }
.au-section__head h3 { margin: 0; font-size: .9rem; font-weight: 700; color: var(--c-text, #0f172a); display: flex; align-items: center; gap: 7px; }
.au-section__head h3 i { color: var(--c-brand, #2563eb); font-size: .85rem; }
.au-section--danger .au-section__head h3 i { color: #dc2626; }
.au-section__head p { margin: 3px 0 0; font-size: .74rem; color: var(--c-muted, #64748b); }

.au-user-modal-top { display: flex; gap: 18px; padding: 14px 16px; border: 1px solid var(--c-border, #e6eaf2); border-radius: 12px; background: linear-gradient(120deg, var(--c-brand-soft, #eff4ff), transparent 72%); }
.au-avatar-editor { flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.au-avatar-editor__actions { display: flex; gap: 4px; }
.au-avatar-editor__hint { font-size: .66rem; color: var(--c-muted, #64748b); text-align: center; line-height: 1.3; }
.au-avatar-editor__hint small { font-size: .62rem; color: var(--c-muted, #94a3b8); }
.au-user-modal-top__fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.au-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.au-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.au-field--wide { grid-column: 1 / -1; }
.au-field > span { font-size: .74rem; font-weight: 600; color: var(--c-text-2, #475569); }
.au-field > span em { color: #dc2626; font-style: normal; }
.au-field__control { position: relative; display: flex; align-items: center; }
.au-field__control > i { position: absolute; left: 10px; color: var(--c-muted, #94a3b8); font-size: .78rem; pointer-events: none; }
#userModal .au-field__control input[type="text"],
#userModal .au-field__control input[type="email"],
#userModal .au-field__control input[type="tel"],
#userModal .au-field__control input[type="password"],
#userModal .au-field__control input[type="search"],
#userModal .au-field__control textarea {
  padding-left: 32px;
}
#userModal .au-field__control textarea { padding-left: 10px; }
#userModal .au-field > select { padding: 9px 30px 9px 10px; }

.au-field__control input,
.au-field__control textarea,
.au-field > select {
  width: 100%;
  padding: 9px 10px 9px 32px;
  border: 1.5px solid var(--c-border, #e6eaf2);
  border-radius: 8px;
  background: var(--c-surface, #fff);
  color: var(--c-text, #0f172a);
  font: inherit;
  font-size: .84rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.au-field > select { padding-left: 10px; padding-right: 30px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; }
.au-field__control textarea { padding-left: 10px; resize: vertical; min-height: 52px; }
.au-field__control input:focus,
.au-field__control textarea:focus,
.au-field > select:focus { outline: none; border-color: var(--c-brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.au-field__control input[readonly] { background: var(--c-surface-2, #f8fafc); color: var(--c-muted, #64748b); }
.au-field__btn {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-muted, #94a3b8);
  cursor: pointer;
  font-size: .76rem;
}
.au-field__btn:hover { background: var(--c-surface-2, #f1f5f9); color: var(--c-brand, #2563eb); }
.au-field__control input + .au-field__btn { right: 28px; }
.au-field__control input + .au-field__btn + .au-field__btn { right: 4px; }

.au-avatar-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.au-avatar-preset {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c-surface-2, #f1f5f9);
  color: var(--c-muted, #64748b);
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.au-avatar-preset img { width: 100%; height: 100%; object-fit: cover; }
.au-avatar-preset:hover { transform: translateY(-1px); }
.au-avatar-preset.is-selected { border-color: var(--c-brand, #2563eb); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }

.au-employee-hint { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: 8px; background: var(--c-surface-2, #f8fafc); font-size: .74rem; color: var(--c-text-2, #475569); line-height: 1.45; }
.au-employee-hint i { margin-top: 2px; color: var(--c-brand, #2563eb); }
.au-employee-hint b { font-weight: 650; }

/* Права доступа */
.au-perm-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .74rem; color: var(--c-muted, #64748b); }
.au-perm-preset { border: 1px solid var(--c-border, #e6eaf2); border-radius: 999px; background: var(--c-surface, #fff); padding: 5px 10px; font: inherit; font-size: .74rem; font-weight: 600; color: var(--c-text-2, #475569); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.au-perm-preset:hover { border-color: var(--c-brand, #2563eb); color: var(--c-brand, #2563eb); background: var(--c-brand-soft, #eff4ff); }
.au-perm-groups { display: flex; flex-direction: column; gap: 10px; }
.au-perm-group { border: 1px solid var(--c-border, #e6eaf2); border-radius: 10px; overflow: hidden; }
.au-perm-group__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; background: var(--c-surface-2, #f8fafc); border-bottom: 1px solid var(--c-border, #e6eaf2); font-size: .78rem; font-weight: 650; color: var(--c-text, #0f172a); flex-wrap: wrap; }
.au-perm-group__head > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.au-perm-group__head i { color: var(--c-brand, #2563eb); font-size: .74rem; }
.au-perm-group__actions { display: flex; gap: 4px; }
.au-perm-group__actions button { border: 0; background: transparent; padding: 2px 6px; border-radius: 5px; font: inherit; font-size: .7rem; color: var(--c-muted, #64748b); cursor: pointer; }
.au-perm-group__actions button:hover { background: var(--c-brand-soft, #eff4ff); color: var(--c-brand, #2563eb); }
.au-perm-rows { padding: 4px 8px 6px; }
.au-perm-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px dashed var(--c-border, #eef2f9); flex-wrap: wrap; }
.au-perm-row:last-child { border-bottom: 0; }
.au-perm-row__label { flex: 1 1 150px; font-size: .78rem; color: var(--c-text, #0f172a); min-width: 120px; }
.au-toggle--text { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; color: var(--c-text-2, #475569); cursor: pointer; white-space: nowrap; }
.au-toggle--text input { width: 14px; height: 14px; accent-color: var(--c-brand, #2563eb); cursor: pointer; }

/* Управление и сессии в модалке */
.au-manage-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.au-sessions { border-top: 1px dashed var(--c-border, #fecaca); padding-top: 11px; }
.au-sessions__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .78rem; font-weight: 650; color: var(--c-text, #0f172a); margin-bottom: 7px; }
.au-sessions__list { display: flex; flex-direction: column; gap: 5px; }
.au-session { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--c-border, #e6eaf2); border-radius: 8px; background: var(--c-surface, #fff); }
.au-session__icon { width: 28px; height: 28px; flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--c-brand-soft, #eff4ff); color: var(--c-brand, #2563eb); font-size: .72rem; }
.au-session__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.au-session__info b { font-size: .76rem; color: var(--c-text, #0f172a); }
.au-session__info span { font-size: .68rem; color: var(--c-muted, #64748b); }

/* ---------- Модалки действий ---------- */
.au-admin-modal .modal-content.au-admin-modal__content {
  width: min(680px, calc(100vw - 28px));
  max-width: 680px;
  max-height: min(90vh, 860px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
}
.au-admin-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--c-border, #e6eaf2); flex-shrink: 0; }
.au-admin-modal__heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
.au-admin-modal__icon { width: 38px; height: 38px; flex: 0 0 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--c-brand-soft, #eff4ff); color: var(--c-brand, #2563eb); }
.au-admin-modal__icon i { font-size: .95rem; }
.au-admin-modal__heading h2 { margin: 0; font-size: 1.02rem; font-weight: 700; color: var(--c-text, #0f172a); }
.au-admin-modal__heading p { margin: 2px 0 0; font-size: .74rem; color: var(--c-muted, #64748b); }
.au-admin-modal__body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 13px; }
.au-admin-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 11px 20px; border-top: 1px solid var(--c-border, #e6eaf2); background: var(--c-surface-2, #f8fafc); flex-shrink: 0; }
.au-modal-text { margin: 0; font-size: .82rem; line-height: 1.55; color: var(--c-text-2, #475569); }

.au-request-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; padding: 11px 13px; border: 1px solid var(--c-border, #e6eaf2); border-radius: 10px; background: var(--c-surface-2, #f8fafc); }
.au-request-summary__row { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; border-bottom: 1px dashed var(--c-border, #e6eaf2); }
.au-request-summary__row span { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted, #94a3b8); font-weight: 650; }
.au-request-summary__row b { font-size: .78rem; color: var(--c-text, #0f172a); font-weight: 600; word-break: break-word; }

.au-approve-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.au-radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.au-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 9px;
  background: var(--c-surface, #fff);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.au-radio-card:hover { border-color: var(--c-brand, #2563eb); }
.au-radio-card.is-selected { border-color: var(--c-brand, #2563eb); background: var(--c-brand-soft, #eff4ff); }
.au-radio-card.is-disabled { opacity: .5; }
.au-radio-card input { margin: 2px 0 0; accent-color: var(--c-brand, #2563eb); }
.au-radio-card span { display: flex; flex-direction: column; gap: 1px; }
.au-radio-card b { font-size: .78rem; font-weight: 650; color: var(--c-text, #0f172a); }
.au-radio-card small { font-size: .68rem; color: var(--c-muted, #64748b); line-height: 1.35; }
.au-approve-employee { width: 100%; }

.au-summary-list { display: flex; flex-direction: column; }
.au-summary-list__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--c-border, #e6eaf2); font-size: .8rem; }
.au-summary-list__row:last-child { border-bottom: 0; }
.au-summary-list__row span { color: var(--c-muted, #64748b); flex: 0 0 42%; }
.au-summary-list__row b { color: var(--c-text, #0f172a); text-align: right; font-weight: 600; word-break: break-word; }

.au-temp-password { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 1px dashed #bfdbfe; border-radius: 10px; background: #eff6ff; flex-wrap: wrap; }
.au-temp-password code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; letter-spacing: .05em; color: #1d4ed8; font-weight: 700; }

/* ---------- Журнал ---------- */
.au-audit-table { min-width: 860px; }
.au-audit-action { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: var(--c-surface-2, #f1f5f9); color: var(--c-text-2, #475569); font-size: .7rem; font-weight: 600; white-space: nowrap; }
.au-audit-details { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-2, #475569); font-size: .74rem; vertical-align: bottom; }
.au-audit-table code { font-size: .7rem; color: var(--c-muted, #64748b); }

/* ---------- Тёмная тема ---------- */
body.dark-theme .au-header__icon { background: linear-gradient(140deg, #16233c, #1c1b3a); border-color: #24314a; color: #60a5fa; }
body.dark-theme .au-stat { background: var(--c-surface, #131c2e); border-color: var(--c-border, #24314a); }
body.dark-theme .au-stat--brand .au-stat__icon { background: #16233c; color: #60a5fa; }
body.dark-theme .au-stat--success .au-stat__icon { background: #0d221c; color: #34d399; }
body.dark-theme .au-stat--warning .au-stat__icon { background: #2a2110; color: #fbbf24; }
body.dark-theme .au-stat--violet .au-stat__icon { background: #221b3a; color: #a78bfa; }
body.dark-theme .au-tabs { background: var(--c-surface-2, #0f172a); border-color: #24314a; }
body.dark-theme .au-tab { color: #a9b6c9; }
body.dark-theme .au-tab.is-active { background: #16233c; color: #60a5fa; }
body.dark-theme .au-tab__count { background: #1b2942; color: #8fa2bd; }
body.dark-theme .au-tab.is-active .au-tab__count { background: #1e3a5f; color: #93c5fd; }
body.dark-theme .au-table-wrap { background: var(--c-surface, #131c2e); border-color: #24314a; }
body.dark-theme .au-table th { background: #0f172a; border-bottom-color: #24314a; color: #8fa2bd; }
body.dark-theme .au-table td { border-bottom-color: #1c2a44; color: #e6edf7; }
body.dark-theme .au-table tbody tr:hover td { background: #16233c; }
body.dark-theme .au-table tbody tr.is-selected td { background: #16233c; }
body.dark-theme .au-user-link { color: #e6edf7; }
body.dark-theme .au-btn--ghost { background: var(--c-surface, #131c2e); border-color: #24314a; color: #a9b6c9; }
body.dark-theme .au-btn--ghost:hover { background: #16233c; color: #e6edf7; }
body.dark-theme .au-search input,
body.dark-theme .au-toolbar select { background-color: #131c2e; border-color: #24314a; color: #e6edf7; }
body.dark-theme .au-search__clear:hover { background: #1b2942; }
body.dark-theme .au-bulk { background: #0c1a30; border-color: #1e3a5f; }
body.dark-theme .au-bulk__count { color: #93c5fd; }
body.dark-theme .au-page-btn { background: #131c2e; border-color: #24314a; color: #a9b6c9; }
body.dark-theme .au-empty { background: #131c2e; border-color: #24314a; }
body.dark-theme .au-chip--admin { background: #16233c; color: #93c5fd; }
body.dark-theme .au-chip--user { background: #1b2942; color: #a9b6c9; }
body.dark-theme .au-chip--success { background: #06281f; color: #6ee7b7; }
body.dark-theme .au-chip--danger { background: #2a1315; color: #fca5a5; }
body.dark-theme .au-chip--warning { background: #2a2110; color: #fbbf24; }
body.dark-theme .au-request { background: #131c2e; border-color: #24314a; }
body.dark-theme .au-request__matched { background: #0c1a30; border-color: #1e3a5f; color: #93c5fd; }
body.dark-theme .au-request-tab { background: #131c2e; border-color: #24314a; color: #a9b6c9; }
body.dark-theme .au-request-tab span { background: #1b2942; color: #8fa2bd; }
body.dark-theme #userModal .modal-content.user-modal-content,
body.dark-theme .au-admin-modal .modal-content.au-admin-modal__content { background: #131c2e; border-color: #24314a; }
body.dark-theme .user-modal-header,
body.dark-theme .au-admin-modal__head { border-bottom-color: #24314a; }
body.dark-theme .user-modal-footer,
body.dark-theme .au-admin-modal__foot { background: #0f172a; border-top-color: #24314a; }
body.dark-theme .user-modal-icon,
body.dark-theme .au-admin-modal__icon { background: #16233c; border-color: #24314a; color: #60a5fa; }
body.dark-theme .au-section { background: #131c2e; border-color: #24314a; }
body.dark-theme .au-section--danger { background: #1d1218; border-color: #7f1d1d; }
body.dark-theme .au-user-modal-top { background: linear-gradient(120deg, #16233c, transparent 72%); border-color: #24314a; }
body.dark-theme .au-field__control input,
body.dark-theme .au-field__control textarea,
body.dark-theme .au-field > select { background: #0b1424; border-color: #2a3a56; color: #e6edf7; }
body.dark-theme .au-field__control input[readonly] { background: #0f172a; }
body.dark-theme .au-avatar-preset { background: #1b2942; color: #8fa2bd; }
body.dark-theme .au-employee-hint { background: #0f172a; color: #a9b6c9; }
body.dark-theme .au-perm-group { border-color: #24314a; }
body.dark-theme .au-perm-group__head { background: #0f172a; border-bottom-color: #24314a; color: #e6edf7; }
body.dark-theme .au-perm-row__label { color: #e6edf7; }
body.dark-theme .au-toggle--text { color: #a9b6c9; }
body.dark-theme .au-perm-preset { background: #131c2e; border-color: #24314a; color: #a9b6c9; }
body.dark-theme .au-session { background: #0f172a; border-color: #24314a; }
body.dark-theme .au-session__icon { background: #16233c; color: #60a5fa; }
body.dark-theme .au-request-summary { background: #0f172a; border-color: #24314a; }
body.dark-theme .au-request-summary__row { border-bottom-color: #24314a; }
body.dark-theme .au-radio-card { background: #0f172a; border-color: #24314a; }
body.dark-theme .au-radio-card.is-selected { background: #16233c; border-color: #2563eb; }
body.dark-theme .au-temp-password { background: #0c1a30; border-color: #1e3a5f; }
body.dark-theme .au-temp-password code { color: #93c5fd; }
body.dark-theme .au-audit-action { background: #1b2942; color: #a9b6c9; }
body.dark-theme .au-audit-details { color: #a9b6c9; }

/* ---------- Адаптивность ---------- */
@media (max-width: 1100px) {
  .au-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  /* На телефоне оставляем главное: пользователь, статус, действия */
  .au-users-table { min-width: 0; width: 100%; table-layout: fixed; }
  .au-users-table th:nth-child(1), .au-users-table td:nth-child(1),
  .au-users-table th:nth-child(3), .au-users-table td:nth-child(3),
  .au-users-table th:nth-child(4), .au-users-table td:nth-child(4),
  .au-users-table th:nth-child(5), .au-users-table td:nth-child(5),
  .au-users-table th:nth-child(7), .au-users-table td:nth-child(7) { display: none; }
  .au-users-table th, .au-users-table td { padding: 9px 6px; }
  .au-users-table th:nth-child(2), .au-users-table td:nth-child(2) { width: auto; }
  .au-users-table th:nth-child(6), .au-users-table td:nth-child(6) { width: 86px; }
  .au-users-table th:nth-child(8), .au-users-table td:nth-child(8) { width: 96px; }
  .au-users-table .au-user-cell { gap: 7px; align-items: flex-start; }
  .au-users-table .au-user-link { white-space: normal; overflow-wrap: anywhere; }
  .au-users-table .au-row-actions { gap: 2px; }
  .au-users-table .au-icon-btn { width: 26px; height: 26px; font-size: .72rem; }
  .au-header__actions { width: 100%; }
  .au-header__actions .au-btn { flex: 1 1 auto; }
  .au-header__actions .au-btn--ghost span { display: none; }
  .au-toolbar__filters { width: 100%; }
  .au-toolbar__filters select { flex: 1 1 140px; }
  .au-table { min-width: 760px; }
  .au-users-table { min-width: 0; }
  .au-request { flex-direction: column; gap: 10px; }
  .au-request__side { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
  .au-user-modal-top { flex-direction: column; align-items: center; text-align: center; }
  .au-user-modal-top__fields { width: 100%; }
  .au-grid2 { grid-template-columns: 1fr; }
  .au-field--wide { grid-column: auto; }
  .au-perm-row__label { flex-basis: 100%; }
  .au-radio-cards { grid-template-columns: 1fr; }
  .au-request-summary { grid-template-columns: 1fr; }
  .au-approve-grid { grid-template-columns: 1fr; }
  .au-stats { gap: 8px; }
  .au-stat { padding: 11px 12px; }
  .au-stat__hint { display: none; }
  .au-bulk { flex-direction: column; align-items: stretch; }
  .au-bulk__actions { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .au-stats { grid-template-columns: 1fr 1fr; }
  .au-stat { flex-direction: column; gap: 6px; }
  .au-stat__icon { width: 32px; height: 32px; flex-basis: 32px; }
  .au-stat__value { font-size: 1.15rem; }
  .au-header h2 { font-size: 1.2rem; }
  .au-tabs { width: 100%; }
  .au-tab { flex: 1; justify-content: center; padding: 8px 6px; font-size: .76rem; }
  .au-tab i { display: none; }
  .au-pagination { flex-direction: column; align-items: stretch; }
  .au-pagination__pages { justify-content: center; }
  #userModal .modal-content.user-modal-content,
  .au-admin-modal .modal-content.au-admin-modal__content { width: calc(100vw - 16px); max-height: 94vh; }
  .user-modal-body { padding: 14px; }
  .au-admin-modal__body { padding: 14px; }
  .au-header__actions .au-btn--primary { width: 100%; }
}
.au-chip--school { background: rgba(5, 150, 105, .12); color: #047857; border-color: rgba(5, 150, 105, .25); }
body.dark-theme .au-chip--school { color: #6ee7b7; background: rgba(5, 150, 105, .16); border-color: rgba(5, 150, 105, .3); }
