﻿/* ===== Codelist scope + palette ===== */
.codelist {
    --cl-heading: #333; /* tweak as needed */
}

    .codelist h2 {
        color: var(--cl-heading) !important;
        margin: 0 0 8px;
        line-height: 1.25;
        /* If global h2 size is off, uncomment:
  font-size: 1.25rem;
  */
    }

    /* ===== Table ===== */
    .codelist .ms-listviewtable {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        table-layout: auto; /* allow long names to grow */
        font-size: 13px; /* match classic SP feel */
    }

    .codelist .ms-viewheadertr .ms-vh2 {
        text-align: left !important;
        font-weight: 400 !important;
        font-size: 11px !important;
        padding: 4px 12px 4px 0;
        color: #666 !important;
        white-space: nowrap;
    }

    .codelist .ms-listviewtable td {
        padding: 4px 12px 4px 0;
        vertical-align: top;
        font-size: 13px;
        word-break: break-word;
    }

    .codelist .ms-vb2 {
        font-weight: 400;
    }

        .codelist .ms-vb2 a {
            word-break: break-word;
            color: #f90;
            text-decoration: none;
        }
            .codelist .ms-vb2 a:hover {
                text-decoration: underline;
            }

/* Keep size/date tidy on small screens */
@media (max-width: 640px) {
    .codelist .ms-listviewtable td:nth-child(3),
    .codelist .ms-listviewtable td:nth-child(4),
    .codelist .ms-viewheadertr th:nth-child(3),
    .codelist .ms-viewheadertr th:nth-child(4) {
        white-space: nowrap;
    }
}

/* ===== Footer / actions / links ===== */
.codelist .codelist-footer {
    margin-top: 8px;
    padding-right: 35px;
}

    .codelist .codelist-footer .spacer {
        height: 12px;
    }

.codelist .codelist-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

    /* Prevent global styles from stretching the form */
    .codelist .codelist-actions form {
        width: auto !important;
        display: inline;
        margin: 0;
    }

.codelist .codelist-back {
    padding: 7px 10px;
    line-height: 1.4;
    height: auto !important;
}

.codelist .codelist-links a.ms-toolbar {
    display: block; /* one per line */
    margin: 4px 0;
}

/* footer spacing */
.codelist .codelist-footer {
    margin-top: 8px;
}

    .codelist .codelist-footer .spacer {
        height: 12px;
    }

/* actions row → button to the right */
.codelist .codelist-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin: 4px 0 10px;
}

    /* SharePoint sometimes floats these; neutralize it */
    .codelist .codelist-actions .ms-ButtonHeightWidth {
        float: none;
    }

/* scrolling container stays as-is */
.codelist .codelist-scroll {
    overflow-x: auto;
}

/* let the inner wrapper size itself to the table (no viewport minimum) */
.codelist .codelist-inner {
    display: inline-block;
    width: max-content; /* grow to widest child (the table) */
    /* remove min-width:100% */
}

/* make sure no global CSS forces the table to 100% */
.codelist .ms-listviewtable {
    width: auto !important; /* override any 100% from global styles */
    table-layout: auto;
}

/* right-align actions within the table-width wrapper */
.codelist .codelist-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

    .codelist .codelist-actions .ms-ButtonHeightWidth {
        float: none !important;
        display: inline-block;
    }
