:root {
    /* Einheitliche Breite für die Status spalte in allen Tabellen */
    --report-status-col-width: 24rem;
}

/* Tabellen-Basis */
.table-vanilla thead th {
    white-space: nowrap;
}

.table-wrapper {
    margin-bottom: 0.5rem;
}

.table-responsive.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-vanilla {
    margin-bottom: 0;
}

.table-vanilla.table-fixed {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-vanilla.table-fixed th,
.table-vanilla.table-fixed td {
    white-space: nowrap;
}

.table-vanilla.table-fixed th:not(.report-actions-col):not(.report-date-col):not(.report-status-col),
.table-vanilla.table-fixed td:not(.report-actions-col):not(.report-date-col):not(.report-status-col) {
    min-width: 11rem;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-actions-col {
    /* keep actions as small as content allows */
    width: 1%;
    min-width: 0;
    white-space: nowrap;
}

.report-date-col {
    width: 140px;
    min-width: 140px;
}

.report-status-col {
    width: var(--report-status-col-width);
    min-width: var(--report-status-col-width);
}

/* Status-Pills */
.admin-report-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.admin-report-status.report-status-open {
    background-color: lightgray;
    color: #212529;
}

.admin-report-status.report-status-uploaded {
    background-color: var(--scp-orange);
    color: #212529;
}

.admin-report-status.report-status-upload_processed {
    background-color: var(--scp-yellow);
    color: #212529;
}

.admin-report-status.report-status-in_process {
    background-color: var(--scp-green);
    color: #212529;
}

.admin-report-status.report-status-returned {
    background-color: pink;
    color: #212529;
}

.admin-report-status.report-status-approved {
    background-color: lightseagreen;
    color: #212529;
}

.admin-report-status.report-status-exported {
    background-color: var(--scp-dark-blue);
    color: white;
}

/* Aktionsbuttons */
.admin-report-action {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
}

.admin-report-action .action-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--scp-blue);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
    text-align: center;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid var(--scp-blue);
    text-decoration: none;
    transition: background-color 0.3s;
}

.admin-report-action .action-item:focus-visible {
    outline: 2px solid var(--scp-dark-blue);
    outline-offset: 1px;
}

.admin-report-action .action-item:hover {
    background-color: var(--scp-dark-blue);
    border-color: var(--scp-dark-blue);
    color: white;
}

.admin-report-action .action-item--disabled {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #adb5bd;
    cursor: not-allowed;
}

.admin-report-action.table-actions--icon .action-item {
    width: 2rem;
    min-width: 2rem;
    padding: 0.25rem;
    background-color: #fff;
    border-color: #dee2e6;
    color: #212529;
}

.admin-report-action.table-actions--icon {
    flex-wrap: nowrap;
    white-space: nowrap;
}

.admin-report-action.table-actions--icon .action-item:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

.admin-report-action.table-actions--icon .action-item--disabled {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #adb5bd;
}

.admin-report-action .action-item.report-action-process_upload {
    background-color: var(--scp-blue);
    border-color: var(--scp-blue);
    color: white;
}

.admin-report-action .action-item.report-action-process_upload:hover {
    background-color: var(--scp-dark-blue);
    border-color: var(--scp-dark-blue);
    color: white;
}

.admin-report-action .action-item.report-action-process {
    background-color: var(--scp-warning);
    border-color: var(--scp-warning);
    color: #212529;
}

.admin-report-action .action-item.report-action-process:hover {
    background-color: var(--scp-warning-dark);
    border-color: var(--scp-warning-dark);
    color: #212529;
}

.admin-report-action .action-item.report-action-upload_processed,
.admin-report-action .action-item.report-action-approve {
    background-color: var(--scp-success);
    border-color: var(--scp-success);
    color: white;
}

.admin-report-action .action-item.report-action-upload_processed:hover,
.admin-report-action .action-item.report-action-approve:hover {
    background-color: var(--scp-success-dark);
    border-color: var(--scp-success-dark);
    color: white;
}

.admin-report-action .action-item.report-action-process_abort {
    background-color: var(--scp-danger);
    border-color: var(--scp-danger);
    color: white;
}

.admin-report-action .action-item.report-action-process_abort:hover {
    background-color: var(--scp-danger-dark);
    border-color: var(--scp-danger-dark);
    color: white;
}

.admin-report-action .action-item.report-action-return,
.admin-report-action .action-item.report-action-returned {
    background-color: var(--scp-orange);
    border-color: var(--scp-orange);
    color: #212529;
}

.admin-report-action .action-item.report-action-return:hover,
.admin-report-action .action-item.report-action-returned:hover {
    background-color: var(--scp-orange-dark);
    border-color: var(--scp-orange-dark);
    color: #212529;
}

.admin-report-action .action-item.report-action-export {
    background-color: var(--scp-dark-blue);
    border-color: var(--scp-dark-blue);
    color: white;
}

/* Tabellen-Zellen */
.table-cell-submitted {
    min-width: 12rem;
}

.table-submitted-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--scp-blue);
    text-decoration: none;
}

.table-submitted-link:hover {
    color: var(--scp-dark-blue);
    text-decoration: underline;
}

.table-submitted-date {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

.authority-comment-icon {
    color: var(--scp-blue);
    margin-left: 0.5rem;
    cursor: pointer;
}

.authority-comment-icon:hover {
    color: var(--scp-dark-blue);
}

/* Tabellen-Steuerung (Stimulus table-controller) */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.table-controls-left,
.table-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-controls input[type="search"] {
    width: 20rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
}

.table-controls .btn {
    font-weight: 700;
    padding: 0.375rem 0.9rem;
    line-height: 1.5;
    white-space: nowrap;
}

.table-controls .btn i,
.table-pagination .btn i {
    line-height: 1;
}

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-pagination-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-pagination-actions .btn {
    font-weight: 700;
    padding: 0.375rem 0.9rem;
    white-space: nowrap;
}

.table-pagination-info {
    white-space: nowrap;
}

.table-controls-right label {
    white-space: nowrap;
}

.table-controls-right select {
    min-width: 5.5rem;
    width: auto;
    white-space: nowrap;
    flex: 0 0 auto;
}

.table-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
}

.table-sortable::after {
    content: "↕";
    position: absolute;
    right: 0.5rem;
    opacity: 0.4;
}

.table-sortable.table-sort-asc::after {
    content: "↑";
    opacity: 0.9;
}

.table-sortable.table-sort-desc::after {
    content: "↓";
    opacity: 0.9;
}

.table-skeleton-row td {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.table-skeleton-line {
    display: block;
    height: 0.95rem;
    border-radius: 0.375rem;
    background: linear-gradient(90deg, #eceff3 25%, #f6f7f9 50%, #eceff3 75%);
    background-size: 200% 100%;
    animation: table-skeleton-shimmer 1.2s linear infinite;
}

@keyframes table-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.table-error {
    background-color: #f8d7da !important;
}
