:root {
    --brand-50: #eef5fb;
    --brand-100: #dbeafe;
    --brand-500: #1d6fb8;
    --brand-600: #155a9b;
    --brand-700: #0d3b66;
    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --ink-300: #cbd5e1;
    --ink-100: #e8edf3;
    --ink-50: #f8fafc;
    --surface: #fff;
    --page: #f4f7fb;
    --radius: 14px;
    --shadow: 0 8px 28px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background: var(--page);
    color: var(--ink-900);
    font-family: Inter, "Segoe UI", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--ink-100);
    backdrop-filter: blur(14px);
}
.app-header .navbar { min-height: 68px; }
.navbar-brand { display: flex; align-items: center; gap: 11px; color: var(--ink-900); }
.navbar-brand:hover { color: var(--ink-900); }
.navbar-brand strong, .navbar-brand small { display: block; }
.navbar-brand strong { font-size: .96rem; letter-spacing: -.01em; }
.navbar-brand small { color: var(--ink-500); font-size: .68rem; font-weight: 500; }
.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    box-shadow: 0 7px 16px rgba(13, 59, 102, .22);
    font-size: 1.1rem;
}

.btn {
    border-radius: 10px;
    font-size: .86rem;
    font-weight: 600;
    padding: .55rem .9rem;
}
.btn-primary, .btn-success {
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    box-shadow: 0 4px 12px rgba(13, 59, 102, .16);
}
.btn-primary:hover, .btn-success:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-ghost { border: 0; color: var(--ink-700); background: transparent; }
.btn-ghost:hover { background: var(--ink-50); }
.btn-block { display: flex; width: 100%; margin-top: .65rem; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 999px;
    padding: 5px 10px 5px 5px;
    color: var(--ink-700);
    background: var(--ink-50);
    font-size: .8rem;
}
.avatar {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--brand-700);
    font-weight: 700;
}
.dropdown-menu {
    padding: .45rem;
    border: 1px solid var(--ink-100);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.dropdown-item { border-radius: 8px; padding: .55rem .7rem; font-size: .84rem; }
.dropdown-item i { width: 20px; display: inline-block; }

.app-content { min-height: calc(100vh - 112px); padding-top: 24px; padding-bottom: 28px; }
.app-footer {
    display: flex;
    justify-content: space-between;
    padding: 13px 24px;
    border-top: 1px solid var(--ink-100);
    color: var(--ink-500);
    background: #fff;
    font-size: .74rem;
}
.footer-brand-trigger {
    cursor: pointer;
}
.footer-brand-trigger:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 3px;
    border-radius: 4px;
}

.card, .modal-content {
    border: 1px solid var(--ink-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.modal-header, .modal-footer { border-color: var(--ink-100); }
#errormodal { z-index: 20000; }
.error-modal-backdrop { z-index: 19990; }
.modal-message-icon {
    display: grid;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    place-items: center;
    border-radius: 10px;
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: 1.2rem;
}

.form-label {
    margin-bottom: .42rem;
    color: var(--ink-700);
    font-size: .78rem;
    font-weight: 650;
}
.form-control,
.form-select {
    min-height: 46px;
    margin-bottom: 0;
    border: 1px solid var(--ink-300);
    border-radius: 11px;
    color: var(--ink-900);
    background-color: var(--surface);
    font-size: .88rem;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control { padding: .68rem .85rem; }
.form-select {
    padding-top: .68rem;
    padding-bottom: .68rem;
    padding-left: .85rem;
}
.form-control::placeholder { color: #94a3b8; opacity: 1; }
.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) { border-color: #94a3b8; }
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(29, 111, 184, .11);
}
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    color: var(--ink-500);
    border-color: var(--ink-100);
    background-color: var(--ink-50);
    opacity: 1;
}
.form-control.is-invalid,
.form-select.is-invalid { border-color: #dc2626; }
.invalid-feedback { font-size: .76rem; }
.form-text { margin-top: .38rem; color: var(--ink-500); font-size: .73rem; }

.form-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.form-check {
    min-height: 24px;
    margin: 4px 0 16px;
    padding-left: 2.85rem;
}
.form-check-input {
    width: 2.15rem;
    height: 1.15rem;
    margin-left: -2.85rem;
    border-color: #94a3b8;
    cursor: pointer;
}
.form-check-input:checked { border-color: var(--brand-600); background-color: var(--brand-600); }
.form-check-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(29, 111, 184, .11); }
.form-check-label { color: var(--ink-700); font-size: .84rem; font-weight: 600; cursor: pointer; }

input[type="file"].form-control { padding: .42rem .48rem; }
input[type="file"].form-control::file-selector-button {
    margin: -.42rem .75rem -.42rem -.48rem;
    padding: .68rem .85rem;
    border: 0;
    border-right: 1px solid var(--ink-100);
    color: var(--brand-700);
    background: var(--brand-50);
    font-weight: 650;
}
input[type="file"].form-control:hover::file-selector-button { background: var(--brand-100); }
input[type="number"] { font-variant-numeric: tabular-nums; }

.input-group > .form-control,
.input-group > .form-select { margin-bottom: 0; }
.input-group-text {
    border-color: var(--ink-300);
    color: var(--ink-500);
    background: var(--ink-50);
}

.form-signin .form-control,
.form-signin .form-select,
.modal-body > .form-control,
.modal-body > .form-select { margin-bottom: 12px; }

/* Compatibilidad accesible para plantillas heredadas de Bootstrap 4. */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.filter-card {
    padding: 18px;
    border: 1px solid var(--ink-100);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.filter-form { margin: 0; }
.filter-form-wide { width: 100%; }

.category-create-row {
    display: flex;
    align-items: end;
    gap: .75rem;
}

.category-list {
    border: 1px solid var(--ink-100);
    border-radius: 12px;
    overflow: hidden;
}

.category-list:empty { display: none; }

.category-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--ink-100);
}

.category-list-item:last-child { border-bottom: 0; }
.category-list-item strong { display: block; }
.category-list-item span { color: var(--ink-500); font-size: .82rem; }
.category-list-item .btn:disabled { opacity: .35; }

.upload-notifications {
    position: fixed !important;
    inset: auto 22px 22px auto !important;
    margin: 0 !important;
    z-index: 16000;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    display: grid;
    gap: 12px;
    pointer-events: none;
}

.upload-notification {
    padding: 16px;
    border: 1px solid rgba(13, 59, 102, .18);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .2);
    pointer-events: auto;
}

.global-upload-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.global-upload-progress-header strong,
.global-upload-progress-header span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.global-upload-progress-header span { color: var(--ink-500); font-size: .84rem; }
.global-upload-progress-icon { color: var(--brand-600); font-size: 1.45rem; }
.upload-notification .progress { height: 9px; margin-bottom: 10px; }
.upload-notification p { color: var(--ink-600); font-size: .8rem; }
.upload-notification.is-complete { border-color: rgba(25, 135, 84, .4); }
.upload-notification.is-complete .global-upload-progress-icon { color: #198754; }
.upload-notification.is-complete .progress-bar { background: #198754; }
.upload-notification.is-error { border-color: rgba(220, 53, 69, .4); }
.upload-notification.is-error .global-upload-progress-icon { color: #dc3545; }
.filter-grid {
    display: grid;
    grid-template-columns: minmax(170px, 230px) minmax(190px, 270px) minmax(280px, 1fr) auto;
    align-items: end;
    gap: 12px;
}
.filter-field { width: 100%; }
.date-range {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
    align-items: end;
    gap: 12px;
}

.datepicker {
    z-index: 21000 !important;
    min-width: 250px;
    padding: 8px;
    border: 1px solid var(--ink-100) !important;
    border-radius: 12px !important;
    background: #fff;
    box-shadow: var(--shadow);
    font-family: Inter, "Segoe UI", sans-serif;
}
.datepicker table tr td,
.datepicker table tr th { border-radius: 8px !important; }
.datepicker table tr td.active,
.datepicker table tr td.active:hover {
    color: #fff !important;
    background: var(--brand-600) !important;
}

.auth-page {
    background:
        radial-gradient(circle at 15% 10%, rgba(29, 111, 184, .12), transparent 32rem),
        linear-gradient(135deg, #f8fafc, #edf3f9);
}
.auth-page .app-header { position: relative; }
.auth-content {
    display: grid;
    min-height: calc(100vh - 113px);
    padding: 48px 18px;
    place-items: center;
}
.form-signin {
    position: static;
    width: min(100%, 410px);
    margin: 0;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 18px;
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 20px 55px rgba(15, 23, 42, .12);
    backdrop-filter: blur(12px);
}
.form-signin-heading {
    margin-bottom: 22px;
    color: var(--ink-900);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.password-reset-link { display: block; margin-top: 18px; text-align: center; font-size: .82rem; }

.thumbnail {
    height: 100%;
    padding: 10px;
    border: 1px solid var(--ink-100);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    transition: transform .16s, box-shadow .16s;
}
.thumbnail:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumbnail img { border-radius: 10px; object-fit: cover; }
.caption { padding: 12px 4px 4px; }
.badge { border-radius: 999px; padding: .38rem .58rem; font-weight: 600; }
.badge-info, .badge-primary { color: var(--brand-700); background: var(--brand-50); }
.badge-warning { color: #92400e; background: #fef3c7; }

.document-browser {
    margin-top: 32px;
    overflow: visible;
}
.document-group {
    position: relative;
    z-index: 1;
    overflow: visible;
}
.document-group:hover,
.document-group:focus-within {
    z-index: 50;
}
.document-group + .document-group {
    margin-top: 34px;
}
.document-group-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 14px;
}
.document-group-header h2 {
    margin: 0;
    color: var(--ink-900);
    font-size: 1.55rem;
    font-weight: 700;
}
.document-group-header p {
    margin: 3px 0 0;
    color: var(--ink-500);
    font-size: .78rem;
}
.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 112px));
    align-items: flex-start;
    gap: 18px;
    overflow: visible;
}
.document-card {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 0;
    width: 112px;
    min-height: 142px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.document-card:hover {
    z-index: 1000;
    transform: translateY(-1px);
    border-color: transparent;
    box-shadow: none;
}
.document-card:focus-within {
    z-index: 1000;
}
.document-open {
    display: flex;
    width: 112px;
    height: 108px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    padding: 9px 8px;
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    color: inherit;
    background: #fff;
    text-align: center;
    vertical-align: top;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.document-open:hover { border-color: #cbd9e8; background: #f8fbff; }
.document-open .badge {
    padding: .28rem .48rem;
    font-size: .68rem;
    line-height: 1;
}
.document-thumb {
    display: flex;
    width: 52px;
    min-width: 52px;
    height: 46px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow: hidden;
    border: 0;
    border-radius: 7px;
    background: var(--ink-50);
    padding: 0;
}
.document-thumb img {
    width: 100%;
    height: 100%;
    border-radius: 7px;
    object-fit: cover;
}
.document-thumb-file {
    flex-direction: column;
    gap: 3px;
    color: var(--brand-700);
}
.document-thumb-file i {
    font-size: 1.55rem;
    line-height: 1;
}
.document-thumb-file span {
    max-width: 48px;
    overflow: hidden;
    color: var(--ink-900);
    font-size: .62rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.document-title,
.document-subtitle {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    overflow: hidden;
}
.document-title {
    margin-top: 0;
    margin-left: 0;
    overflow: hidden;
    color: var(--ink-900);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.document-subtitle {
    margin-top: 0;
    margin-left: 0;
    overflow: hidden;
    color: var(--ink-500);
    font-size: .68rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.document-card-actions {
    display: flex;
    position: static;
    width: 112px;
    justify-content: center;
    gap: 12px;
    padding: 7px 0 0;
}
.btn-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    padding: 0;
    border-radius: 7px;
    font-size: .9rem;
}
.document-hover-info {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 2000;
    width: 230px;
    padding: 12px;
    border: 1px solid var(--ink-100);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
    text-align: left;
}
.document-card:hover .document-hover-info,
.document-card:focus-within .document-hover-info {
    display: block;
}
.document-hover-info strong {
    display: block;
    margin-bottom: 8px;
    color: var(--ink-900);
    font-size: .86rem;
    line-height: 1.25;
}
.document-hover-info dl {
    display: grid;
    gap: 6px;
    margin: 0;
}
.document-hover-info dl > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--ink-100);
    padding-bottom: 5px;
}
.document-hover-info dl > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.document-hover-info dt {
    color: var(--ink-500);
    font-size: .7rem;
    font-weight: 700;
}
.document-hover-info dd {
    margin: 0;
    color: var(--ink-900);
    font-size: .72rem;
    font-weight: 650;
    text-align: right;
    overflow-wrap: anywhere;
}
.empty-documents {
    display: grid;
    min-height: 260px;
    place-items: center;
    padding: 40px 18px;
    border: 1px dashed var(--ink-300);
    border-radius: var(--radius);
    color: var(--ink-500);
    background: rgba(255, 255, 255, .65);
    text-align: center;
}
.empty-documents i {
    margin-bottom: 10px;
    color: var(--brand-600);
    font-size: 2.5rem;
}
.empty-documents h2 {
    margin: 0;
    color: var(--ink-900);
    font-size: 1rem;
}
.empty-documents p {
    margin: 5px 0 0;
}
.document-modal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}
.document-modal-preview {
    display: grid;
    min-height: min(68vh, 640px);
    place-items: center;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
    background: var(--ink-50);
}
.document-modal-preview img {
    max-width: 100%;
    max-height: min(68vh, 640px);
    object-fit: contain;
}
.document-modal-preview.is-file-preview {
    min-height: 360px;
    padding: 24px;
    background: linear-gradient(180deg, #fff, var(--ink-50));
}
#documentPreviewModal .modal-body {
    padding: 14px 18px;
}
.document-file-panel {
    display: grid;
    width: min(100%, 820px);
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: stretch;
    gap: 18px;
}
.document-modal-file {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    place-items: center;
    gap: 12px;
    border: 1px solid var(--ink-100);
    border-radius: 14px;
    color: var(--brand-700);
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.document-modal-file i {
    font-size: 5.6rem;
    line-height: 1;
}
.document-modal-file strong {
    display: inline-flex;
    min-width: 74px;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--ink-500);
    background: var(--brand-50);
    font-size: .8rem;
    font-weight: 750;
}
.document-file-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}
.document-file-details > div {
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--ink-100);
    border-radius: 10px;
    background: #fff;
}
.document-file-details > div:first-child {
    grid-column: 1 / -1;
}
.document-file-details dt {
    margin-bottom: 4px;
    color: var(--ink-500);
    font-size: .68rem;
    font-weight: 750;
    text-transform: uppercase;
}
.document-file-details dd {
    margin: 0;
    overflow: hidden;
    color: var(--ink-900);
    font-size: .9rem;
    font-weight: 650;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.file-document .document-preview-footer {
    grid-template-columns: 1fr;
}
.file-document .document-preview-footer .document-modal-info {
    display: none;
}
.file-document .document-modal-actions {
    justify-content: flex-end;
}
.document-preview-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
    padding: 14px 18px;
}
.document-modal-info {
    width: 100%;
}
.document-modal-info dl {
    display: grid;
    grid-template-columns: minmax(160px, 1.4fr) repeat(6, minmax(78px, .7fr));
    align-items: stretch;
    gap: 8px;
    margin: 0;
}
.document-modal-info dl > div {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    background: var(--ink-50);
}
.document-modal-info dt {
    margin-bottom: 2px;
    color: var(--ink-500);
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
}
.document-modal-info dd {
    margin: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    color: var(--ink-900);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
}
.document-modal-info dl > div:first-child dd {
    white-space: nowrap;
}
.document-modal-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}
.confirm-modal-content {
    display: flex;
    align-items: center;
    gap: 14px;
}
.confirm-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    color: #991b1b;
    background: #fee2e2;
    font-size: 1.35rem;
}
.loading-card {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--ink-700);
    background: #fff;
    box-shadow: var(--shadow);
}
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 24px;
    color: #fff;
    background: #0f5132;
    font-size: .86rem;
    font-weight: 650;
}
.impersonation-banner span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.superadmin-page {
    display: grid;
    gap: 18px;
}
.superadmin-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}
.superadmin-heading h1 {
    margin: 5px 0 3px;
    color: var(--ink-900);
    font-size: 1.55rem;
    font-weight: 750;
}
.superadmin-heading p {
    margin: 0;
    color: var(--ink-500);
}
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--brand-700);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
}
.superadmin-shell {
    display: grid;
    grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
    min-height: 650px;
    overflow: hidden;
    border: 1px solid var(--ink-100);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
.superadmin-sidebar {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-width: 0;
    border-right: 1px solid var(--ink-100);
    background: var(--ink-50);
}
.admin-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    color: var(--ink-900);
    font-size: .9rem;
}
.admin-sidebar-header span {
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--brand-700);
    background: var(--brand-50);
    font-size: .75rem;
    font-weight: 750;
}
.admin-search {
    position: relative;
    padding: 0 16px 14px;
}
.admin-search i {
    position: absolute;
    top: 50%;
    left: 30px;
    transform: translateY(-62%);
    color: var(--ink-500);
}
.admin-search .form-control {
    min-height: 40px;
    padding-left: 35px;
    border-radius: 10px;
}
.admin-user-list {
    display: grid;
    align-content: start;
    gap: 7px;
    overflow: auto;
    padding: 0 10px 14px;
}
.admin-user-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 10px;
    color: var(--ink-900);
    background: transparent;
    text-align: left;
}
.admin-user-item:hover,
.admin-user-item.active {
    border-color: var(--brand-100);
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .05);
}
.admin-user-avatar,
.admin-detail-avatar {
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: var(--brand-700);
    font-weight: 800;
}
.admin-user-avatar {
    width: 38px;
    height: 38px;
}
.admin-user-meta {
    min-width: 0;
}
.admin-user-meta strong,
.admin-user-meta small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.admin-user-meta strong {
    font-size: .84rem;
}
.admin-user-meta small {
    color: var(--ink-500);
    font-size: .72rem;
}
.admin-user-status {
    align-self: start;
    padding: 3px 7px;
    border-radius: 999px;
    color: #166534;
    background: #dcfce7;
    font-size: .68rem;
    font-weight: 800;
}
.admin-user-status.inactive {
    color: #991b1b;
    background: #fee2e2;
}
.admin-empty-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--ink-500);
    text-align: center;
}
.superadmin-detail {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    padding: 22px;
}
.admin-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ink-100);
}
.admin-detail-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 13px;
}
.admin-detail-avatar {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    border-radius: 14px;
    font-size: 1.15rem;
}
.admin-detail-identity h2 {
    margin: 0 0 4px;
    overflow-wrap: anywhere;
    color: var(--ink-900);
    font-size: 1.2rem;
    font-weight: 750;
}
.admin-detail-identity p {
    margin: 0;
    color: var(--ink-500);
}
.admin-detail-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.admin-user-form {
    display: grid;
    align-content: start;
    gap: 18px;
    padding-top: 22px;
}
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
}
.admin-options-row {
    display: flex;
    align-items: center;
    min-height: 34px;
}
.admin-options-row .form-check {
    margin-bottom: 0;
}
.admin-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding-top: 4px;
}
.admin-temp-password {
    padding: 16px;
    border: 1px solid var(--ink-100);
    border-radius: 10px;
    color: var(--brand-700);
    background: var(--brand-50);
    font-family: Consolas, "Courier New", monospace;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
}
.admin-password-help {
    margin-bottom: 10px;
    color: var(--ink-500);
}

@media (max-width: 992px) {
    .superadmin-shell {
        grid-template-columns: 1fr;
    }
    .superadmin-sidebar {
        max-height: 360px;
        border-right: 0;
        border-bottom: 1px solid var(--ink-100);
    }
    .admin-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .impersonation-banner,
    .superadmin-heading,
    .admin-detail-header {
        align-items: stretch;
        flex-direction: column;
    }
    .superadmin-detail {
        padding: 16px;
    }
    .admin-user-item {
        grid-template-columns: 34px minmax(0, 1fr);
    }
    .admin-user-status {
        grid-column: 2;
        width: fit-content;
    }
    .admin-action-row .btn {
        width: 100%;
    }
    .navbar-brand small { display: none; }
    .form-signin { padding: 24px 20px; }
    .app-footer { padding-inline: 16px; }
    .app-footer span:last-child { display: none; }
    .filter-card { padding: 15px; }
    .filter-form + .filter-form { margin-top: 12px; }
    .filter-grid { grid-template-columns: 1fr; }
    .category-create-row { align-items: stretch; flex-direction: column; }
    .upload-notifications { inset: auto 16px 16px auto !important; }
    .filter-field { width: 100%; }
    .date-range { grid-template-columns: 1fr; }
    .date-range .btn { width: 100%; }
    .document-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 104px)); }
    .document-card,
    .document-open,
    .document-card-actions { width: 104px; }
    .document-hover-info { left: 50%; transform: translateX(-50%); }
    .document-modal-layout { grid-template-columns: 1fr; }
    .document-modal-preview { min-height: 280px; }
    .document-preview-footer { grid-template-columns: 1fr; }
    .document-file-panel { grid-template-columns: 1fr; }
    .document-file-details { grid-template-columns: 1fr; }
    .document-modal-info dl { grid-template-columns: 1fr 1fr; }
    .document-modal-info dl > div:first-child { grid-column: 1 / -1; }
    .document-modal-actions { justify-content: stretch; }
    .document-modal-actions .btn { flex: 1 1 auto; }
}
