/* =====================================================================
   iOS 26 permissions sheet — Settings → Roles → a role
   (app/Views/roles/permissions.php, scoped to .nz-perm26)
   ---------------------------------------------------------------------
   Category tabs + search + an index of modules and Apps on the left, the
   chosen one on the right as an inset grouped list with iOS switches.
   The index and the pane scroll on their own (the view sets the height),
   so finding one App among 30 never means scrolling the whole page.
   Colours come from the --ios26-* tokens (assets/css/ios26-tokens.css),
   which already carry the dark values under body.color-1E202D.
   ===================================================================== */

.nz-perm26 {
    --nz-perm-cell: #fff;
    --nz-perm-switch-off: rgba(120, 120, 128, .28);
    --nz-perm-switch-on: #34c759;
    --nz-perm-warn: #a35400;
    --nz-perm-index-w: 270px;
}

body.color-1E202D .nz-perm26 {
    --nz-perm-cell: rgba(255, 255, 255, .035);
    --nz-perm-switch-off: rgba(120, 120, 128, .42);
    --nz-perm-switch-on: #30d158;
    --nz-perm-warn: #ffb340;
}

.nz-perm26 .nz-perm-card {
    margin-bottom: 0;
    overflow: hidden;
}

/* ---------- tabs: the standard strip, only a count added ---------- */

.nz-perm26 .nz-perm-tab-count {
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ios26-muted);
}

/* eight filters share the strip: a little less air per tab so they fit a laptop screen */
.nz-perm26 .nav-tabs.nz-perm-tabs li a.nz-perm-tab {
    padding-left: 11px !important;
    padding-right: 11px !important;
}

.nz-perm26 .nz-perm-tab.nz-perm-tab-empty {
    opacity: .5;
}

/* ---------- toolbar: title, total, search ---------- */

.nz-perm26 .nz-perm-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 20px;
    padding: 18px 20px 16px;
}

.nz-perm26 .nz-perm-heading {
    flex: 1 1 260px;
    min-width: 0;
}

.nz-perm26 .nz-perm-heading h4 {
    margin: 0 0 3px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ios26-text);
}

.nz-perm26 .nz-perm-heading h4 span {
    color: var(--ios26-accent-strong);
}

body.color-1E202D .nz-perm26 .nz-perm-heading h4 span {
    color: #9fb0ff;
}

.nz-perm26 .nz-perm-heading p {
    margin: 0;
    font-size: 13px;
}

body.color-1E202D .nz-perm26 .nz-perm-heading p {
    color: var(--ios26-muted) !important;
}

.nz-perm26 .nz-perm-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

.nz-perm26 .nz-perm-total-value {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ios26-text);
}

.nz-perm26 .nz-perm-total-label {
    font-size: 12px;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-search {
    position: relative;
    flex: 0 1 340px;
    min-width: 220px;
}

.nz-perm26 .nz-perm-search > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ios26-muted);
    pointer-events: none;
}

.nz-perm26 .nz-perm-search input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 36px;
    border: 1px solid transparent;
    border-radius: var(--ios26-pill);
    background: var(--ios26-fill);
    color: var(--ios26-text);
    font-size: 14px;
    outline: none;
    transition: background .2s var(--ios26-ease), border-color .2s var(--ios26-ease), box-shadow .2s var(--ios26-ease);
}

.nz-perm26 .nz-perm-search input::placeholder {
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.nz-perm26 .nz-perm-search input:focus {
    background: var(--nz-perm-cell);
    border-color: var(--ios26-accent);
    box-shadow: 0 0 0 4px var(--ios26-accent-ring);
}

.nz-perm26 .nz-perm-search-key {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 20px;
    padding: 1px 6px;
    border: 1px solid var(--ios26-hairline-strong);
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    font: 600 11px/16px ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
    color: var(--ios26-muted);
    pointer-events: none;
}

.nz-perm26 .nz-perm-search input:focus ~ .nz-perm-search-key {
    display: none;
}

.nz-perm26 .nz-perm-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: none;
    padding: 4px 6px;
    color: var(--ios26-muted);
    cursor: pointer;
}

/* ---------- body: index | pane ---------- */

.nz-perm26 .nz-perm-body {
    display: grid;
    grid-template-columns: var(--nz-perm-index-w) minmax(0, 1fr);
    min-height: 420px;
    border-top: 1px solid var(--ios26-hairline);
}

.nz-perm26 .nz-perm-index {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 10px 18px;
    border-right: 1px solid var(--ios26-hairline);
    background: var(--ios26-fill);
}

body.color-1E202D .nz-perm26 .nz-perm-index {
    background: rgba(0, 0, 0, .12);
}

.nz-perm26 .nz-perm-index-group {
    padding: 14px 10px 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-index-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 1px 0;
    border-radius: var(--ios26-radius-sm);
    color: var(--ios26-text);
    text-decoration: none;
    transition: background .15s var(--ios26-ease);
}

/* the dark theme paints every a:hover/a:focus blue with !important */
.nz-perm26 a.nz-perm-index-row,
.nz-perm26 a.nz-perm-index-row:hover,
.nz-perm26 a.nz-perm-index-row:focus,
.nz-perm26 a.nz-perm-index-row:active {
    color: var(--ios26-text) !important;
}

.nz-perm26 .nz-perm-index-row:hover {
    background: var(--ios26-fill-hover);
}

.nz-perm26 a.nz-perm-index-row:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--ios26-accent);
}

.nz-perm26 .nz-perm-index-row.active {
    background: var(--ios26-accent-soft);
    box-shadow: inset 0 0 0 1px var(--ios26-accent-ring);
}

.nz-perm26 .nz-perm-index-row.active .nz-perm-index-name {
    font-weight: 600;
}

.nz-perm26 .nz-perm-index-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

/* a section with changes not saved yet */
.nz-perm26 .nz-perm-index-row.is-dirty .nz-perm-index-name::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 50%;
    background: #ff9f0a;
}

.nz-perm26 .nz-perm-index-meta {
    flex: none;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-index-meta.is-on,
.nz-perm26 .nz-perm-index-meta.is-match {
    color: var(--ios26-accent-strong);
    font-weight: 600;
}

body.color-1E202D .nz-perm26 .nz-perm-index-meta.is-on,
body.color-1E202D .nz-perm26 .nz-perm-index-meta.is-match {
    color: #9fb0ff;
}

.nz-perm26 .nz-perm-index-meta.is-limited {
    color: var(--nz-perm-warn);
    font-weight: 600;
}

/* iOS Settings style icon tiles, one colour per category */
.nz-perm26 .nz-perm-tile {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    background: #7c7c84;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.nz-perm26 .nz-perm-tile svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

.nz-perm26 .nz-perm-tile.nz-cat-all { background: #636366; }
.nz-perm26 .nz-perm-tile.nz-cat-work { background: #3d74e6; }
.nz-perm26 .nz-perm-tile.nz-cat-sales { background: #d9700f; }
.nz-perm26 .nz-perm-tile.nz-cat-finance { background: #248a3d; }
.nz-perm26 .nz-perm-tile.nz-cat-team { background: #9b51e0; }
.nz-perm26 .nz-perm-tile.nz-cat-communication { background: #1a8aa3; }
.nz-perm26 .nz-perm-tile.nz-cat-admin { background: #6c6c74; }
.nz-perm26 .nz-perm-tile.nz-cat-apps { background: #5856d6; }

/* ---------- pane ---------- */

.nz-perm26 .nz-perm-pane {
    position: relative;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 24px 28px;
}

.nz-perm26 .nz-perm-back {
    display: none;
}

.nz-perm26 .permission-list.nz-perm-list {
    margin: 0;
    padding: 0;
}

.nz-perm26 .permission-list li {
    margin: 0;
    padding: 0;
    border: 0 !important;
    list-style: none;
}

.nz-perm26 .nz-perm-list > li.nz-perm-section {
    display: none;
}

.nz-perm26 .nz-perm-list > li.nz-perm-section.is-shown {
    display: block;
    margin-bottom: 30px;
    animation: nz-perm-in .22s var(--ios26-ease);
}

@keyframes nz-perm-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .nz-perm26 .nz-perm-list > li.nz-perm-section.is-shown { animation: none; }
    .nz-perm26 .nz-perm-row > input[type=checkbox]::before { transition: none !important; }
}

.nz-perm26 .nz-perm-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
}

.nz-perm26 .nz-perm-head .nz-perm-tile {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 17px;
}

.nz-perm26 .nz-perm-head .nz-perm-tile svg {
    width: 18px;
    height: 18px;
}

.nz-perm26 .nz-perm-head-text {
    flex: 1 1 auto;
    min-width: 0;
}

.nz-perm26 .nz-perm-head h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ios26-text);
}

.nz-perm26 .nz-perm-pill {
    flex: none;
    padding: 4px 10px;
    border-radius: var(--ios26-pill);
    font-size: 12px;
    font-weight: 600;
    background: var(--ios26-fill);
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-pill.is-on {
    background: rgba(52, 199, 89, .14);
    color: #1d7a35;
}

body.color-1E202D .nz-perm26 .nz-perm-pill.is-on {
    background: rgba(48, 209, 88, .16);
    color: #6be38b;
}

.nz-perm26 .nz-perm-pill.is-limited {
    background: rgba(255, 159, 10, .14);
    color: var(--nz-perm-warn);
}

/* the question each block answers, iOS footnote-style above its group */
.nz-perm26 h5.nz-perm-caption {
    display: block;
    margin: 0 0 7px 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-app-body {
    margin: 0;
    padding: 0;
}

.nz-perm26 .nz-perm-app-body > li.nz-perm-block + li.nz-perm-block {
    margin-top: 20px;
}

/* inset grouped list: a rounded box, one row per choice, hairlines between */
.nz-perm26 .nz-perm-group {
    overflow: hidden;
    border: 1px solid var(--ios26-hairline-strong);
    border-radius: var(--ios26-radius);
    background: var(--nz-perm-cell);
}

.nz-perm26 .nz-perm-group .form-group:not(.nz-perm-row) {
    margin-bottom: 0;
    padding: 0;
    border: 0;
}

.nz-perm26 .nz-perm-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    min-height: 46px;
    margin: -1px 0 0;  /* the first row's line sits under the group's edge and is clipped */
    padding: 9px 16px;
    border-top: 1px solid var(--ios26-hairline);
    transition: background .15s var(--ios26-ease);
}

.nz-perm26 .nz-perm-group .form-group.nz-perm-row {
    margin-bottom: 0;
}

@media (hover: hover) {
    .nz-perm26 .nz-perm-row:hover {
        background: var(--ios26-fill);
    }
}

.nz-perm26 .nz-perm-row > label {
    flex: 1 1 0;
    min-width: 0;
    order: 1;
    margin: 0;
    padding: 2px 0;
    font-size: 14px;
    line-height: 1.35;
    color: var(--ios26-text);
    cursor: pointer;
}

.nz-perm26 .nz-perm-row > input[type=checkbox],
.nz-perm26 .nz-perm-row > input[type=radio] {
    order: 2;
    flex: none;
    float: none;
    margin: 0 0 0 auto;
    cursor: pointer;
}

.nz-perm26 .nz-perm-row > .specific_dropdown,
.nz-perm26 .nz-perm-row > .help-block,
.nz-perm26 .nz-perm-row > span.help-block,
.nz-perm26 .nz-perm-row > .help,
.nz-perm26 .nz-perm-row > p,
.nz-perm26 .nz-perm-row > small,
.nz-perm26 .nz-perm-row > div {
    order: 3;
    flex: 1 0 100%;
}

.nz-perm26 .nz-perm-row > .help-block {
    margin: -2px 0 2px;
    font-size: 12px;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-row > .specific_dropdown {
    margin: 2px 0 4px;
}

/* a nested choice (the radios under a question, the per-project rights) */
.nz-perm26 .ml15 .nz-perm-row,
.nz-perm26 #individual_project_permission_area .nz-perm-row,
.nz-perm26 #individual_team_members_permission_area .nz-perm-row {
    padding-left: 30px;
}

/* a question that heads a radio group inside the box */
.nz-perm26 .nz-perm-group div:not(.nz-perm-row) > label:not([class]) {
    display: block;
    margin: -1px 0 0;
    padding: 12px 16px 6px;
    border-top: 1px solid var(--ios26-hairline);
    font-size: 13px;
    font-weight: 600;
    color: var(--ios26-muted);
}

/* ---------- iOS switch (checkbox) ---------- */

.nz-perm26 .nz-perm-row > input[type=checkbox] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 46px;
    height: 28px;
    border: 0 !important;
    border-radius: 14px;
    background-color: var(--nz-perm-switch-off) !important;
    background-image: none !important;
    box-shadow: none;
    transition: background-color .25s var(--ios26-ease);
}

.nz-perm26 .nz-perm-row > input[type=checkbox]::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .22), 0 0 0 .5px rgba(0, 0, 0, .04);
    transition: transform .3s var(--ios26-spring);
}

.nz-perm26 .nz-perm-row > input[type=checkbox]:checked {
    background-color: var(--nz-perm-switch-on) !important;
}

.nz-perm26 .nz-perm-row > input[type=checkbox]:checked::before {
    transform: translateX(18px);
}

/* a switch that takes access away turns amber, not green */
.nz-perm26 .nz-perm-row.nz-perm-limit > input[type=checkbox]:checked {
    background-color: #ff9f0a !important;
}

/* ---------- iOS check (radio) ---------- */

.nz-perm26 .nz-perm-row > input[type=radio] {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--ios26-hairline-strong) !important;
    border-radius: 50%;
    background-color: transparent !important;
    background-image: none !important;
    transition: background-color .2s var(--ios26-ease), border-color .2s var(--ios26-ease);
}

.nz-perm26 .nz-perm-row > input[type=radio]:checked {
    border-color: var(--ios26-accent) !important;
    background-color: var(--ios26-accent) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.6' d='M5.5 10.5l3 3 6-7'/%3e%3c/svg%3e") !important;
    background-size: 100% 100%;
}

.nz-perm26 .nz-perm-row-radio:has(> input:checked) > label {
    font-weight: 600;
}

.nz-perm26 .nz-perm-row > input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ios26-accent-ring) !important;
}

/* ---------- search results ---------- */

.nz-perm26 .nz-miss {
    display: none !important;
}

.nz-perm26.is-searching .nz-perm-row.nz-hit > label {
    font-weight: 600;
}

.nz-perm26 .nz-perm-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-empty > i {
    font-size: 34px;
    opacity: .5;
}

.nz-perm26 .nz-perm-empty p {
    margin: 12px auto 16px;
    max-width: 360px;
    font-size: 14px;
}

/* ---------- footer: what is unsaved + the one action ---------- */

.nz-perm26 .nz-perm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--ios26-hairline);
    background: var(--ios26-surface-strong);
    -webkit-backdrop-filter: var(--ios26-blur-sm);
    backdrop-filter: var(--ios26-blur-sm);
}

.nz-perm26 .nz-perm-dirty {
    font-size: 13px;
    color: var(--ios26-muted);
}

.nz-perm26 .nz-perm-footer.is-dirty .nz-perm-dirty {
    font-weight: 600;
    color: var(--nz-perm-warn);
}

.nz-perm26 .nz-perm-footer.is-dirty .nz-perm-dirty::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    vertical-align: 1px;
    border-radius: 50%;
    background: #ff9f0a;
}

/* keep the Save button clear of the floating chat bubble in the bottom right corner */
@media (min-width: 800px) {
    .nz-perm26 .nz-perm-footer {
        padding-right: 84px;
    }
}

.nz-perm26 .nz-perm-footer .btn {
    border-radius: var(--ios26-pill);
    padding: 7px 18px;
    font-weight: 600;
}

/* ---------- phone: a navigation stack, index → one section → back ---------- */

@media (max-width: 799.98px) {
    .nz-perm26 .nz-perm-toolbar {
        padding: 14px 14px 12px;
    }

    .nz-perm26 .nz-perm-search {
        flex: 1 1 100%;
        min-width: 0;
    }

    .nz-perm26 .nz-perm-body {
        display: block;
        min-height: 0;
    }

    .nz-perm26 .nz-perm-index {
        border-right: 0;
        background: transparent;
        padding: 6px 8px 14px;
    }

    .nz-perm26 .nz-perm-index-row {
        padding: 10px;
    }

    .nz-perm26 .nz-perm-pane {
        display: none;
        padding: 12px 14px 20px;
    }

    .nz-perm26.is-detail .nz-perm-index {
        display: none;
    }

    .nz-perm26.is-detail .nz-perm-pane {
        display: block;
    }

    .nz-perm26 .nz-perm-back {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin: 0 0 12px -4px;
        padding: 6px 4px;
        border: 0;
        background: none;
        font-size: 15px;
        color: var(--ios26-accent-strong);
    }

    body.color-1E202D .nz-perm26 .nz-perm-back {
        color: #9fb0ff;
    }

    .nz-perm26 .nz-perm-total {
        flex-direction: row;
        align-items: baseline;
        gap: 6px;
    }

    .nz-perm26 .nz-perm-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 14px;
    }

    .nz-perm26 .nz-perm-footer .nz-perm-dirty {
        flex: 1 1 100%;
        text-align: center;
    }

    .nz-perm26 .nz-perm-footer .btn {
        flex: 1 1 100%;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nz-perm26 .nz-perm-row {
        padding: 9px 12px;
    }
}

/* ---------- App blocks written their own way ---------- */

/* a caption that only repeats the App's name, already in the head */
.nz-perm26 h5.nz-perm-caption.nz-perm-caption-same {
    display: none;
}

/* Bootstrap grid wrappers some Apps put around each checkbox */
.nz-perm26 .nz-perm-app .nz-perm-group .row {
    margin: 0;
    display: block;
}

.nz-perm26 .nz-perm-app .nz-perm-group [class*="col-"] {
    width: auto;
    max-width: none;
    padding: 0;
}

.nz-perm26 .nz-perm-app .nz-perm-group .row.mb10,
.nz-perm26 .nz-perm-app .nz-perm-group .mb5 {
    margin-bottom: 0 !important;
}

/* several actions of one item: the name, then one pill per action */
.nz-perm26 .nz-perm-row.nz-perm-row-ops {
    gap: 8px;
}

.nz-perm26 .nz-perm-row-ops > .nz-perm-ops-name {
    flex: 1 1 160px;
    min-width: 0;
    margin: 0 !important;
    font-size: 14px;
    color: var(--ios26-text);
}

.nz-perm26 .nz-perm-op {
    position: relative;
    display: inline-flex;
    margin: 0 !important;
}

.nz-perm26 .nz-perm-op > input[type=checkbox] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.nz-perm26 .nz-perm-op > label {
    margin: 0;
    padding: 4px 12px;
    border: 1px solid var(--ios26-hairline-strong);
    border-radius: var(--ios26-pill);
    font-size: 13px;
    line-height: 18px;
    color: var(--ios26-text);
    background: transparent;
    cursor: pointer;
    user-select: none;
    transition: background .15s var(--ios26-ease), border-color .15s var(--ios26-ease), color .15s var(--ios26-ease);
}

.nz-perm26 .nz-perm-op > input:checked + label {
    border-color: #2f5fd0;
    background: #2f5fd0;
    color: #fff;
}

.nz-perm26 .nz-perm-op > input:checked + label::before {
    content: "\2713";
    margin-right: 5px;
    font-weight: 700;
}

body.color-1E202D .nz-perm26 .nz-perm-op > input:checked + label {
    border-color: #4a61d8;
    background: #4a61d8;
}

.nz-perm26 .nz-perm-op > input:focus-visible + label {
    box-shadow: 0 0 0 4px var(--ios26-accent-ring);
}

@media (hover: hover) {
    .nz-perm26 .nz-perm-op > input:not(:checked):hover + label {
        background: var(--ios26-fill-hover);
    }
}
