/* «Пользователи» → «Роли и права» (js/roles.js) */

.roles-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.roles-hint { font-size: 12px; color: var(--text3); max-width: 640px; }
.roles-new, .roles-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
  padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); }
.roles-new .auth-inp, .roles-confirm .auth-inp { width: auto; min-width: 240px; margin: 0; }
.roles-confirm-text { font-size: 13px; color: var(--text); }
#panel-users #roles-err.show { display: block; }

.roles-scroller { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--border); border-radius: var(--radius); }
.roles-table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.roles-table th, .roles-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; vertical-align: middle; }
/* Шапка «липкая» целиком (thead), а не по клеткам: иначе при прокрутке закреплённый
   левый столбец строк наезжает на угол шапки. */
.roles-table thead { position: sticky; top: 0; z-index: 10; }
.roles-table thead th { position: static; background: var(--bg3); }
.roles-action-th, .roles-action { position: sticky; left: 0; z-index: 1; background: var(--bg2); min-width: 260px; max-width: 320px; }
.roles-table thead .roles-action-th { position: sticky; left: 0; top: auto; z-index: 11; background: var(--bg3); }
.roles-action { font-size: 12px; color: var(--text); }
.roles-note { font-size: 10px; color: var(--text3); margin-top: 2px; }
.roles-role-th { min-width: 118px; text-align: center; }
.roles-role-name { font-size: 12px; font-weight: 700; color: var(--text); }
.roles-role-meta { font-size: 10px; color: var(--text3); font-weight: 400; }
.roles-th-tools { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.roles-th-btn { font-size: 10px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg2);
  color: var(--text2); cursor: pointer; }
.roles-th-btn.danger { color: var(--red-text); border-color: var(--red-border); }
.roles-th-note { font-size: 10px; color: var(--text3); }
.roles-section td { background: var(--bg3); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text3); }
.roles-section-label { position: sticky; left: 8px; }
.roles-cell { text-align: center; }
.roles-cell.changed { background: var(--accent-glow); }
.roles-select { font-size: 11px; padding: 3px 4px; border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); cursor: pointer; min-width: 96px; }
.roles-select.lvl-edit, .roles-lvl.lvl-edit { color: var(--green-text, #16a34a); font-weight: 600; }
.roles-select.lvl-view, .roles-lvl.lvl-view { color: var(--accent); }
.roles-select.lvl-own, .roles-lvl.lvl-own { color: var(--amber-text, #b45309); }
.roles-select.lvl-none, .roles-lvl.lvl-none { color: var(--text3); }
.roles-lvl { font-size: 11px; }
.roles-cell.fixed .roles-lvl.lvl-none { font-size: 10px; }

/* «Просмотр как роль» (js/view-as.js) */
.va-open-btn { min-height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--amber); background: var(--amber-bg);
  color: var(--amber-text); font-size: 12px; font-weight: 600; cursor: pointer; }
#view-as-modal { display: none; position: fixed; inset: 0; z-index: 100001; background: rgba(0, 0, 0, 0.7); align-items: center; justify-content: center; padding: 16px; }
#view-as-modal > div { width: 100%; max-width: 480px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); }
#view-as-modal h3 { margin: 0; font-size: 17px; }
#view-as-modal .auth-err.show { display: block; }
.va-roles { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.va-role { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); cursor: pointer; }
.va-role:has(input:checked) { border-color: var(--amber); background: var(--amber-bg); }
.va-role input { width: 18px; height: 18px; accent-color: var(--amber); }
.va-role-name { flex-grow: 1; color: var(--text); }
.va-role-count { font-size: 12px; color: var(--text2); }
.va-points { margin: 0; padding: 10px 12px 10px 28px; border-radius: 8px; background: var(--bg3); color: var(--text2); font-size: 12px; }
.va-start-btn { min-height: 36px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--amber); background: #b45309; color: #fff; font-weight: 600; cursor: pointer; }

#view-as-bar { display: none; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 44px; box-sizing: border-box; padding: 6px 16px;
  background: #78350f; border-bottom: 1px solid #f59e0b; color: #fef3c7; font-size: 13px; }
#view-as-bar .va-note { flex: 1 1 200px; color: #fde68a; }
#view-as-bar .va-exit { min-height: 32px; padding: 0 14px; border-radius: 6px; border: 1px solid #fde68a; background: #fef3c7; color: #78350f; font-weight: 700; cursor: pointer; }
body.view-as #view-as-bar { display: flex; }
body.view-as .app { height: calc(100vh - 44px); box-shadow: inset 0 0 0 3px #f59e0b; }
body.view-as [data-perm] { cursor: not-allowed !important; outline: 1px dashed #f59e0b; outline-offset: 1px; }
body.view-as button[data-perm]::before, body.view-as a[data-perm]::before { content: "🔒 "; }
