/* ============================================================================
   Access Control — page-specific styles only.
   ----------------------------------------------------------------------------
   Everything in here is scoped to the Access Control page. It used to restyle
   .card, .btn, .badge, .form-select, .alert and the .p-2 / .mb-3 / .bg-light
   utilities globally, which meant one page's stylesheet quietly redecorated all
   twenty-six of them and fought style.css for control. It also applied
   `* { transition: ... }` to every element in the document, so every style
   recalculation on a long list animated. Both are gone; the shared components
   now come from style.css.
   ========================================================================== */

.access-control-wrapper {
    width: 100%;
}

#access-control-container {
    width: 100%;
}

.access-control-content {
    width: 100%;
    min-height: 400px;
}

/* Permission grid — the page is a matrix of toggles, so it reads as a grid
   rather than as a stack of form rows. */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    background: var(--sheet-sunk);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.checkbox-label:hover {
    background: var(--sheet);
    border-color: var(--rule-strong);
}

.checkbox-label:has(input:checked) {
    background: var(--ledger-100);
    border-color: var(--ledger);
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--ledger);
    margin: 0;
}

.checkbox-label span {
    font-size: 0.75rem;
    color: var(--ink-soft);
    font-weight: 450;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toggle switches keep the accent colour so an enabled capability is legible
   at a glance across a long column of them. */
.access-control-wrapper .form-switch .form-check-input {
    width: 2.1em;
    height: 1.1em;
    cursor: pointer;
}

.access-control-wrapper .form-switch .form-check-input:checked {
    background-color: var(--ledger);
    border-color: var(--ledger);
}

.access-control-wrapper .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    min-height: auto;
}

.access-control-wrapper .form-check .form-check-input { margin: 0; flex-shrink: 0; }

.access-control-wrapper .form-check-label {
    font-size: 0.8125rem;
    color: var(--ink-soft);
    margin: 0;
    cursor: pointer;
}

.access-control-wrapper .form-label,
#user-override-container .form-label {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.access-control-wrapper .row.g-3 > [class*="col-"] { min-width: 0; }

@media (max-width: 768px) {
    .checkbox-grid { grid-template-columns: 1fr; }
}
