.sidebar-nav .list-group-item {
    border: 1px solid #e2e6ea;
    color: #2d3748;
    background: #ffffff;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-nav .list-group-item:hover {
    background: #f5f7fb;
    color: #1a365d;
}

.sidebar-nav .list-group-item.active {
    background: #e7efff;
    color: #1e3a8a;
    border-color: #b9c8ea;
}

.sidebar-nav .sidebar-item {
    margin-bottom: 8px;
    border-radius: 10px;
}

.sidebar-nav .sidebar-item:last-child {
    margin-bottom: 0;
}

.sidebar-nav .sidebar-toggle {
    display: flex;
    align-items: center;
}

.sidebar-nav .sidebar-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid #6c757d;
    border-bottom: 2px solid #6c757d;
    margin-left: auto;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.sidebar-nav .sidebar-toggle.collapsed::after {
    transform: rotate(-45deg);
}

.sidebar-nav .sidebar-submenu {
    margin: -4px 0 10px 0;
    padding: 6px 6px 8px 6px;
    background: #f4f6fb;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.sidebar-nav .sidebar-submenu .list-group-item {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    margin-bottom: 4px;
    position: relative;
    font-size: 0.95rem;
}

.sidebar-nav .sidebar-submenu .list-group-item::before {
    content: "";
    position: absolute;
    left: 0.6rem;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5f5;
    transform: translateY(-50%);
}

.sidebar-nav .sidebar-submenu .list-group-item.active {
    background: #ffffff;
    border-color: #c7d7f2;
    color: #1e3a8a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.sidebar-nav .sidebar-submenu .list-group-item.active::before {
    background: #6b86d6;
}

.sidebar-nav .sidebar-submenu .list-group-item:hover {
    background: #eef3ff;
    color: #1e3a8a;
}

.sidebar-nav .sidebar-submenu .list-group-item:first-child {
    margin-top: 2px;
}

.sidebar-nav .sidebar-submenu .list-group-item:last-child {
    margin-bottom: 0;
}

.portal-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1080;
    padding: 12px 16px;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 420px;
    max-height: 70vh;
    overflow: hidden;
}

.portal-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.portal-toast-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #14532d;
}

.portal-toast-error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #7f1d1d;
}

.portal-toast-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    max-height: 48vh;
    overflow: auto;
}

.portal-toast-details pre {
    white-space: pre-wrap;
    margin: 6px 0 0 0;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.04);
    padding: 6px 8px;
    border-radius: 8px;
}

.portal-toast-section + .portal-toast-section {
    margin-top: 10px;
}

.totp-qr {
    width: 18px;
    height: 18px;
    filter: blur(4px);
    transition: filter 0.2s ease, width 0.2s ease, height 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    position: relative;
    display: inline-block;
}

.totp-qr:hover,
.totp-qr.hold-open {
    filter: blur(0);
    width: 128px;
    height: 128px;
    z-index: 50;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.totp-qr canvas,
.totp-qr img {
    width: 100% !important;
    height: 100% !important;
}

.totp-qr::after {
    content: "";
    position: absolute;
    inset: -48px;
}

.active-users-table {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}

.active-users-table td,
.active-users-table th {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.totp-qr,
.totp-qr * {
    user-select: none;
}

.table-responsive {
    overflow: visible;
}

.btn-action {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
}

.btn-action:hover {
    background: #eef2f7;
    color: #0f172a;
}

.btn-action-download {
    border-color: #cbd5e1;
    color: #1f2937;
}

.btn-action-reissue {
    border-color: #c7d2fe;
    color: #4338ca;
    background: #eef2ff;
}

.btn-action-revoke {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.btn-action-impersonate {
    border-color: #cbd5e1;
    color: #475569;
    background: #ffffff;
}

.btn-action:disabled,
.btn-action[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-user-form {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.add-user-form .form-text {
    margin-bottom: 0.5rem;
}

.add-user-btn {
    margin-top: auto;
    align-self: center;
    width: 50%;
}

.add-user-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}
