/* Site lists on DataTables (cdx-datatable.js). Desktop as the Meeting detail table
   (meetings-documents-table.css); below lg the rows become compact cards. */

table.cdx-dt {
    width: 100% !important;
}

table.cdx-dt > thead > tr > th,
table.dataTable.cdx-dt > thead > tr > th {
    background-color: #e6e7e8 !important;
    color: #545454;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 0;
}

table.cdx-dt > tbody > tr > td {
    color: #545454;
    vertical-align: top;
}

table.cdx-dt > tbody > tr:nth-child(even) > td {
    background-color: #f8f9fa;
}

table.cdx-dt > tbody > tr:hover > td {
    background-color: #f2f7fb;
}

/* Links styled as buttons (Edit in the participants list) keep the Bootstrap button colours. */
table.cdx-dt a:not(.btn):not(.cdx-dt-icon-btn) {
    color: #0f598e;
}

/* DataTables right-aligns numeric columns: dates and numbers read better from the start. */
table.dataTable.cdx-dt th.dt-type-numeric,
table.dataTable.cdx-dt td.dt-type-numeric,
table.dataTable.cdx-dt th.dt-type-date,
table.dataTable.cdx-dt td.dt-type-date {
    text-align: start;
}

table.dataTable.cdx-dt th.dt-type-numeric .dt-column-header,
table.dataTable.cdx-dt th.dt-type-date .dt-column-header {
    flex-direction: row;
}

.cdx-dt .cdx-dt-title {
    display: block;
    font-weight: 700;
}

.cdx-dt .cdx-dt-subtitle {
    display: block;
    font-weight: 400;
}

.cdx-dt .cdx-dt-nowrap {
    white-space: nowrap;
}

/* Shown on the phone only */
.cdx-dt .cdx-dt-city,
.cdx-dt .cdx-dt-range,
.cdx-dt .cdx-mdocs {
    display: none;
}

/* Documents per language: one column, one line per group (Agenda above Report); the header
   uses the same grid, so the language codes sit above their icons. */
.cdx-dt .cdx-docs {
    display: grid;
    grid-template-columns: 4.5rem repeat(6, 2.4rem);
    row-gap: 6px;
    align-items: center;
}

.cdx-dt .cdx-docs.cdx-docs-nolabel {
    grid-template-columns: repeat(6, 2.4rem);
}

.cdx-dt .cdx-docs-lbl {
    font-weight: 600;
    font-size: .85rem;
}

/* Meta line of the phone cards: the desktop shows the values in their own columns */
.cdx-dt .cdx-dt-metaline {
    display: none;
}

.cdx-dt .cdx-docs-lang {
    font-size: .8rem;
    text-align: center;
}

.cdx-dt .cdx-doc {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 24px;
}

.cdx-dt .cdx-doc-on {
    color: #0f598e;
    text-decoration: none;
}

.cdx-dt .cdx-doc-off {
    color: #b0b0b0;
}

/* Controls */
.dt-container .dt-search input,
.dt-container .dt-length select {
    border-radius: 0;
}

.dt-container .page-link {
    color: #0f598e;
}

.dt-container .active > .page-link {
    background-color: #0f598e;
    border-color: #0f598e;
    color: #fff;
}

/* ---------- Phone and tablet: compact cards ---------- */
@media (max-width: 991.98px) {
    .dt-container .dt-layout-row {
        display: block !important;
    }

    .dt-container .dt-search,
    .dt-container .dt-length,
    .dt-container .dt-info,
    .dt-container .dt-paging {
        text-align: start !important;
        margin: 6px 0;
    }

    .dt-container .dt-search input {
        width: 100% !important;
        margin: 4px 0 0 !important;
        min-height: 44px;
    }

    .dt-container .dt-paging .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    table.cdx-dt > thead {
        display: none;
    }

    table.cdx-dt,
    table.cdx-dt > tbody {
        display: block;
        width: 100% !important;
    }

    table.cdx-dt > tbody > tr {
        display: block;
        border-bottom: 1px solid #dee2e6;
        padding: 10px 4px;
    }

    table.cdx-dt > tbody > tr:nth-child(even) {
        background-color: #f8f9fa;
    }

    table.dataTable.cdx-dt > tbody > tr > td {
        display: block;
        border: 0;
        padding: 0;
        background: transparent !important;
        text-align: start;
    }

    /* Generic tables: the column name in front of each value. Lists with their own card
       layout mark the table with cdx-dt-cards and skip it. */
    table.cdx-dt:not(.cdx-dt-cards) > tbody > tr > td[data-label]:not([data-label=""])::before {
        content: attr(data-label) ": ";
        font-weight: 600;
    }

    /* Hidden on the phone (the information is elsewhere in the card) */
    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-phone-hide,
    .cdx-dt .cdx-dt-subtitle,
    .cdx-dt .cdx-dt-fullplace {
        display: none;
    }

    /* Meta line: place on the start side, dates on the end side */
    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-meta {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        font-size: .85rem;
        margin-top: 4px;
    }

    .cdx-dt .cdx-dt-city,
    .cdx-dt .cdx-dt-range {
        display: inline;
    }

    .cdx-dt .cdx-dt-range {
        white-space: nowrap;
    }

    /* Documents: each group on its own line, one column per language */
    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-docs {
        margin-top: 6px;
    }

    .cdx-dt .cdx-docs {
        display: none;
    }

    .cdx-dt .cdx-mdocs {
        display: grid;
        grid-template-columns: minmax(4rem, max-content) repeat(6, minmax(0, 1fr));
        column-gap: 4px;
        align-items: center;
        font-size: .85rem;
    }

    .cdx-dt .cdx-mdocs .cdx-doc {
        justify-content: flex-start;
        gap: 2px;
        min-height: 36px;
        font-size: .8rem;
        font-weight: 600;
    }

    .cdx-dt .cdx-mdocs .cdx-doc-off {
        font-weight: 400;
    }

    .cdx-dt .cdx-mdocs.cdx-docs-nolabel {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    /* Document lists (circular letters, standards): reference, title, then a meta line
       built in the title cell; the single-value columns are hidden. */
    .cdx-dt .cdx-dt-metaline {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        font-size: .85rem;
        margin-top: 4px;
    }

    .cdx-dt .cdx-dt-metaline .cdx-dt-metalabel {
        font-weight: 600;
    }
}

/* ---- Cell helpers (participants list and others) ---- */

/* Rows with buttons or checkboxes: everything on the middle line. */
table.cdx-dt.cdx-dt-middle > tbody > tr > td {
    vertical-align: middle;
}

/* Long values cut with an ellipsis on desktop; the full text is in the title (tooltip) and
   in the cell text, so search and sorting still see all of it. */
@media (min-width: 992px) {
    .cdx-dt .cdx-dt-clip {
        display: inline-block;
        max-width: var(--cdx-dt-clip, 12em);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
    }
}

/* Small label for a category (Member, Observer, ...) */
.cdx-dt .cdx-dt-pill {
    display: inline-block;
    padding: .1em .65em;
    border-radius: 1em;
    font-size: .85em;
    line-height: 1.5;
    white-space: nowrap;
    background-color: #eceff2;
    color: #4a4f55;
}

.cdx-dt .cdx-dt-pill--member {
    background-color: #e3eef7;
    color: #0f598e;
}

.cdx-dt .cdx-dt-pill--observer {
    background-color: #fdf0e1;
    color: #8a4b0f;
}

.cdx-dt .cdx-dt-pill:empty {
    display: none;
}

/* Icon-only actions: coloured icon, round light background on hover/focus. */
.cdx-dt .cdx-dt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #0f598e;
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.cdx-dt .cdx-dt-icon-btn:hover,
.cdx-dt .cdx-dt-icon-btn:focus-visible {
    background-color: #e3eef7;
    color: #0a3f66;
}

.cdx-dt .cdx-dt-icon-btn--danger {
    color: #b3261e;
}

.cdx-dt .cdx-dt-icon-btn--danger:hover,
.cdx-dt .cdx-dt-icon-btn--danger:focus-visible {
    background-color: #fbe9e7;
    color: #8c1d18;
}

.cdx-dt .cdx-dt-icon-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.cdx-dt .cdx-dt-icon-btn:disabled {
    opacity: .45;
    cursor: default;
}

/* Phone cards: the action cells (checkboxes, icons) side by side on one line at the bottom. */
@media (max-width: 991.98px) {
    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-action {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin: 8px 18px 0 0;
        text-align: start !important;
        vertical-align: middle;
    }

    table.cdx-dt > tbody > tr > td.cdx-dt-action.cdx-dt-nolabel::before {
        content: none !important;
    }

    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-action.cdx-dt-nolabel {
        margin-right: 4px;
    }

    table.dataTable.cdx-dt > tbody > tr > td.cdx-dt-action .cdx-dt-icon-btn {
        width: 2.75rem;
        height: 2.75rem;
    }
}

/* Wide tables (EWG admin, 10 columns): headers may wrap so the table fits a 1280px screen. */
table.cdx-dt.cdx-dt-wrap-head > thead > tr > th {
    white-space: normal;
}

/* DataTables' Bootstrap rows have negative margins: inside a scrolling wrapper (.table-container,
   overflow:auto) they stuck out by a few px and showed an empty horizontal scrollbar. Margins and
   column paddings cancel out, so the content stays where it was. */
.dt-container > .row {
    margin-left: 0;
    margin-right: 0;
}

.dt-container > .row > [class*="col"] {
    padding-left: 0;
    padding-right: 0;
}

/* Phone cards read top to bottom: cells centred for the desktop columns (counts, icons) start
   on the left like the rest of the card. */
@media (max-width: 991.98px) {
    table.dataTable.cdx-dt > tbody > tr > td.text-center,
    table.dataTable.cdx-dt > tbody > tr > td.text-end,
    table.dataTable.cdx-dt > tbody > tr > td.dt-type-numeric {
        text-align: start !important;
    }
}
