/* =========================================================
   EMPLOYEE DASHBOARD
========================================================= */
.dashboard{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}
@media (max-width: 1200px){
    .dashboard{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 600px){
    .dashboard{ grid-template-columns: 1fr; gap: 10px; }
}
.dashboard .card{
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}
.details-box{
    display: none;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}
.details-box div{
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}
.details-box div:last-child{
    border-bottom: none;
}

/* Fix: vis details-box når accordionen er åben */
.accordion-open .details-box {
    display: block;
}

/* ── Summary stat cards (uge-overblik, bunden af dashboard) ─── */
.summary-card {
    padding: 16px;
}
.summary-card .accordion-header {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    user-select: none;
}
.sc-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.summary-card--orange .sc-icon { background: rgba(255, 149,  0, 0.14); }
.summary-card--blue   .sc-icon { background: rgba(  0, 122,255, 0.12); }
.summary-card--green  .sc-icon { background: rgba( 52, 199, 89, 0.14); }
.summary-card--purple .sc-icon { background: rgba( 88,  86,214, 0.12); }
.sc-body {
    flex: 1;
    min-width: 0;
}
.sc-label {
    display: block;
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}
.sc-value {
    display: block;
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}
.summary-card .accordion-chevron {
    color: var(--muted);
    font-size: var(--font-xl);
    flex-shrink: 0;
    transition: transform var(--duration-fast) var(--ease-ios);
}
.accordion-open.summary-card .accordion-chevron {
    transform: rotate(90deg) !important;
}
.summary-card .details-box {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: none;
}
.accordion-open.summary-card .details-box {
    display: block;
}
.sc-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: var(--font-sm);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.sc-detail-row:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}
.sc-detail-date {
    font-weight: 500;
    color: var(--text-secondary);
}
.sc-detail-val {
    font-weight: 600;
    color: var(--text);
}
.sc-detail-dates {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* =========================================================
   EMPLOYEE LISTS (MOBILE)
========================================================= */
@media (max-width: 768px){
    .list-table thead{ display:none; }
    .list-table, .list-table tbody, .list-table tr, .list-table td{
        display:block;
        width:100%;
    }
    .list-table tr{
        position:relative;
        border-top:1px solid #e2e8f0;
        padding:12px;
        border-radius:12px;
        margin:10px 0;
        background:#fff;
    }
    .list-table td{
        border-top:none;
        padding:6px 0 6px calc(var(--mobile-label-width) + 10px);
        position: relative;
    }
    .list-table td::before{
        content: attr(data-label) ": ";
        font-weight:700;
        color:#334155;
        position: absolute;
        left: 0;
        top: 6px;
        width: var(--mobile-label-width);
        white-space: nowrap;
    }

    .list-table .col-actions,
    .list-table .edit-btn{
        display:none !important;
    }

    .tap-row{
        cursor:pointer;
        touch-action: manipulation;
    }
    .tap-row:active{
        background:#f1f5f9;
    }
    .tap-row.locked{
        cursor:default;
    }
    .tap-row:not(.locked):active{
        background:#f1f5f9;
    }

    .outlay-list-table tr.has-file-preview{
        position: relative;
        --preview-width: clamp(84px, 26vw, 132px);
        --preview-height: clamp(110px, 34vw, 170px);
        padding-right: calc(var(--preview-width) + 24px);
        min-height: calc(var(--preview-height) + 24px);
    }
    .outlay-list-table td.outlay-file-cell{
        padding-top: 2px;
        padding-left: 0;
        position: static;
        display: grid;
        grid-template-columns: var(--mobile-label-width) 1fr;
        align-items: center;
        gap: 8px;
    }
    .outlay-list-table td.outlay-file-cell::before{
        position: static;
        width: auto;
        white-space: nowrap;
    }
    .outlay-file-actions{
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        grid-column: 2;
        justify-self: start;
    }
    .outlay-file-actions .btn{
        width: auto;
        min-width: 88px;
        padding: 8px 10px;
    }
    .outlay-file-preview{
        display: block;
        position: absolute;
        right: 12px;
        top: 12px;
        width: var(--preview-width);
        height: var(--preview-height);
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #ffffff;
        overflow: hidden;
        pointer-events: none;
    }
    .outlay-file-preview::after{
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(248, 250, 252, 0);
        transition: background .15s ease;
    }
    .outlay-list-table tr:hover,
    .outlay-list-table tr:active{
        background:#f1f5f9;
    }
    .outlay-list-table tr:hover td,
    .outlay-list-table tr:active td{
        background:#f1f5f9;
    }
    .outlay-list-table tr:hover .outlay-file-preview,
    .outlay-list-table tr:active .outlay-file-preview{
        background: #f1f5f9;
        border-color:#e2e8f0;
    }
    .outlay-list-table tr:hover .outlay-file-preview::after,
    .outlay-list-table tr:active .outlay-file-preview::after{
        background: rgba(241, 245, 249, 0);
    }
    .outlay-list-table tr:hover .outlay-file-preview img,
    .outlay-list-table tr:active .outlay-file-preview img{
        opacity: 0.8;
    }
    .outlay-file-preview img,
    .outlay-file-preview object{
        width: 100%;
        height: 100%;
        border: 0;
        display: block;
        object-fit: cover;
    }
    .outlay-file-preview .file-preview-fallback{
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        color: #475569;
        background: #f1f5f9;
    }
}

/* =========================================================
   EMPLOYEE DRIVING LIST — COLUMN WIDTHS (DESKTOP)
========================================================= */
.driving-table { table-layout: fixed; width: 100%; }
/* Projekt */
.driving-table th:nth-child(1), .driving-table td:nth-child(1) { width: 220px; }
/* Dato */
.driving-table th:nth-child(2), .driving-table td:nth-child(2) { width: 130px; white-space: nowrap; }
/* Tid */
.driving-table th:nth-child(3), .driving-table td:nth-child(3) { width: 130px; white-space: nowrap; }
/* Fra / Til — auto: fylder resten */
.driving-table th:nth-child(4), .driving-table td:nth-child(4) { width: auto; }
/* Km */
.driving-table th:nth-child(5), .driving-table td:nth-child(5) { width: 150px; }
/* Køretid */
.driving-table th:nth-child(6), .driving-table td:nth-child(6) { width: 250px; }
/* Status */
.driving-table th:nth-child(7), .driving-table td:nth-child(7) { width: 200px; }

/* =========================================================
   EMPLOYEE DRIVING LIST (MOBILE)
========================================================= */
@media (max-width: 768px){
    .driving-table thead{ display:none; }
    .driving-table, .driving-table tbody, .driving-table tr, .driving-table td{
        display:block;
        width:100%;
    }
    .driving-table tr{
        position:relative;
        border-top:1px solid #e2e8f0;
        padding:12px;
        border-radius:12px;
        margin:10px 0;
        background:#fff;
    }
    .driving-table td{
        border-top:none;
        padding:6px 0 6px calc(var(--mobile-label-width) + 10px);
        position: relative;
    }
    .driving-table td::before{
        content: attr(data-label) ": ";
        font-weight:700;
        color:#334155;
        position: absolute;
        left: 0;
        top: 6px;
        width: var(--mobile-label-width);
        white-space: nowrap;
    }

    .driving-table td.col-actions::before{
        content: "";
        display: none;
    }
    .driving-table td.col-actions{
        padding-left: 0;
    }

    .driving-table .from-to-block{
        display:inline-block;
        vertical-align: top;
    }

    .driving-table .edit-btn{ display:none !important; }
    .driving-table .col-actions{
        padding:0 !important;
        border:0 !important;
    }

    .driving-row:not(.locked) .row-overlay-link{
        position:absolute;
        inset:0;
        z-index:5;
        display:block;
        border-radius:12px;
        background:transparent;
        touch-action: pan-y;
        -webkit-tap-highlight-color: rgba(37,99,235,0.18);
    }

    .driving-row.locked .row-overlay-link{ display:none; }

    .driving-row:not(.locked):active{
        background:#f1f5f9;
    }
}

/* =========================================================
   ADMIN HOURS EDIT (MOBILE)
========================================================= */
@media (max-width: 768px){
    .hours-edit-grid{
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   ADMIN NOTIFIKATIONER
========================================================= */
.notification-card{
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}
.notification-head{
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}
.notification-title{
    font-weight: 700;
    font-size: var(--font-input);
}
.notification-title a{
    color: #0f172a;
    text-decoration: none;
}
.notification-title a:hover{
    text-decoration: underline;
}
.notification-actions{
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
@media (min-width: 769px){
    .delete-inline-form{
        display: inline-block;
        margin-top: 0;
    }
    .delete-inline-form .btn{
        width: auto;
    }
    .delete-inline-form .btn.btn-full{
        width: auto;
    }
    .btn-group .btn.btn-full{
        width: auto;
    }
}

/* =========================================================
   iOS / iPhone-inspirerede design-forbedringer
========================================================= */

/* ── Focus-visible (tastatur-navigation) ───────────────── */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ── Badge — bedre kontrast for warning ────────────────── */
.badge.warning {
    background: #fff3cd;
    color: #7c5a00;
}

/* ── Knap: haptic-feel tryk-effekt ─────────────────────── */
.btn:active {
    transform: scale(0.97);
    transition: transform 80ms var(--ease-ios);
}

/* ── Accordion animation ───────────────────────────────── */
.accordion-chevron {
    display: inline-block;
    transition: transform var(--duration-fast) var(--ease-ios);
    font-style: normal;
}
.accordion-open .accordion-chevron {
    transform: rotate(90deg);
}

/* ── Day-card: dagens dato fremhævet ──────────────────── */
.day-card {
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    transition: box-shadow var(--duration-fast) var(--ease-ios);
}
.day-card--today {
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1), var(--shadow);
}
.day-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.day-card-label {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
}
.day-card-label--today {
    color: var(--primary);
}
.today-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}
.empty-state-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-state-text {
    font-size: var(--font-sm);
    color: var(--muted);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto 20px;
}

/* ── FAB — Floating Action Button ──────────────────────── */
.fab {
    position: fixed;
    bottom: calc(49px + env(safe-area-inset-bottom, 0px) + 16px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.40);
    text-decoration: none;
    z-index: 200;
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast) var(--ease-ios);
}
.fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(0, 122, 255, 0.50);
}
.fab:active {
    transform: scale(0.93);
}

/* Skjul FAB på desktop (sidebar giver navigation der) */
@media (min-width: 769px) {
    .fab { display: none; }
}

/* ── Page-actions højre-side justering ─────────────────── */
.page-actions-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Kort: let tryk-feedback på mobil ──────────────────── */
.card {
    transition: box-shadow var(--duration-fast) var(--ease-ios);
}
@media (hover: none) {
    .card:active {
        box-shadow: var(--shadow-md);
    }
}

/* === HISTORY MODAL STATS === */
.history-stats {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 12px 0 16px;
    background: #fafbfc;
}
.history-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px;
    gap: 4px;
}
.history-stat + .history-stat {
    border-left: 1px solid var(--border);
}
.history-stat-value {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.history-stat-label {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* === HISTORY TABLE: VOID ACTION === */
.history-row-status {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-void-issue {
    background: none;
    border: 1px solid rgba(255, 59, 48, 0.35);
    border-radius: 6px;
    padding: 3px 9px;
    font-size: var(--font-xs);
    font-weight: 600;
    color: #e0291c;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}
.btn-void-issue:hover {
    background: rgba(255, 59, 48, 0.07);
    border-color: rgba(255, 59, 48, 0.55);
}
.void-confirm-row td {
    background: #fff8f7;
    padding: 10px 14px !important;
    border-top: 1px solid rgba(255, 59, 48, 0.15) !important;
}
.void-confirm-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.void-confirm-label {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.void-reason-input {
    flex: 1;
    min-width: 130px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: var(--font-sm);
    font-family: inherit;
    background: #fff;
}
.history-action-cell {
    white-space: nowrap;
    width: 1%;
    text-align: right;
}
.history-row-voided td {
    opacity: 0.45;
}
.history-voided-label {
    font-size: var(--font-xs);
    color: var(--muted);
    font-style: italic;
}

/* Asset "Tilbage tag"-knap: blå primary-stil, mindre påtrængende end Annullér. */
.btn-return-issue {
    background: transparent;
    color: var(--primary, #007aff);
    border: 1px solid var(--primary, #007aff);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 4px;
}
.btn-return-issue:hover {
    background: var(--primary-light, #e8f2ff);
}

/* Inline retur-form */
.return-confirm-row td {
    background: #f0f6ff;
    padding: 10px 14px !important;
    border-top: 1px solid rgba(0, 122, 255, 0.15) !important;
}
.return-confirm-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}
.return-confirm-label {
    font-size: 12px;
    color: var(--muted, #6d6d72);
    font-weight: 600;
}
.return-date-input,
.return-note-input {
    padding: 4px 8px;
    border: 1px solid var(--border, #e5e5ea);
    border-radius: 6px;
    font-size: 13px;
}
.return-reason-select {
    padding: 4px 8px;
    border: 1px solid var(--border, #e5e5ea);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

/* "Returneret X · Årsag"-label */
.history-returned-label {
    font-size: 12px;
    color: var(--warning, #cc6f00);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   Admin Samlet Overblik
   ═══════════════════════════════════════════════════════════════ */

.overview-period-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.overview-period-label {
    font-weight: 600;
    font-size: var(--font-body);
    min-width: 180px;
    text-align: center;
}
.overview-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.overview-summary-card {
    background: var(--card, #fff);
    border-radius: var(--radius, 8px);
    padding: 16px;
    box-shadow: var(--shadow, 0 1px 4px rgba(0,0,0,.08));
    text-align: center;
}
.overview-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.overview-card-header .badge {
    font-size: var(--font-xs);
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

.overview-card-title {
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted, #8e8e93);
    font-weight: 600;
}

.overview-card-value {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--text, #1c1c1e);
}

.overview-card-count {
    font-size: var(--font-sm);
    color: var(--muted, #8e8e93);
    margin-top: 2px;
}

.overview-card-breakdown {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border, #e5e5ea);
    text-align: left;
}

.overview-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: var(--font-xs);
    color: var(--muted, #8e8e93);
}

.overview-breakdown-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.overview-breakdown-value {
    font-weight: 600;
    color: var(--text, #1c1c1e);
    white-space: nowrap;
}

/* ── Efterslæbs-card (kun employee-mode, kun når der er efterslæb) ── */
.overview-summary-card.type-backlog {
    border-top: 3px solid #ff9500;
    background: #fff8ec;
}
.overview-summary-card.type-backlog .overview-card-title {
    color: #cc6f00;
}
.overview-summary-card.type-backlog .overview-card-value {
    color: #1c1c1e;
}

/* ── Efterslæb detalje-folder (uden for grid'et, under det) ── */
.overview-backlog-detail {
    background: var(--card, #fff);
    border-radius: var(--radius, 8px);
    border-left: 3px solid #ff9500;
    padding: 12px 14px;
    margin-top: 12px;
    box-shadow: var(--shadow, 0 1px 4px rgba(0,0,0,.08));
}
.overview-backlog-detail-title {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--muted, #8e8e93);
    margin-bottom: 6px;
}
.overview-backlog-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: var(--font-sm);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.overview-backlog-detail-row:last-child { border-bottom: none; }
.overview-backlog-detail-week { color: var(--muted, #6d6d72); }
.overview-backlog-detail-vals { color: var(--text, #1c1c1e); font-weight: 600; }

.overview-section-title {
    font-size: var(--font-input);
    font-weight: 600;
    margin-bottom: 8px;
}

/* ── Overview: Projektgruppe-rækker ─────────────────────────── */
.overview-table .project-group-row td {
    background: var(--primary-light, #e8f2ff);
    font-weight: 600;
    font-size: var(--font-sm);
    color: var(--text);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}
.overview-table .project-group-row .project-no {
    color: var(--primary);
    font-weight: 700;
    margin-right: 4px;
}
.overview-table .subtotal-row td {
    font-weight: 600;
    font-size: var(--font-xs);
    color: var(--muted);
    background: #fafafa;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
}
.overview-table .subtotal-row td.col-no {
    color: var(--text);
    font-weight: 700;
}

/* ── Overview Status-kolonne: fast bredde ────────────────────── */
.overview-table .col-status { width: 130px; text-align: center; }

.overview-actions {
    flex-wrap: wrap;
}

/* ── Stor tablet/lille desktop: 3 kolonner (5. ryger på linje 2) ─── */
@media (max-width: 1100px) {
    .overview-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Tablet: 2 kolonner ─────────────────────────────────────── */
@media (max-width: 900px) {
    .overview-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Mobil: Timer fuld bredde øverst, derefter 2 × 2 grid ──── */
@media (max-width: 480px) {
    .overview-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Timer-kortet (altid første i DOM) spænder begge kolonner */
    .overview-summary-grid .type-timer {
        grid-column: 1 / -1;
    }

    .overview-period-label {
        font-size: var(--font-sm);
        min-width: auto;
    }
}

