/* ============================================================
   AUTH & USER MANAGEMENT STYLES
   Login, logout, access-denied, profile dropdown, matrix.
   ============================================================ */

/* ===== Auth shell (login / logout / access-denied) ===== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 45%, #0F172A 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 32px 30px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    animation: auth-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-card-wide {
    max-width: 520px;
    text-align: center;
}

@keyframes auth-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
    text-align: center;
    margin-bottom: 22px;
}

.auth-mark {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--ds-primary, #1D4ED8);
    color: #fff;
    font-size: 26px;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35);
}

.auth-mark-danger {
    background: var(--ds-crimson, #DC2626);
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.35);
}

.auth-brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--ds-text, #1E293B);
    margin: 0 0 4px;
}

.auth-brand p {
    font-size: 13px;
    color: var(--ds-text-muted, #64748B);
    margin: 0;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text, #1E293B);
    margin-bottom: 6px;
}

.auth-input {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input i {
    position: absolute;
    left: 12px;
    color: var(--ds-text-subtle, #94A3B8);
    font-size: 15px;
    pointer-events: none;
}

.auth-input .form-control {
    padding-left: 38px;
    height: 44px;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--ds-text-muted, #64748B);
    cursor: pointer;
    margin: 0;
}

.auth-link {
    font-size: 13px;
    color: var(--ds-primary, #1D4ED8);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-submit {
    width: 100%;
    height: 46px;
    font-weight: 600;
    font-size: 15px;
}

.auth-alert {
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.auth-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ds-border, #E2E8F0);
    text-align: center;
    font-size: 12px;
    color: var(--ds-text-subtle, #94A3B8);
}

.auth-footer code {
    color: var(--ds-primary, #1D4ED8);
    background: var(--ds-primary-soft, #EFF4FF);
    padding: 1px 6px;
    border-radius: 5px;
}

.auth-denied-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 22px;
}

.auth-loading {
    min-height: 60vh;
    display: grid;
    place-items: center;
    gap: 12px;
    color: var(--ds-text-muted, #64748B);
}

/* ===== Top-nav user profile dropdown ===== */
.topnav-user {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--ds-border, #E2E8F0);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.user-trigger:hover {
    background: var(--ds-primary-soft, #EFF4FF);
    border-color: var(--ds-primary-softer, #DCE7FF);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ds-primary, #1D4ED8);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-text, #1E293B);
    white-space: nowrap;
}

.user-role {
    font-size: 10px;
    color: var(--ds-text-muted, #64748B);
    white-space: nowrap;
}

.user-menu {
    position: absolute;
    top: 40px;
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--ds-border, #E2E8F0);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    padding: 8px;
    z-index: 1050;
    animation: auth-pop 0.18s ease;
}

.user-menu-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--ds-border, #E2E8F0);
    margin-bottom: 6px;
}

.user-menu-head .um-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ds-text, #1E293B);
}

.user-menu-head .um-role {
    font-size: 11px;
    color: var(--ds-text-muted, #64748B);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--ds-text, #1E293B);
    font-size: 13px;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.user-menu-item:hover {
    background: var(--ds-surface-muted, #F1F3F6);
}

.user-menu-item.danger {
    color: var(--ds-crimson, #DC2626);
}

.user-menu-item.danger:hover {
    background: var(--ds-crimson-soft, #FEF2F2);
}

/* ===== Permission matrix ===== */
.perm-matrix th,
.perm-matrix td {
    vertical-align: middle;
}

.perm-matrix .perm-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.perm-menu-name {
    font-weight: 600;
    color: var(--ds-text, #1E293B);
}

.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--ds-primary-soft, #EFF4FF);
    color: var(--ds-primary, #1D4ED8);
}

.role-pill.system {
    background: var(--ds-forest-soft, #ECFDF5);
    color: var(--ds-forest-dark, #15803D);
}

/* ===== Lightweight modal (reset password) ===== */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: grid;
    place-items: center;
    z-index: 1060;
    animation: auth-pop 0.18s ease;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
}

