/* Стили страницы «Доступ» (access.js). Общие компоненты — в css/panel.css. */

.acc-tabs { margin-bottom: 16px; }
.acc-pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.acc-muted { color: var(--color-text-2); }
.acc-name { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-login { overflow-wrap: anywhere; }
.acc-namecol { min-width: 220px; }

/* Шторка пользователя */
.acc-role-hint { margin: -8px 0 0; color: var(--color-text-2); font-size: 14px; line-height: 20px; }
.acc-role-hint:empty { display: none; }
.acc-emp-hint { margin: -8px 0 0; }
.acc-login-line { margin: 0; color: var(--color-text-2); }
.acc-modal-text { margin: 0; color: var(--color-text-2); }

/* Пароль, показанный один раз */
.acc-pass-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--color-surface-2); }
.acc-pass { flex: 1 1 180px; min-width: 0; font: 600 20px/28px var(--font-mono); letter-spacing: .04em; overflow-wrap: anywhere; user-select: all; }

/* Права ролей */
.acc-roles__body { min-width: 0; }
.acc-matrix-wrap { border-top: 1px solid var(--color-border); }
.acc-matrix { width: 100%; min-width: 940px; }
.acc-matrix thead th { white-space: nowrap; }
.acc-matrix th.acc-col-locked { color: var(--color-text-2); }
.acc-matrix tbody tr { height: auto; }
.acc-matrix td, .acc-matrix th.acc-sec { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.acc-matrix th.acc-sec { position: static; height: auto; text-align: left; font-weight: 400; white-space: normal; width: 34%; min-width: 220px; }
.acc-matrix td.acc-cell, .acc-matrix thead th:not(:first-child) { padding-left: 8px; padding-right: 8px; }
.acc-matrix .seg--sm button { padding: 0 8px; }
.acc-sec__name { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--color-text); }
.acc-sec__line { font-size: 13px; line-height: 18px; color: var(--color-text-2); }
.acc-sec__k { font-weight: 600; }
.acc-lock { color: var(--color-text-2); }
.acc-cell { white-space: nowrap; position: relative; }
.acc-fixed { display: inline-flex; align-items: center; gap: 6px; height: 32px; color: var(--color-text-2); }
.acc-cell.is-changed::before {
  content: ""; position: absolute; left: 4px; top: 24px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--color-accent);
}
.acc-legend { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px 0; color: var(--color-text-2); font-size: 13px; }
.acc-legend__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); flex: none; }
.acc-roles__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px; border-top: 1px solid var(--color-border); margin-top: 12px;
}
.acc-roles__foot .dirty[hidden] { display: none; }
.acc-roles__btns { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.acc-cell__role { display: none; }

/* <768: таблица прав превращается в карточки разделов, роль — подпись слева. */
@media (max-width: 767px) {
  .acc-matrix-wrap { overflow: visible; }
  .acc-matrix { min-width: 0; }
  .acc-matrix thead { display: none; }
  .acc-matrix, .acc-matrix tbody, .acc-matrix tr, .acc-matrix th.acc-sec { display: block; width: 100%; }
  .acc-matrix tr { padding: 12px 16px; border-bottom: 1px solid var(--color-border); }
  .acc-matrix th.acc-sec { max-width: none; min-width: 0; padding: 0 0 8px; border: 0; }
  .acc-matrix th.acc-sec, .acc-matrix td.acc-cell { height: auto; position: relative; }
  .acc-matrix tr > :first-child, .acc-matrix tr > :last-child { padding-left: 0; padding-right: 0; }
  .acc-matrix td.acc-cell:last-child { padding-left: 12px; }
  .acc-matrix .seg--sm button { padding: 0 6px; }
  .acc-matrix td.acc-cell {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 6px 0 6px 12px; border: 0; white-space: normal;
  }
  .acc-cell__role { display: block; flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 20px; overflow-wrap: normal; word-break: normal; hyphens: manual; }
  .acc-cell.is-changed::before { left: 0; top: 50%; margin-top: -3px; }
  .acc-matrix td .seg { flex: none; }
  .acc-roles__btns { width: 100%; }
  .acc-roles__btns .btn { flex: 1 1 auto; }
}

/* Точки пользователя: колонка таблицы и мультивыбор в шторке */
.acc-branchcol { max-width: 260px; }
.acc-branches { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.acc-branches-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.acc-branches-field .field__hint { margin: 0; }
.acc-branches-field.is-invalid .chip:not(:has(input:checked)) { border-color: var(--color-err); }
.acc-branch-chips .chip { max-width: 100%; }
.acc-branch-chips .chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
