/* 4. Билеты, вопросы, персонал. Порядок файлов менять нельзя: следующий перекрывает предыдущий. */
/* —— Билеты и вопросы (кабинет менеджера) —— */
.tickets-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.tickets-even-out--needed {
  border-color: rgba(245, 158, 11, 0.55);
  color: #92400e;
}

html.dark .tickets-even-out--needed {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tickets-empty {
  margin: 0;
  text-align: center;
  padding: 8px 0;
}

.ticket-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.ticket-card-open {
  background: #ffffff !important;
}

.ticket-live-lock {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #92400e;
  font-size: 0.88rem;
  line-height: 1.4;
}

#live-attempts-banner.ticket-live-lock {
  margin: 0 0 16px;
}

.ticket-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 16px;
  max-height: min(50vh, 360px);
  overflow: auto;
}

.ticket-pick-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--input-border, var(--border));
  background: var(--input-bg, transparent);
  cursor: pointer;
}

.ticket-pick-option:has(input:checked),
.ticket-pick-option:has(input:focus-visible) {
  border-color: var(--input-focus, #2f9e6e);
  box-shadow: 0 0 0 3px rgba(47, 158, 110, 0.18);
}

.ticket-pick-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #2f9e6e;
}

.ticket-pick-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ticket-pick-meta {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
}

html.dark .ticket-pick-option {
  background: rgba(15, 23, 42, 0.45);
}

.ticket-meta--uneven {
  color: #92400e;
  font-weight: 700;
}

html.dark .ticket-meta--uneven {
  color: #fcd34d;
}

.preview-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}

html.dark .preview-banner {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.4);
}

.preview-review {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-review__title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
}

.preview-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-review-item {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

.preview-review-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.preview-review-item__status {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.75rem;
}

.preview-review-item--ok {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.06);
}

.preview-review-item--ok .preview-review-item__status {
  color: #15803d;
}

.preview-review-item--wrong {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.05);
}

.preview-review-item--wrong .preview-review-item__status {
  color: #b91c1c;
}

.preview-review-item--skip {
  border-color: rgba(100, 116, 139, 0.35);
  background: rgba(100, 116, 139, 0.06);
}

.preview-review-item--skip .preview-review-item__status {
  color: #475569;
}

.preview-review-item__q {
  margin: 0 0 8px;
  font-weight: 600;
  line-height: 1.4;
}

.preview-review-item__line {
  margin: 0 0 4px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.preview-review-item__line span {
  color: #64748b;
  margin-right: 6px;
}

.preview-review-item__line--key {
  font-weight: 600;
}

html.dark .preview-review {
  border-top-color: rgba(255, 255, 255, 0.1);
}

html.dark .preview-review-item {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

#live-attempts-banner .live-edit-countdown {
  display: block;
  margin-top: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#live-attempts-banner .live-attempts-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  margin: 0 1px;
  padding: 0 6px;
  border: 1px solid rgba(180, 83, 9, 0.45);
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.22);
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

#live-attempts-banner .live-attempts-count:hover,
#live-attempts-banner .live-attempts-count:focus-visible {
  background: rgba(245, 158, 11, 0.38);
  outline: none;
}

#live-attempts-banner .live-attempts-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(245, 158, 11, 0.28);
}

#live-attempts-banner .live-attempts-panel-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.8;
}

#live-attempts-banner .live-attempts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

#live-attempts-banner .live-attempts-person {
  display: grid;
  gap: 2px;
}

#live-attempts-banner .live-attempts-person-name {
  font-weight: 700;
}

#live-attempts-banner .live-attempts-person-meta {
  font-size: 0.82rem;
  opacity: 0.88;
}

html.dark #live-attempts-banner .live-attempts-count {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.16);
}

html.dark #live-attempts-banner .live-attempts-panel {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(251, 191, 36, 0.28);
}

.ticket-live-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

html.dark .ticket-live-lock,
html.dark .ticket-live-badge {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.ticket-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: default;
}

.ticket-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.ticket-toggle:hover {
  background: rgba(76, 183, 130, 0.2);
}

.ticket-title {
  margin: 0;
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
}

.ticket-meta {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.ticket-delete-btn {
  flex-shrink: 0;
  margin-left: 4px;
}

.ticket-body {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.ticket-body-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.ticket-body-actions .btn {
  min-height: 44px;
  width: 100%;
}

.ticket-questions {
  list-style: none;
  margin: 0 0 14px;
  padding: 12px 0 0;
}

.ticket-question-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.ticket-question-item:last-child {
  border-bottom: none;
}

.ticket-question-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.ticket-question-check {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: -10px 0 0 -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ticket-question-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2f9e6e;
  cursor: pointer;
}

.ticket-question-num {
  color: #64748b;
  font-weight: 600;
  flex-shrink: 0;
}

.ticket-question-text {
  flex: 1;
  line-height: 1.45;
}

.ticket-question-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.btn-link-edit,
.btn-link-delete {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.75;
  border-radius: 6px;
}

.btn-link-edit {
  color: var(--input-focus);
}

.btn-link-edit:hover {
  opacity: 1;
  background: rgba(76, 183, 130, 0.12);
}

.btn-link-delete {
  color: #f87171;
  font-size: 1.35rem;
}

.btn-link-delete:hover {
  opacity: 1;
  background: rgba(248, 113, 113, 0.12);
}

.ticket-question-item-editing {
  padding-bottom: 16px;
}

.ticket-question-item .question-form-wrap {
  margin-top: 12px;
  padding: 14px;
}

.ticket-question-options {
  margin: 0;
  padding-left: 1.6rem;
  font-size: 0.9rem;
  color: var(--text-secondary) !important;
}

.ticket-question-options li {
  margin: 4px 0;
}

.ticket-option-correct {
  color: #4ade80;
  font-weight: 600;
}

.ticket-option-correct::after {
  content: " ✓";
}

.ticket-no-questions {
  margin: 12px 0 0;
}

.btn-add-question {
  width: 100%;
  margin-bottom: 12px;
}

.question-form-wrap {
  margin-top: 8px;
  padding: 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.question-form .form-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
}

.answer-options-fieldset {
  border: none;
  margin: 0 0 16px;
  padding: 0;
}

.answer-options-fieldset legend {
  font-weight: 600;
  margin-bottom: 4px;
  padding: 0;
}

.answer-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.answer-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.answer-option-correct {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.answer-option-correct input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #4ade80;
  cursor: pointer;
}

.answer-option-text {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-icon-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.btn-icon-remove:hover {
  background: rgba(248, 113, 113, 0.28);
}

.question-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.question-form-actions .btn {
  flex: 1;
  min-width: 140px;
}

@media (max-width: 900px) {

  .logo-shine {
    width: min(360px, 88vw);
    margin: 0 auto;
  }}

/* —— Результат теста (работник, A2) —— */
.result-card {
  padding: 16px 16px 18px;
}

.result-card__eyebrow {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.result-hero {
  text-align: center;
  padding: 14px 16px 12px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.result-hero--pass {
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.22), rgba(34, 197, 94, 0.06));
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.result-hero--fail {
  background: linear-gradient(160deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.06));
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.result-facts {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.result-facts dt {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.result-facts dd {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.result-next {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(76, 183, 130, 0.1);
  border: 1px solid rgba(76, 183, 130, 0.28);
  margin-bottom: 16px;
}

.result-next__hint {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.result-extra {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}

.btn-block {
  width: 100%;
  display: block;
}

.btn-block + .btn-block {
  margin-top: 10px;
}

.test-access-hint {
  margin: 12px 0 0;
}

.test-access-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 20px;
}

/* Ряд кнопок («Выгрузить Excel», «Добавить билет» …) переносится и не шире экрана. */
.test-access-header__row > * {
  min-width: 0;
  max-width: 100%;
}
.test-access-header__row .topbar-actions {
  flex-shrink: 1;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .test-access-header__row > * {
    flex: 1 1 100%;
  }
  .test-access-header__row .topbar-actions .btn {
    white-space: normal;
    min-width: 0;
  }
  .test-access-header__row h1,
  .test-access-header__row p {
    overflow-wrap: break-word;
  }
  .test-access-header__row h1 {
    font-size: 1.75rem;
    line-height: 1.2;
  }
}

.test-access-assign-all-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.test-access-assign-dialog {
  width: min(520px, 92vw);
}

.test-access-assign-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.test-access-dialog-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--on-surface-variant, #64748b);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.test-access-dialog-close:hover {
  background: rgba(148, 163, 184, 0.18);
  color: var(--on-surface, #0f172a);
}

.test-access-dialog-close:focus-visible {
  outline: 2px solid var(--accent, #1e6b4b);
  outline-offset: 2px;
}

.test-access-dept-panel {
  margin-bottom: 16px;
}

.test-access-dept-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.test-access-dept-toggle {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.test-access-dept-toggle:hover {
  text-decoration: underline;
}

.test-access-dept-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
}

.test-access-assign-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-access-assign-actions__main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.test-access-assign-actions > .btn,
.test-access-assign-actions__main > .btn {
  width: 100%;
  margin: 0;
}

.test-access-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 20px;
}

.test-access-folder {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.test-access-folder__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.test-access-folder__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  flex: 0 0 8px;
}

.test-access-folder.is-open .test-access-folder__chevron {
  transform: rotate(45deg);
}

.test-access-folder__name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.test-access-folder__count {
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
  white-space: nowrap;
}

.test-access-folder__body {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
}

.test-access-folder.is-open .test-access-folder__body {
  display: flex;
}

.test-access-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  cursor: pointer;
}

.test-access-row:has(input:not(:checked)) {
  opacity: 0.72;
  border-color: rgba(239, 68, 68, 0.35);
}

.test-access-checkbox {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.test-access-row__body {
  flex: 1;
  min-width: 0;
}

.test-access-row__title {
  display: block;
  font-weight: 600;
  font-size: 1rem;
}

.test-access-row__state {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.test-access-row:has(input:not(:checked)) .test-access-row__state {
  color: #fca5a5;
}

.test-access-row__pub {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.test-access-row__pub--paused,
.test-access-row__pub--draft {
  color: #b45309;
}

.test-access-row.is-dirty {
  opacity: 1;
  border-color: rgba(217, 119, 6, 0.55);
}

.test-access-row.is-dirty .test-access-row__state {
  color: #b45309;
}

html.dark .test-access-row__pub--paused,
html.dark .test-access-row__pub--draft,
html.dark .test-access-row.is-dirty .test-access-row__state {
  color: #fbbf24;
}

.test-access-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
  padding: 16px 0 4px;
  background: linear-gradient(to bottom, transparent, var(--surface) 24px);
  border-top: 1px solid var(--surface-2);
}

.test-access-actions .btn-primary {
  width: 100%;
}

.test-access-save-status {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
}

.test-access-save-status--success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.test-access-save-status--error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

body.dark-theme .test-access-save-status--success,
html.dark .test-access-save-status--success {
  color: #6ee7b7;
}

body.dark-theme .test-access-save-status--error,
html.dark .test-access-save-status--error {
  color: #fca5a5;
}

.personnel-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .personnel-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: end;
  }

  .personnel-toolbar--roles {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .personnel-toolbar--employees {
    grid-template-columns: minmax(0, 1.5fr) minmax(14rem, 0.9fr) auto;
  }

  .actions-toolbar {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
  }}

@media (min-width: 640px) and (max-width: 899px) {
  .personnel-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }}

.personnel-search-field {
  margin: 0;
}

.personnel-count {
  margin: 8px 0 0;
}

.personnel-table {
  width: 100%;
  font-size: 0.92rem;
  border-collapse: separate;
  border-spacing: 0;
}

.personnel-table th,
.personnel-table td {
  padding: 10px 12px;
}

.card.table-wrap.access-employees-card {
  overflow-x: auto;
  overflow-y: hidden;
}

.card.table-wrap.access-employees-card .personnel-table {
  min-width: 980px;
}

.card.table-wrap.access-employees-card .roles-col-actions {
  width: 12.5rem;
  min-width: 12.5rem;
  white-space: nowrap;
}

.card.table-wrap #actions-empty {
  margin: 0;
  padding: 16px 22px 20px;
}

.personnel-table tr:nth-child(even) {
  background-color: #f8fafc;
}
.personnel-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

.personnel-row__name {
  font-weight: 500;
  min-width: 160px;
}

.badge-role-admin {
  background: rgba(30, 107, 75, 0.15);
  color: #17563c;
}

.badge-role-moderator {
  background: rgba(147, 51, 234, 0.15);
  color: #7e22ce;
}

.badge-role-worker {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.actions-table__time {
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--muted);
}

.actions-table__message {
  max-width: 420px;
  line-height: 1.4;
}

.login-attempt-failed td {
  background: rgba(229, 57, 53, 0.06);
}

.login-attempt-note {
  margin-top: 0.35rem;
  max-width: 22rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--on-surface-variant, #94a3b8);
  white-space: normal;
}

.login-attempt-ua,
.login-attempt-browser {
  max-width: 14rem;
  font-size: 0.82rem;
  color: var(--on-surface-variant, #64748b);
  word-break: break-word;
}

.server-log-pre {
  margin: 0;
  padding: 1rem 1.25rem;
  max-height: 70vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 8px;
}

.personnel-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 24px);
  background: var(--dialog-bg);
  color: var(--dialog-title);
  border: var(--dialog-border);
  box-shadow: var(--dialog-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.personnel-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.personnel-dialog form {
  padding: 20px;
}

.personnel-dialog h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.personnel-dialog .alert {
  margin: 0 0 14px;
}

.personnel-dialog input,
.personnel-dialog select {
  color: var(--text, #0f172a);
  background: var(--surface, #fff);
}

html.dark .personnel-dialog input,
html.dark .personnel-dialog select {
  color: var(--text) !important;
  background-color: var(--bg) !important;
  border-color: var(--border) !important;
}

.role-catalog-card__list {
  margin: 0;
  padding: 0 0 0 18px;
  display: grid;
  gap: 4px;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-muted, #475569);
}

.roles-members-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0;
}

.roles-members-head .btn,
.access-roles-actions .btn {
  width: auto;
}

.roles-members-lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
}

.roles-col-actions {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.roles-dialog-lead {
  margin: 0 0 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
}

.roles-lock-hint {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted, #64748b);
  text-transform: none;
}

.roles-lock-hint--block {
  display: block;
  margin-top: 6px;
  text-align: right;
  line-height: 1.3;
  white-space: normal;
}

.access-page-lead {
  margin: 8px 0 0;
  max-width: 860px;
  color: var(--muted, #94a3b8);
  font-size: 0.96rem;
  line-height: 1.5;
}

.access-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 22px;
}

.access-tab {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-light, rgba(148, 163, 184, 0.22));
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.access-tab.is-active {
  border-color: var(--accent, #1e6b4b);
  box-shadow: 0 0 0 1px var(--accent, #1e6b4b);
}

.access-tab:focus-visible {
  outline: 3px solid rgba(30, 107, 75, 0.45);
  outline-offset: 2px;
}

.access-perm-groups {
  display: grid;
  gap: 16px;
  margin: 12px 0;
  max-height: min(50vh, 420px);
  overflow-y: auto;
}

.access-perm-group {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--dialog-inner-border, rgba(0, 0, 0, 0.1));
  border-radius: 10px;
}

.access-perm-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.access-perm-item input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.access-perm-item__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.access-perm-item__title {
  font-size: 0.96rem;
  line-height: 1.3;
  color: var(--dialog-title, #f8fafc);
}

.access-perm-item__desc,
.access-perm-item small {
  display: block;
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.42;
}

.access-perm-readonly {
  margin: 12px 0 16px;
}

.access-user-dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.access-user-dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 28px);
  padding: 24px 28px 20px;
  overflow-y: auto;
}

.access-user-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-user-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.access-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.25);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.access-picker-item:hover,
.access-picker-item.is-selected {
  border-color: var(--accent, #1e6b4b);
  background: rgba(30, 107, 75, 0.16);
}

.access-picker-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.access-picker-item__main small {
  color: var(--muted, #94a3b8);
  font-size: 0.83rem;
}

.access-picker-item__role {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(30, 107, 75, 0.22);
  white-space: nowrap;
}

.access-user-card {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.28);
}

.access-user-card__name {
  font-weight: 700;
  font-size: 1.03rem;
  margin-bottom: 6px;
}

.access-user-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.9rem;
  color: var(--muted, #cbd5e1);
}

.access-what-box {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.24);
}

.access-what-box__title {
  font-weight: 700;
  font-size: 0.96rem;
  margin-bottom: 10px;
}

.access-what-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.access-what-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.access-what-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.access-what-list__name {
  font-weight: 600;
  font-size: 0.95rem;
}

.access-what-list__desc {
  color: var(--muted, #cbd5e1);
  font-size: 0.88rem;
  line-height: 1.4;
}

.access-what-box__foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.88rem;
  color: var(--muted, #cbd5e1);
}

.access-privileges-title {
  margin: 4px 0 8px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--dialog-title, #f8fafc);
}

.access-privileges-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.access-departments-dialog {
  width: min(520px, calc(100vw - 28px));
  max-width: min(520px, calc(100vw - 28px));
}

.access-departments-dialog form {
  padding: 22px 24px 18px;
}

.access-departments-list {
  margin: 0 0 16px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

.access-scope-box {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.26);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.access-scope-box__title {
  font-weight: 700;
  font-size: 0.96rem;
}

.access-scope-modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.access-scope-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.93rem;
}

.access-scope-depts-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-scope-depts-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.access-scope-depts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px 12px;
  max-height: 190px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.access-scope-dept-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.access-role-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.access-role-dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  padding: 24px 28px 20px;
  overflow: hidden;
}

.access-role-fields {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
  gap: 12px 20px;
  align-items: start;
}

.access-role-fields .form-field {
  margin-bottom: 0;
}

.access-role-dialog .access-perm-groups {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  min-height: 280px;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.access-role-dialog .personnel-dialog-actions {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  padding-top: 12px;
  background: var(--dialog-bg);
}

@media (max-width: 900px) {
  .access-role-fields {
    grid-template-columns: 1fr;
  }

  .access-role-dialog .access-perm-groups {
    grid-template-columns: 1fr;
    min-height: 200px;
  }}

.access-panel .card .table-wrap {
  margin: 0 -4px;
  overflow: visible;
}

.access-panel .card.table-wrap.access-roles-card,
.access-roles-card {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.access-roles-table {
  table-layout: fixed;
  min-width: 42rem;
}

.access-roles-table th,
.access-roles-table td {
  vertical-align: middle;
}

.access-roles-table th:nth-child(1),
.access-roles-table td:nth-child(1) {
  width: 13%;
}

.access-roles-table th:nth-child(2),
.access-roles-table td:nth-child(2) {
  width: 44%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}

.access-roles-table td:nth-child(2) {
  color: var(--muted, #64748b);
}

.access-roles-table th:nth-child(3),
.access-roles-table td:nth-child(3) {
  width: 7.5rem;
  min-width: 7.5rem;
  white-space: nowrap;
  text-align: center;
}

.access-roles-table th:nth-child(4),
.access-roles-table td:nth-child(4) {
  width: 6.75rem;
  min-width: 6.75rem;
  white-space: nowrap;
  text-align: center;
}

.access-roles-table .roles-col-actions {
  width: 11.5rem;
  min-width: 11.5rem;
  white-space: normal;
}

.access-roles-table td:nth-child(1) {
  white-space: normal;
  font-weight: 600;
  line-height: 1.35;
}

.access-roles-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  justify-content: flex-end;
  align-items: center;
}

.access-role-members-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent, #1e6b4b);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.access-role-members-link:hover {
  color: var(--accent-hover, #17563c);
}

.access-role-members-link:focus-visible {
  outline: 3px solid rgba(30, 107, 75, 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}

.access-history-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.access-history-table {
  min-width: 48rem;
}

.access-history-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 9rem;
}

.access-history-table td:nth-child(4),
.access-history-table td:nth-child(5),
.access-history-table td:nth-child(6) {
  white-space: pre-wrap;
  word-break: break-word;
}

.access-history-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

#access-history-error {
  margin: 8px 0;
}

.personnel-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

