/*
 * Phase 2 pages: Users, Roles, Data Access Policies, Organization Units,
 * Skills, User Templates, plus the shared editor layout, permission tree
 * and OU policy tree. Measurements from 003-014, 102-108, 113-115, 131-134
 * (800px captures of a ~1858px window, x2.32) and screenshots_2/_3.
 */

/* ---------------- Editor page (create / edit) ---------------- */
.page.editor { height: 100%; }
.editor__tabs { flex: 0 0 auto; margin-top: 6px; }
.editor__tabs .tabs { margin-bottom: 20px; }
/* The body scrolls with its scrollbar at the window edge (115) while title and Save stay put */
.editor__tabs + .editor__body { padding-top: 0; }
.editor__body { flex: 1; min-height: 0; overflow: auto; padding-top: 10px; margin-right: calc(-1 * var(--page-pad-x)); padding-right: var(--page-pad-x); padding-bottom: 12px; }
.editor__footer { flex: 0 0 auto; display: flex; gap: 5px; padding: 18px 0 62px; }
.editor .field { margin-bottom: 20px; }
.editor .field__label { margin-bottom: 9px; }
.editor-w { max-width: var(--editor-w); }
.editor-note { margin-top: 34px; max-width: var(--editor-w); }

/* ---------------- Filter card above list grids (003, 011, 133) ---------------- */
.filter-card { background: #fff; padding: 14px 23px 6px; margin-bottom: 12px; flex: 0 0 auto; }
.filter-card__search { height: 38px; }
.filter-card__adv { margin-top: 9px; padding-bottom: 9px; }
.filter-card__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.filter-card__row .input-wrap { height: 38px; }
.filter-card__check { margin-top: 16px; }
.filter-card__toggle { border: 0; background: none; padding: 13px 0 3px; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-base); color: var(--text-secondary); }
.filter-card__toggle:hover { color: var(--accent-text); }
.filter-card__toggle svg.i { width: 9px; height: 9px; }
.filter-card--perm { padding: 14px 23px 12px; margin-bottom: 10px; }
.filter-card__perm { width: 462px; }
.filter-card__perm .input-wrap { height: 38px; }
/* "Select A Permission" on Users has a grey square dropdown button (133) */
.select--btn-caret .input-wrap__caret { background: #EDEBE9; margin: 3px; width: 34px; border-radius: 2px; }
.page-body--card { padding-bottom: 38px; }

/* Users grid: read-only checkboxes sit under the middle of the header text (003) */
.grid__table td.users-check--confirm { padding-left: 40px; }
.grid__table td.users-check--active { padding-left: 18px; }

/* ---------------- Create new user: directory search (134) ---------------- */
.dir-search { max-width: var(--editor-w); }
.dir-search__bar { display: flex; gap: 12px; align-items: center; }
.dir-search__input { flex: 0 0 585px; width: 585px; height: 38px; border-color: #8A8886; }
.dir-search__bar .btn { min-width: 160px; }
.dir-search__results { margin-top: 18px; }
.dir-search__empty { color: var(--text-muted); padding: 12px 2px; }
.dir-list { background: #fff; }
.dir-list__item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--page-bg); cursor: pointer; }
.dir-list__item:hover { background: var(--row-hover); }
.dir-list__item.is-selected { background: var(--accent); color: #fff; }
.dir-list__item.is-selected .dir-list__mail, .dir-list__item.is-selected .dir-list__meta { color: #fff; }
.dir-list__main { flex: 1; min-width: 0; }
.dir-list__name { font-weight: 600; }
.dir-list__mail { font-size: 13px; color: var(--text-secondary); }
.dir-list__meta { font-size: 13px; color: var(--text-secondary); text-align: right; line-height: 18px; }

/* ---------------- Edit user ---------------- */
.user-info { max-width: 765px; }
.user-info .field { margin-bottom: 18px; }
.user-info .field__label { margin-bottom: 11px; }
.user-info .input { height: 38px; }
.user-info__top { display: flex; align-items: flex-start; gap: 46px; }
.user-info__pic { width: 139px; height: 139px; flex: 0 0 139px; margin: 8px 0 0 14px; background: #fff; display: flex; align-items: center; justify-content: center; }
.user-info__pic.is-clickable { cursor: pointer; }
.user-info__pic img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
svg.i.user-info__placeholder { width: 120px; height: 120px; }
.user-info__names { flex: 1; }
.user-info__ad { display: flex; align-items: center; gap: 6px; margin: -4px 0 22px; }
.user-info__ad svg.i { width: 17px; height: 17px; }
.user-info__checks { display: flex; flex-direction: column; gap: 14px; margin-top: -4px; }

.role-list { display: flex; flex-direction: column; gap: 15px; padding: 2px 0 0 1px; }

.queue-list { max-width: var(--editor-w); }
.queue-list__item { min-height: 46px; display: flex; align-items: center; padding-left: 10px; border-bottom: 1px solid #E1DFDD; }
.queue-list__item:last-child { border-bottom: 0; }

.skill-list { max-width: var(--editor-w); padding-top: 14px; }
.skill-list__cat + .skill-list__cat { margin-top: 18px; }
.skill-list__title { font-weight: 600; font-size: 16px; margin: 2px 0 8px; }
.skill-list__row { display: flex; align-items: center; height: 52px; }
.skill-list__check { width: 191px; flex: 0 0 191px; }
.skill-list__level { width: 133px; flex: 0 0 133px; height: 37px; }

/* OU tree with policy dropdowns (009, 115) */
.outree { max-width: 768px; }
.outree__row { display: flex; align-items: center; min-height: 42px; padding-left: calc(var(--depth) * 17px); }
.outree__caret { width: 40px; flex: 0 0 40px; display: inline-flex; justify-content: center; padding-left: 7px; }
.outree__caret-btn { border: 0; background: none; padding: 4px; color: #323130; display: inline-flex; }
.outree__caret-btn svg.i { width: 9px; height: 9px; }
.outree__icon { width: 30px; flex: 0 0 30px; display: inline-flex; }
.outree__name { flex: 1; min-width: 0; line-height: 19px; padding: 4px 12px 4px 0; }
.outree__select { width: 327px; flex: 0 0 327px; }
.outree__select .input-wrap { height: 30px; }
.outree__select .select__value { font-size: 14px; }
svg.i.ou-icon { width: 22px; height: 18px; }
svg.i.ou-icon--entity { color: #2E7D52; width: 20px; height: 17px; }

/* ---------------- Permission tree (014, 108, 132, screenshots_3) ---------------- */
.ptree { max-width: var(--editor-w); padding-top: 4px; }
.ptree__search { display: block; width: 100%; height: 35px; border: 1px solid #fff; background: #fff; padding: 0 10px; font-size: 14px; outline: none; border-radius: 2px; margin-bottom: 15px; }
.ptree__search:focus { border-color: var(--accent); }
.ptree__search::placeholder { color: var(--text-muted); }
.ptree__panel { background: #fff; overflow: auto; padding: 16px 12px 16px 27px; }
.ptree__row { display: flex; align-items: center; height: 38px; }
.ptree__toggle { width: 18px; flex: 0 0 18px; margin-right: 9px; display: inline-flex; align-items: center; justify-content: center; color: #7E8299; }
.ptree__toggle[data-toggle] { cursor: pointer; }
.ptree__toggle svg.i { width: 15px; height: 15px; }
.ptree__node { flex: 1; min-width: 0; display: inline-flex; align-items: center; height: 32px; padding: 0 8px 0 0; border-radius: 3px; cursor: pointer; }
.ptree__node:hover { background: #F3F2F1; }
.ptree__check { width: 20px; height: 20px; flex: 0 0 20px; border: 1px solid #D1D5DB; border-radius: 4px; background: #fff; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.ptree__check svg.i { width: 14px; height: 14px; visibility: hidden; }
.ptree__check.is-checked { background: var(--tree-check); border-color: var(--tree-check); }
.ptree__check.is-checked svg.i { visibility: visible; }
.ptree__icon { display: inline-flex; margin: 0 9px 0 3px; }
.ptree__icon svg.i { width: 17px; height: 14px; }
.ptree__label { white-space: nowrap; color: #3F4254; }
.ptree__empty { color: var(--text-muted); padding: 10px 4px; }

.role-default { margin-top: 0; }
.role-default__hint { margin-top: 16px; font-size: 14px; }

/* Users > Permissions dialog (132) */
.modal-wrap:has(.modal--perm) { padding-top: 28px; }
.modal--perm { width: 883px; }
.modal--perm .modal__body { padding: 14px 22px 0; }
.perm-dialog .ptree { max-width: none; padding-top: 0; }
.perm-dialog .ptree__search { border-color: #E1DFDD; margin-bottom: 8px; }
.perm-dialog .ptree__panel { padding-left: 30px; }
.perm-dialog__note { font-style: italic; font-size: 14.5px; line-height: 23px; color: #3F4254; margin: 10px 0 0; }

/* Message box icons (ui.alert) */
.confirm__icon--error { border-color: #F27474; color: #F27474; font-size: 46px; }
.confirm__icon--info { border-color: #9DE0F6; color: #3FC3EE; font-size: 34px; font-weight: 600; }

/* ---------------- Organization Units (104-106) ---------------- */
.ou-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-bottom: 38px; }
.ou-tree-card { background: #fff; display: flex; flex-direction: column; min-height: 0; }
.ou-tree-card .grid__toolbar { flex: 0 0 50px; }
.ou-tree-scroll { flex: 1; min-height: 0; overflow: auto; }
.ou-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.ou-table th { position: sticky; top: 0; z-index: 1; height: 40px; padding: 0 8px 6px; vertical-align: bottom; text-align: left; font-weight: 400; font-size: 13.5px;
  color: var(--text-secondary); background: #fff; border-bottom: 1px solid var(--grid-line); border-right: 1px solid var(--grid-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ou-table td { height: 43px; padding: 0 8px; border-bottom: 1px solid #EDEBE9; border-right: 1px solid var(--grid-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ou-table th:last-child, .ou-table td:last-child { border-right: 0; }
.ou-table .al-right { text-align: right; }
.ou-row { cursor: default; }
.ou-row:hover td { background: var(--row-hover); }
.ou-row.is-selected td { background: var(--accent); color: #fff; }
.ou-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ou-name__text { overflow: hidden; text-overflow: ellipsis; }
.ou-caret { width: 14px; flex: 0 0 14px; display: inline-flex; }
.ou-caret-btn { border: 0; background: none; padding: 0; color: inherit; display: inline-flex; }
.ou-caret-btn svg.i { width: 9px; height: 9px; }
.ou-row.is-selected svg.i.ou-icon--entity { color: #fff; }

.ou-detail { display: none; }
.ou-detail.is-open { display: flex; flex-direction: column; background: #fff; min-height: 0; }
.ou-detail__head { padding: 16px 16px 12px; }
.ou-detail__label { font-weight: 600; }
.ou-policy { position: relative; margin: 0 12px 12px; border: 1px solid #E1DFDD; padding: 12px 14px 14px; font-size: 14px; line-height: 23px; }
.ou-policy__label { margin-right: 4px; }
.ou-policy__edit { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border: 1px solid #E1DFDD; border-radius: 2px; background: #fff; color: #323130;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.ou-policy__edit:hover { background: #F3F2F1; }
.ou-policy__sub { margin: 12px 0 4px 10px; }
.ou-policy__list { margin-left: 22px; }
.ou-members { flex: 1; display: flex; flex-direction: column; min-height: 220px; }
.ou-members .grid__toolbar { flex: 0 0 50px; }
.ou-members__right { margin-left: auto; display: flex; gap: 2px; }
.ou-members__scroll { flex: 1; min-height: 0; overflow: auto; }
.ou-members__table td { height: 41px; }
.ou-members__table th { font-size: 13px; padding-left: 6px; padding-right: 4px; }
.ou-del-btn { width: 30px; height: 30px; border: 1px solid #E1DFDD; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); border-radius: 2px; background: #fff; color: #323130; display: inline-flex; align-items: center; justify-content: center; }
.ou-del-btn:hover { background: #F3F2F1; }
.ou-del-btn svg.i { width: 16px; height: 16px; }
.ou-cell-edit { cursor: pointer; }
.ou-members__table td.is-modified { background: rgba(92, 184, 92, 0.2); }
.ou-members__table tr.is-removed td { color: var(--text-disabled); text-decoration: line-through; }
.ou-members__table tr.is-inserted td { background: #F6FBF3; }
.ou-members__table tr.is-inherited td { color: var(--text-secondary); }
.ou-members__table td .select { margin: 0 -4px; }

/* ---------------- Skills (102, 103) ---------------- */
.skills-card { padding: 35px 37px; margin-top: 8px; }
.page-header .btn.btn--wide { padding: 0 25px; }
.skill-cards { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.skill-cat { width: 388px; border: 1px solid #EDEBE9; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
.skill-cat__head { display: flex; align-items: center; height: 51px; padding: 0 10px 0 14px; background: #FAF9F8; border-bottom: 1px solid #EDEBE9; }
.skill-cat__name { flex: 1; font-size: 18px; }
.skill-cat__btn { border: 0; background: none; width: 34px; height: 34px; color: #A19F9D; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; }
.skill-cat__btn:hover { background: #EDEBE9; color: var(--text); }
.skill-cat__body { padding: 9px 14px 14px; }
.skill-cat__desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.skill-cat__skill { margin-bottom: 8px; }
.skill-cat__skill-name { font-size: 14.5px; color: #484644; line-height: 20px; }
.skill-cat__skill-desc { font-size: 12px; color: #605E5C; padding-left: 4px; line-height: 17px; }

.skills-edit { background: #fff; height: 588px; display: flex; flex-direction: column; margin-top: 8px; }
.skills-edit__toolbar { flex: 0 0 50px; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; background: var(--band-bg); border-bottom: 1px solid var(--grid-line); }
.btn.skills-edit__add { min-width: 0; height: 34px; padding: 0 12px; font-weight: 400; color: var(--text); border-color: #E1DFDD; }
.btn.skills-edit__add svg.i { width: 18px; height: 18px; }
.skills-edit__scroll { flex: 1; min-height: 0; overflow: auto; }
.skills-edit__table td { padding: 0 4px; }
.cell-input { width: 100%; height: 32px; border: 1px solid transparent; background: transparent; padding: 0 4px; font-size: 15px; outline: none; border-radius: 2px; text-overflow: ellipsis; }
.cell-input:hover { border-color: #EDEBE9; }
.cell-input:focus { border-color: var(--accent); background: #fff; }

/* ---------------- User Templates (113-115) ---------------- */
.ut-form { max-width: var(--editor-w); }
.editor--ut .editor__footer { padding-bottom: 32px; }
.ut-row { display: grid; grid-template-columns: 1fr 52px; gap: 10px; margin-bottom: 20px; }
.ut-row__enabled { display: flex; flex-direction: column; align-items: center; }
.ut-row__enabled .field__label { margin-bottom: 9px; }
.ut-row__main .field__label { margin-bottom: 9px; }
.ut-row .outree__select { width: 280px; flex-basis: 280px; }

.apply-tpl__intro { margin-bottom: 12px; }
.apply-tpl__search { margin-bottom: 12px; }
.dual { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 10px; align-items: stretch; margin-bottom: 8px; }
.dual__col { border: 1px solid #E1DFDD; display: flex; flex-direction: column; min-width: 0; }
.dual__head { padding: 9px 12px; background: var(--band-bg); border-bottom: 1px solid #E1DFDD; font-size: 13.5px; color: var(--text-secondary); }
.dual__list { height: 380px; overflow: auto; }
.dual__item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid #F3F2F1; cursor: pointer; user-select: none; }
.dual__item:hover { background: var(--row-hover); }
.dual__item.is-marked { background: var(--accent); color: #fff; }
.dual__item.is-marked .dual__sub { color: #fff; }
.dual__text { display: flex; flex-direction: column; min-width: 0; }
.dual__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dual__sub { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dual__empty { padding: 14px 12px; color: var(--text-muted); }
.dual__moves { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.btn.dual__btn { min-width: 0; width: 56px; padding: 0; }
.avatar--group { background: #8B8CC7; }
.avatar--group svg.i { width: 16px; height: 16px; }
.apply-tpl__review { margin-bottom: 10px; }
