/* Settings (settings-ui.js): a side menu of sections, one section at a time, and the permission matrix of
   «Оролцогчид ба эрх» (navigation-ui.js). On a phone the menu becomes a scrolling row of buttons. */
.settings-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:28px;align-items:start}
.settings-nav{position:sticky;top:96px;display:flex;flex-direction:column;gap:2px;max-height:calc(100vh - 116px);overflow-y:auto}
.settings-nav h1{margin:0 12px 4px;font-size:26px;color:var(--navy)}
.settings-nav-group{display:flex;flex-direction:column;gap:2px}
.settings-nav-group h2{margin:14px 12px 4px;font-size:11px;font-weight:700;letter-spacing:.1em;color:#5f6d80}
.settings-nav a{display:grid;gap:1px;padding:9px 12px;border-radius:10px;color:var(--ink);text-decoration:none}
.settings-nav a b{font-size:14px;font-weight:600}
.settings-nav a span{font-size:12px;color:#5f6d80}
.settings-nav a em{justify-self:start;margin-top:3px;padding:2px 8px;border-radius:999px;background:#fff1e6;color:#a1460a;font-size:11px;font-style:normal;font-weight:700}
.settings-nav a:hover{background:#eef2f6}
.settings-nav a.active{background:#fff;box-shadow:0 1px 4px #102d4f1f,inset 3px 0 0 var(--orange)}
.settings-nav a:focus-visible{outline:3px solid var(--orange);outline-offset:1px}
.settings-section{min-width:0;display:grid;gap:18px;align-content:start}
.settings-section>.panel,.settings-section>article{margin:0}
/* Permission matrix */
.perm-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px;padding:0 22px}
.perm-head .menu-project-label{flex:0 1 320px;margin:0}
.perm-tabs{display:flex;gap:4px;margin-top:14px;padding:0 22px;border-bottom:1px solid var(--border);overflow-x:auto}
.perm-tabs button{min-height:44px;padding:0 14px;border:0;border-bottom:3px solid transparent;background:none;font:inherit;font-size:14px;font-weight:600;color:#5f6d80;cursor:pointer;white-space:nowrap}
.perm-tabs button[aria-selected=true]{border-bottom-color:var(--orange);color:var(--navy);font-weight:700}
.perm-legend{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-bottom:14px;font-size:13px;color:#3b4a5c}
.perm-legend>span{display:inline-flex;align-items:center;gap:7px}
.perm-legend .perm-cell{width:26px;height:22px;margin:0}
.perm-cell{position:relative;display:flex;align-items:center;justify-content:center;width:30px;height:28px;margin:0 auto;border-radius:7px}
.perm-cell svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.perm-cell.lv-n{background:#f1f4f8;color:#8a97a8}.perm-cell.lv-o{background:#f3eefc;color:#6b3fb5}.perm-cell.lv-v{background:#eaf2fd;color:#1f56b0}.perm-cell.lv-e{background:#fff1e6;color:#b14f0b}.perm-cell.lv-a{background:#e6f4ec;color:#1b6b56}
.perm-cell.is-custom:after,.perm-dot{content:'';width:9px;height:9px;border-radius:50%;background:var(--orange);border:2px solid #fff;box-sizing:content-box}
.perm-cell.is-custom:after{position:absolute;top:-4px;right:-4px}
.perm-dot{display:inline-block}
/* Editable cells (5.68.0): a project lead clicks one to set that role's level for the project. A ring marks a
   level changed from the role's default. */
button.perm-cell{padding:0;border:0;font:inherit;cursor:pointer;transition:box-shadow .15s,transform .15s}
.perm-cell.is-editable:hover{box-shadow:0 0 0 2px #c7d2df;transform:scale(1.06)}
.perm-cell.is-editable:focus-visible{outline:3px solid var(--orange);outline-offset:2px}
.perm-cell.is-changed{box-shadow:inset 0 0 0 2px currentColor}
.perm-cell.is-changed.is-editable:hover{box-shadow:inset 0 0 0 2px currentColor,0 0 0 2px #c7d2df}
.perm-edit-hint{margin:-4px 0 14px;font-size:12px}
.perm-changes{display:grid;gap:8px;justify-items:start;padding:10px 12px;border-radius:10px;background:#fff7ef;font-size:13px;line-height:1.5}
.perm-changes p{margin:0}
.perm-edit-head{display:grid;gap:2px;margin-bottom:16px}
.perm-edit-head b{font-size:15px;color:var(--navy)}
.perm-edit-head p{margin:0;font-size:13px}
.perm-options{display:grid;gap:8px;margin:0 0 6px;padding:0;border:0}
.perm-options legend{margin-bottom:8px;padding:0;font-size:12px;font-weight:700}
.modal-body .perm-options label{display:flex;align-items:center;gap:12px;margin:0;padding:10px 12px;border:1px solid var(--border);border-radius:10px;cursor:pointer}
.perm-options label:has(input:checked){border-color:var(--orange);background:#fff7ef}
.perm-options input{flex:0 0 18px;width:18px;height:18px;margin:0;padding:0;accent-color:var(--orange)}
.perm-options .perm-cell{flex:0 0 auto;margin:0}
.perm-options b{display:block;font-size:14px}
.perm-options small{display:block;font-size:12px;font-weight:500;color:#5f6d80}
/* One person's levels (5.69.0): a row per module with the role's level and a choice. */
.perm-own-note{margin:8px 0 0;color:#a1460a}
.perm-person-tools{display:flex;justify-content:flex-end;margin:4px 0 6px}
.perm-person-list{display:grid;border-top:1px solid #edf1f5}
.modal-body .perm-person-row{display:grid;grid-template-columns:auto minmax(0,1fr) 150px;align-items:center;gap:12px;margin:0;padding:8px 0;border-bottom:1px solid #edf1f5;font-weight:500}
.perm-person-row .perm-cell{margin:0}
.perm-person-name b{display:block;font-size:14px;font-weight:600}
.perm-person-name small{display:block;font-size:12px;color:#5f6d80}
.perm-person-row select{min-height:40px;padding:8px 10px;font-size:14px}
@media(max-width:520px){.modal-body .perm-person-row{grid-template-columns:auto minmax(0,1fr) 152px;gap:8px}.perm-person-row select{padding:8px 6px;font-size:16px}}
.perm-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:18px;align-items:start}
.perm-table-wrap{min-width:0;overflow-x:auto;border:1px solid var(--border);border-radius:12px;background:#fff}
.perm-table{width:100%;min-width:740px;border-collapse:collapse}
.perm-table thead th{padding:10px 2px;background:#fafbfd;font-size:11px;font-weight:600;line-height:1.25;color:#4b5d73;text-align:center;vertical-align:bottom}
.perm-table thead th:first-child{padding-left:14px;text-align:left;font-size:12px;font-weight:700}
/* Module names stand upright so that all fifteen columns fit beside the role names. */
.perm-table thead th:not(:first-child){width:36px;padding:10px 0 8px}
.perm-table thead th:not(:first-child) span{display:inline-block;max-height:132px;writing-mode:vertical-rl;transform:rotate(180deg);white-space:nowrap;text-align:left}
.perm-table tbody th,.perm-table td{padding:5px 2px;border-top:1px solid #edf1f5}
.perm-table tbody th{position:sticky;left:0;z-index:1;min-width:150px;padding:4px 8px;background:#fff;text-align:left}
.perm-table tbody th b{display:block;font-size:14px;color:var(--ink)}
.perm-table tbody th small{display:block;font-size:12px;font-weight:500;color:#5f6d80}
.perm-table tr.is-selected th,.perm-table tr.is-selected td{background:#fff7ef}
.perm-table tr.is-empty .perm-role b{color:#5f6d80}
.perm-role{display:block;width:100%;min-height:44px;padding:4px 6px;border:0;border-radius:8px;background:none;font:inherit;text-align:left;white-space:normal;cursor:pointer}
.perm-role:hover{background:#eef2f6}
.perm-role:focus-visible{outline:3px solid var(--orange);outline-offset:1px}
.perm-detail{display:grid;gap:12px;padding:18px;border:1px solid var(--border);border-radius:12px;background:#fff}
.perm-detail h3{margin:0;font-size:19px;color:var(--navy)}
.perm-detail>.muted{margin:-8px 0 0;font-size:13px}
.perm-levels{display:grid;gap:8px;font-size:13px;line-height:1.5}
.perm-levels p{margin:0}
.lv-text-a{color:#1b6b56}.lv-text-e{color:#a1460a}.lv-text-o{color:#6b3fb5}.lv-text-v{color:#1f56b0}.lv-text-n{color:#5f6d80}
.perm-people{display:grid;gap:0;margin:0;padding:0;list-style:none;border-top:1px solid #edf1f5}
.perm-people li{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:10px 0;border-bottom:1px solid #edf1f5}
.perm-people b{display:block;font-size:14px}
.perm-people small{display:block;font-size:12px;color:#5f6d80}
.perm-change{color:#a1460a}
.perm-detail .form-hint{margin:0}
@media(min-width:1680px){.perm-layout{grid-template-columns:minmax(0,1fr) 320px}}
.perm-detail{grid-template-columns:repeat(auto-fit,minmax(260px,1fr));align-items:start}
.perm-detail>.eyebrow,.perm-detail>h3,.perm-detail>.muted,.perm-detail>.form-hint{grid-column:1/-1}
@media(min-width:1680px){.perm-detail{grid-template-columns:minmax(0,1fr)}}
@media(max-width:900px){
 .settings-layout{grid-template-columns:minmax(0,1fr);gap:16px}
 .settings-nav{position:static;max-height:none;flex-direction:row;flex-wrap:nowrap;gap:6px;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:4px}
 .settings-nav h1{display:none}
 .settings-nav-group{flex-direction:row;gap:6px}
 .settings-nav-group h2,.settings-nav a span{display:none}
 .settings-nav a{flex:0 0 auto;min-height:44px;align-content:center;padding:0 14px;border:1px solid var(--border);border-radius:999px;background:#fff;white-space:nowrap}
 .settings-nav a em{display:none}
 .settings-nav a.active{border-color:var(--navy);background:var(--navy);box-shadow:none}
 .settings-nav a.active b{color:#fff}
 .perm-head,.perm-tabs{padding-left:16px;padding-right:16px}
 /* The role column stays narrow (long role names wrap) so that more cells fit beside it. */
 .perm-table{min-width:664px}
 .perm-table tbody th{width:124px;min-width:124px;max-width:124px}
 .perm-table tbody th b{font-size:13px}
}
