.dt-container {
    width: 100%;
    min-width: 0;
    padding: 0;
    font-size: 13px;
    color: #244360;
}

/* Keep the controls inside the panel; only the table itself scrolls. */
div.dt-container div.dt-layout-row {
    width: 100%;
    min-width: 0;
    margin: 0;
    gap: 12px;
}
div.dt-container div.dt-layout-row:not(.dt-layout-table) {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 16px 22px;
}
div.dt-container div.dt-layout-row div.dt-layout-cell {
    min-width: 0;
    max-width: 100%;
}
div.dt-container div.dt-layout-row:not(.dt-layout-table) div.dt-layout-cell {
    display: flex;
    align-items: center;
    margin: 0;
}
div.dt-container div.dt-layout-row:not(.dt-layout-table) div.dt-layout-cell > * {
    margin-top: 0;
    margin-bottom: 0;
}
div.dt-container div.dt-layout-table {
    display: block;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
div.dt-container div.dt-layout-table > .dt-layout-cell {
    display: block;
    width: 100%;
}
.trip-table-wrap:has(.dt-container) { overflow: visible; }

.dt-container .dt-search,
.dt-container .dt-length {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.dt-container .dt-search label,
.dt-container .dt-length label {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.dt-container .dt-search input {
    width: 220px;
    min-width: 0;
    max-width: 100%;
    height: 40px;
    margin: 0 !important;
    border: 1px solid #dce4ed !important;
    border-radius: 9px !important;
    padding: 8px 12px !important;
    background: #fff !important;
    font: inherit;
}
.dt-container .dt-search input:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}
.dt-container .dt-length .select2-container {
    width: 76px !important;
    flex-shrink: 0;
    margin: 0 4px;
    vertical-align: middle;
}
.dt-container .dt-length .select2-selection--single { min-height: 40px; }
.dt-container .dt-length .select2-selection__rendered {
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 13px;
}

.dt-container table.dataTable { width: 100% !important; margin: 0; }
table[data-server-table] { min-width: 600px; }
.dt-container td { padding: 14px 18px !important; }
.dt-container td small { display: block; color: #64748b; margin-top: 3px; }
.dt-container td a { font-weight: 700; color: #0077b6; }
.dt-container td.dt-empty {
    padding: 42px 20px !important;
    text-align: center;
    color: #8292a2;
    font-size: 13px;
}
.dt-container .dt-info { padding: 0; color: #718397; font-size: 12px; }
.dt-container .dt-paging { max-width: 100%; }
.dt-container .dt-paging nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
}
.dt-container .dt-paging .dt-paging-button {
    min-width: 34px;
    margin: 0 !important;
    padding: 7px 10px !important;
    border-radius: 8px !important;
    font-size: 12px;
    white-space: nowrap;
}
.dt-container .dt-paging .dt-paging-button.current {
    background: #edf6ff !important;
    border-color: #dbe7f1 !important;
}
.table-error {
    color: #b91c1c;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    padding: 12px;
    border-radius: 10px;
    margin: 10px 0;
}

/* The legacy trip card rules must not change DataTables rows at tablet widths. */
table[data-server-table].trip-table { display: table; }
table[data-server-table].trip-table thead { display: table-header-group; }
table[data-server-table].trip-table tbody { display: table-row-group; }
table[data-server-table].trip-table tr { display: table-row; padding: 0; }
table[data-server-table].trip-table caption { display: table-caption; }
table[data-server-table].trip-table td { display: table-cell; text-align: left; }
table[data-server-table].trip-table td::before { display: none; }
table[data-server-table].trip-table td.dt-empty { text-align: center; }

@media (max-width: 720px) {
    div.dt-container div.dt-layout-row:not(.dt-layout-table) { padding: 14px 16px; }
    .dt-container .dt-search input { width: 180px; }
}
@media (max-width: 520px) {
    div.dt-container div.dt-layout-row:not(.dt-layout-table) {
        justify-content: flex-start;
        gap: 14px;
    }
    div.dt-container div.dt-layout-row:not(.dt-layout-table) div.dt-layout-cell {
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }
    .dt-container .dt-search { width: 100%; }
    .dt-container .dt-search input { width: 100%; flex: 1; font-size: 16px; }
    .dt-container .dt-paging { width: 100%; }
    .dt-container .dt-paging nav { justify-content: flex-start; }
    .dt-container .dt-paging .dt-paging-button.first,
    .dt-container .dt-paging .dt-paging-button.last { display: none; }
    table[data-server-table].trip-table:has(td.dt-empty) { min-width: 100%; }
    table[data-server-table].trip-table:has(td.dt-empty) thead { display: none; }
}

/* Match admin table headings to the navy workspace navigation. */
.admin-shell .dt-container table.dataTable thead > tr > th {
    background: #103d66 !important;
    color: #f8fbff !important;
    border-bottom: 1px solid #204e76 !important;
    padding: 15px 18px !important;
    text-align: center !important;
    vertical-align: middle;
    font-size: 11px !important;
    font-weight: 750 !important;
    letter-spacing: .045em !important;
}
.admin-shell .dt-container table.dataTable thead > tr > th:first-child { border-top-left-radius: 10px; }
.admin-shell .dt-container table.dataTable thead > tr > th:last-child { border-top-right-radius: 10px; }
.admin-shell .dt-container table.dataTable thead > tr > th:is(.dt-ordering-asc,.dt-ordering-desc) { background: #174d79 !important; }
.admin-shell .dt-container table.dataTable thead > tr > th:is(.dt-orderable-asc,.dt-orderable-desc):hover { background: #1b527e !important; }
.admin-shell .dt-container table.dataTable thead .dt-column-order { color: #c5e6fa; }
.admin-shell .dt-container table.dataTable thead .dt-column-order::before,
.admin-shell .dt-container table.dataTable thead .dt-column-order::after { opacity: .45; }
.admin-shell .dt-container table.dataTable thead .dt-ordering-asc .dt-column-order::before,
.admin-shell .dt-container table.dataTable thead .dt-ordering-desc .dt-column-order::after { opacity: 1; color: #fff; }
.admin-shell .dt-container table.dataTable thead [tabindex]:focus-visible { outline: 2px solid #7dd3fc; outline-offset: -4px; border-radius: 5px; }

.admin-shell .dt-container table.dataTable thead .dt-column-title { display: inline-block; vertical-align: middle; }
.admin-shell .dt-container table.dataTable thead th:is(.dt-orderable-asc,.dt-orderable-desc) .dt-column-order {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    right: auto;
    top: auto;
    bottom: auto;
    width: 12px;
    height: 18px;
    margin-left: 7px;
}

/* Keep all DataTables values aligned with their centered column headings. */
.dt-container table.dataTable tbody > tr > td {
    text-align: center !important;
    vertical-align: middle;
}

.table-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}
.table-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.table-status.is-open { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.table-status.is-full { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.table-status.is-declared { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
