/* =========================================================
   TABLES
========================================================= */
.table-wrap{
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 16px;
    width: 100%;
}

.table-wrap table{
    width: 100%;
    font-size: var(--font-sm);
    border-collapse: collapse;
    table-layout: fixed;
}

table[data-sortable="1"] thead th.table-sortable-th{
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-right: 28px;
}

table[data-sortable="1"] thead th.table-sortable-th::after{
    content: "↕";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-xs);
    line-height: 1;
    opacity: 0.35;
}

table[data-sortable="1"] thead th.table-sortable-th[data-sort-dir="asc"]::after{
    content: "↑";
    opacity: 0.9;
}

table[data-sortable="1"] thead th.table-sortable-th[data-sort-dir="desc"]::after{
    content: "↓";
    opacity: 0.9;
}

table[data-sortable="1"] thead th.table-sortable-th[data-sort-priority]:not([data-sort-priority="1"])::before{
    content: attr(data-sort-priority);
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #1f3a70;
    color: #fff;
    font-size: var(--font-xs);
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

table[data-sortable="1"] thead th.table-sort-active{
    color: #0f172a;
}

table[data-sortable="1"] thead th.table-sortable-th:focus-visible{
    outline: 2px solid #4f46e5;
    outline-offset: -2px;
}

.export-dual-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.export-list-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.export-list-tools{
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.export-scroll-list{
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    max-height: 320px;
    overflow: auto;
    padding: 10px;
}

.export-scroll-list-fields{
    max-height: 380px;
}

.export-check-item{
    margin-bottom: 8px;
}

.export-check-item:last-child{
    margin-bottom: 0;
}

.export-field-group{
    margin-bottom: 12px;
}

.export-field-group:last-child{
    margin-bottom: 0;
}

.export-field-group-title{
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    padding: 2px 0 6px;
    font-size: var(--font-xs);
    font-weight: 700;
    color: #475569;
}

@media (max-width: 900px){
    .export-dual-grid{
        grid-template-columns: 1fr;
    }

    .export-list-head{
        flex-direction: column;
        align-items: flex-start;
    }

    .export-scroll-list{
        max-height: 260px;
    }
}

@media (min-width: 901px){
    .responsive-table th.col-actions:last-child,
    .responsive-table td.col-actions:last-child{
        width: 1%;
        min-width: 1%;
        white-space: nowrap;
        text-align: right;
    }

    #employee-doc-upload-form + .table-wrap .doc-table th:last-child,
    #employee-doc-upload-form + .table-wrap .doc-table td.doc-actions{
        width: 300px;
        min-width: 300px;
    }

    #employee-doc-upload-form + .table-wrap .doc-table .doc-actions-group{
        flex-wrap: nowrap;
        white-space: nowrap;
    }
}

/* Admin projektvisning: kolonneankre (kun desktop) */
@media (min-width: 1201px){
    :root{
        --project-view-col-date: 100px;
        --project-view-col-employee: 264px;
        --project-view-col-pre-status: 96px;
        --project-view-col-status: 150px;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table{
        width: 100%;
        table-layout: fixed;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table :is(th, td){
        line-height: 1.3;
        white-space: normal;
        word-break: normal;
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table col.pv-col-date{
        width: var(--project-view-col-date);
        min-width: var(--project-view-col-date);
        max-width: var(--project-view-col-date);
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table col.pv-col-employee{
        width: var(--project-view-col-employee);
        min-width: var(--project-view-col-employee);
        max-width: var(--project-view-col-employee);
    }

    #section-timer .project-view-table col.pv-col-status,
    #section-korsel .project-view-table col.pv-col-status,
    #section-diaeter .project-view-table col.pv-col-status,
    #section-udlaeg .project-view-table col.pv-col-status{
        width: var(--project-view-col-status) !important;
        min-width: var(--project-view-col-status) !important;
        max-width: var(--project-view-col-status) !important;
    }

    #section-timer .project-view-table col.pv-col-pre-status,
    #section-korsel .project-view-table col.pv-col-pre-status,
    #section-diaeter .project-view-table col.pv-col-pre-status{
        width: var(--project-view-col-pre-status) !important;
        min-width: var(--project-view-col-pre-status) !important;
        max-width: var(--project-view-col-pre-status) !important;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table :is(
        col.pv-col-small,
        col.pv-col-pre-status,
        col.pv-col-korsel-from,
        col.pv-col-korsel-to,
        col.pv-col-korsel-km,
        col.pv-col-korsel-normal,
        col.pv-col-diaeter-from,
        col.pv-col-diaeter-to,
        col.pv-col-diaeter-days,
        col.pv-col-diaeter-extra,
        col.pv-col-udlaeg-amount,
        col.pv-col-udlaeg-desc
    ){
        width: auto;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table :is(
        th:nth-child(1),
        th:nth-child(2),
        th:nth-child(3),
        td[data-label="Dato"],
        td[data-label="Medarbejder"],
        td:nth-child(3),
        th.col-status,
        td.col-status,
        td.col-status-badge
    ){
        white-space: nowrap;
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
    }

    #section-korsel .project-view-table td.pv-address{
        white-space: normal;
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
    }

    #section-timer .project-view-table th.col-status,
    #section-timer .project-view-table td.col-status,
    #section-timer .project-view-table td.col-status-badge,
    #section-korsel .project-view-table th.col-status,
    #section-korsel .project-view-table td.col-status,
    #section-korsel .project-view-table td.col-status-badge,
    #section-diaeter .project-view-table th.col-status,
    #section-diaeter .project-view-table td.col-status,
    #section-diaeter .project-view-table td.col-status-badge,
    #section-udlaeg .project-view-table th.col-status,
    #section-udlaeg .project-view-table td.col-status,
    #section-udlaeg .project-view-table td.col-status-badge{
        width: var(--project-view-col-status) !important;
        min-width: var(--project-view-col-status) !important;
        max-width: var(--project-view-col-status) !important;
        text-align: left;
    }

    #section-timer .project-view-table :is(th:nth-child(n+3):nth-child(-n+11), td:nth-child(n+3):nth-child(-n+11)){
        padding-left: 6px;
        padding-right: 6px;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-actions{
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        margin-top: 6px;
        margin-left: 0;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-actions form{
        margin: 0;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-btn{
        min-width: 40px;
        width: 40px;
        height: 36px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: var(--font-lg);
        line-height: 1;
    }

    :is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-btn.approval-icon-btn-approve{
        min-width: 60px;
        width: 60px;
    }
}

:is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-actions{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

:is(#section-timer, #section-korsel, #section-diaeter, #section-udlaeg) .project-view-table td.col-status-badge .approval-icon-actions form{
    margin: 0;
}

#section-medarbejdere .project-view-employees-table{
    table-layout: auto !important;
}

#section-medarbejdere .project-view-employees-table th,
#section-medarbejdere .project-view-employees-table td{
    line-height: 1.3;
}

#section-medarbejdere .project-view-employees-table .project-employee-main-cell{
    cursor: pointer;
}

#section-medarbejdere .project-view-employees-table .project-employee-info-cell{
    cursor: pointer;
}

#section-medarbejdere .project-view-employees-table .project-employee-info-cell:first-of-type{
    border-left: 2px solid #dbe2f0;
}

#section-medarbejdere .project-view-employees-table tr:hover .project-employee-main-cell{
    background: #f8fafc;
}

#section-medarbejdere .project-view-employees-table tr:hover .project-employee-info-cell{
    background: #f8fafc;
}

/* Col 3: Tlf — narrow */
#section-medarbejdere .project-view-employees-table th:nth-child(3),
#section-medarbejdere .project-view-employees-table td:nth-child(3){
    width: 1%;
    white-space: nowrap;
}

/* Col 4: Perioder — give room */
#section-medarbejdere .project-view-employees-table th:nth-child(4),
#section-medarbejdere .project-view-employees-table td:nth-child(4){
    min-width: 220px;
    white-space: normal;
    word-break: break-word;
}

/* Col 5: Hoteller — give room */
#section-medarbejdere .project-view-employees-table th:nth-child(5),
#section-medarbejdere .project-view-employees-table td:nth-child(5){
    min-width: 220px;
    white-space: normal;
    word-break: break-word;
}

.section-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.section-header h3{
    margin: 0;
}

.section-actions{
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.cost-details-inner{
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
}

.outlay-file-preview{
    display: none;
}

thead{ background: #f1f5f9; }

th{
    text-align:left;
    padding: 12px 16px;
    font-weight: 700;
    color:#334155;
}

td{
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    word-break: break-word;
    vertical-align: middle;
}

.intake-table th:last-child{
    text-align: left;
}
.intake-table td:last-child{
    text-align: right;
}
@media (min-width: 901px){
    .intake-table.responsive-table th.col-actions:last-child,
    .intake-table.responsive-table td.col-actions:last-child{
        width: 190px;
        min-width: 190px;
        white-space: nowrap;
    }
}
.intake-table td.col-actions .btn-group{
    margin-top: 0;
    gap: 8px;
    justify-content: flex-end;
}

.col-status{
    text-align: left;
    width: 120px;
}

.col-status-badge .badge{
    display: inline-flex;
    width: auto;
}

/* Medarbejderliste: afbalanceret kolonnefordeling (prototypens udtryk).
   Certifikater har ingen fast bredde og optager restpladsen — de øvrige
   holdes kompakte, så felterne fordeler sig jævnt. */
.employee-table th.col-no{ width: 56px; }
.employee-table th.col-name{ width: 190px; }
.employee-table th.col-email{ width: 250px; }
.employee-table th.col-phone{ width: 120px; }
.employee-table th.col-documents{ width: 160px; }
.employee-table th.col-status{ width: 110px; }
.employee-table th.col-actions{ width: 110px; }

.time-type-actions{
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.time-type-actions form{
    margin: 0;
}

@media (min-width: 901px){
    .time-types-table{
        table-layout: auto !important;
    }

    .time-types-table th.col-time-type-actions,
    .time-types-table td.col-time-type-actions{
        width: 1%;
        min-width: 220px;
        white-space: nowrap;
        text-align: right;
    }

    .time-type-actions{
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .asset-suppliers-table,
    .asset-prices-table{
        table-layout: auto !important;
    }

    .asset-suppliers-table col.asset-col-status-width,
    .asset-prices-table col.asset-col-status-width{
        width: 120px;
    }

    .asset-suppliers-table col.asset-col-actions-width,
    .asset-prices-table col.asset-col-actions-width{
        width: 170px;
    }

    .asset-suppliers-table th.asset-col-status,
    .asset-prices-table th.asset-col-status,
    .asset-suppliers-table td.asset-col-status,
    .asset-prices-table td.asset-col-status{
        width: 120px;
        min-width: 120px;
        white-space: nowrap;
        text-align: right;
    }

    .asset-suppliers-table th.asset-col-actions,
    .asset-prices-table th.asset-col-actions,
    .asset-suppliers-table td.asset-col-actions,
    .asset-prices-table td.asset-col-actions{
        width: 170px;
        min-width: 170px;
        white-space: nowrap;
        text-align: right;
        display: table-cell !important;
    }

    .asset-suppliers-table td.asset-col-status .badge,
    .asset-prices-table td.asset-col-status .badge{
        margin-left: auto;
    }

    .asset-suppliers-table td.asset-col-actions .time-type-actions,
    .asset-prices-table td.asset-col-actions .time-type-actions{
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
}

body.hours-modal-open{
    overflow: hidden;
}

.hours-edit-modal{
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
}

.hours-edit-modal.is-open{
    display: block;
}

.hours-edit-modal-overlay{
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.48);
    backdrop-filter: blur(1px);
}

.hours-edit-modal-dialog{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(960px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    background: #f8fafc;
    border: 1px solid #dbe3f4;
    border-radius: 16px;
    box-shadow: 0 20px 56px rgba(15, 23, 42, 0.34);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hours-edit-modal-body{
    padding: 18px;
    overflow: auto;
}

.hours-edit-modal-loading{
    padding: 28px 14px;
    text-align: center;
    color: #64748b;
    font-weight: 600;
}

.hours-edit-modal-head{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

/* ensartet kolonnebredde for pending oversigt */
.pending-table th:nth-child(1),
.pending-table td:nth-child(1){ width: 140px; }
.pending-table th:nth-child(2),
.pending-table td:nth-child(2){ width: 220px; }
.pending-table th:nth-child(3),
.pending-table td:nth-child(3){ width: 160px; }
.pending-table th:nth-child(4),
.pending-table td:nth-child(4){ width: 220px; }

tr:hover td{ background: #f8fafc; }

table tr.row-total td {
    border-top: 2px solid var(--border, #e5e7eb);
    background: var(--row-total-bg, #f9fafb);
}

.pe-period-line, .pe-hotel-line { display:block; padding:2px 0; }
.pe-tag { display:inline-block; font-size:11px; padding:1px 6px; border-radius:6px; background:#eef; color:#334; margin-left:4px; white-space:nowrap; }
.pe-tag-done { background:#e6f6ea; color:#1c7a3c; }

