:root {
    --soft-bg: #f5f7fb;
    --card-border: #e6e9f0;
}

body {
    background: var(--soft-bg);
}

.card {
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.stat-card {
    border-radius: 18px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
}

.claim-title {
    letter-spacing: -0.02em;
}

.step-badge {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
}

.timeline {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: .25rem;
    width: .8rem;
    height: .8rem;
    border-radius: 50%;
    background: #0d6efd;
}

.report-page {
    background: #fff;
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px;
}

@media print {
    nav, .no-print, .btn, .alert {
        display: none !important;
    }

    body {
        background: #fff;
    }

    main.container-fluid {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

.table td .badge {
    vertical-align: middle;
}

/* Große 8D-Fortschrittsleiste auf der Reklamationsseite */
.eightd-progress-card {
    border-radius: 22px;
    overflow: hidden;
}

.eightd-status-form {
    width: min(100%, 430px);
}

.eightd-tracker {
    --eightd-progress: 0%;
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, minmax(74px, 1fr));
    gap: .75rem;
    padding: .35rem 0 .1rem;
}

.eightd-track {
    position: absolute;
    top: 33px;
    left: 42px;
    right: 42px;
    height: 8px;
    border-radius: 999px;
    background: #e9ecef;
    z-index: 0;
    overflow: hidden;
}

.eightd-track-fill {
    height: 100%;
    width: var(--eightd-progress);
    border-radius: 999px;
    background: linear-gradient(90deg, #adb5bd 0%, #0d6efd 100%);
}

.eightd-step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.eightd-badge {
    width: 68px;
    height: 68px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 900;
    border: 4px solid #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .14);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.eightd-step:hover .eightd-badge {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, .18);
}

.eightd-step-title {
    font-size: .78rem;
    line-height: 1.15;
    font-weight: 700;
    color: #6c757d;
    max-width: 105px;
}

.eightd-step.is-completed .eightd-badge {
    background: #e9ecef;
    color: #6c757d;
    opacity: .72;
}

.eightd-step.is-completed .eightd-step-title {
    opacity: .62;
}

.eightd-step.is-current .eightd-badge {
    background: #0d6efd;
    color: #fff;
    opacity: 1;
    transform: scale(1.05);
}

.eightd-step.is-current .eightd-step-title {
    color: #0d6efd;
    opacity: 1;
}

.eightd-step.is-future .eightd-badge {
    background: #fff;
    color: #343a40;
    border-color: #e9ecef;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.eightd-step.is-final .eightd-badge {
    background: #d1e7dd;
    color: #146c43;
    opacity: .9;
}

@media (max-width: 991.98px) {
    .eightd-tracker {
        grid-template-columns: repeat(4, minmax(70px, 1fr));
        row-gap: 1.15rem;
    }

    .eightd-track,
    .eightd-track-fill {
        display: none;
    }

    .eightd-badge {
        width: 58px;
        height: 58px;
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .eightd-tracker {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

.claim-step-item {
    scroll-margin-top: 92px;
}

.eightd-step {
    cursor: pointer;
}


.audit-timeline {
    position: relative;
    padding-left: 1.75rem;
}
.audit-timeline::before {
    content: "";
    position: absolute;
    left: 0.55rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: #dee2e6;
}
.audit-timeline-item {
    position: relative;
    margin-bottom: 1rem;
}
.audit-timeline-item:last-child {
    margin-bottom: 0;
}
.audit-timeline-icon {
    position: absolute;
    left: -1.5rem;
    top: 0.35rem;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    background: #adb5bd;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
}
.audit-timeline-content {
    background: #fff;
    border: 1px solid #edf0f3;
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
}
.audit-timeline-details {
    white-space: normal;
    color: #343a40;
}
.timeline-icon-create { background: #0d6efd; box-shadow: 0 0 0 2px rgba(13, 110, 253, .25); }
.timeline-icon-step { background: #6610f2; box-shadow: 0 0 0 2px rgba(102, 16, 242, .25); }
.timeline-icon-action { background: #fd7e14; box-shadow: 0 0 0 2px rgba(253, 126, 20, .25); }
.timeline-icon-status { background: #0dcaf0; box-shadow: 0 0 0 2px rgba(13, 202, 240, .25); }
.timeline-icon-done { background: #198754; box-shadow: 0 0 0 2px rgba(25, 135, 84, .25); }
.timeline-icon-danger { background: #dc3545; box-shadow: 0 0 0 2px rgba(220, 53, 69, .25); }
.timeline-icon-file { background: #6c757d; box-shadow: 0 0 0 2px rgba(108, 117, 125, .25); }
.timeline-icon-mail { background: #20c997; box-shadow: 0 0 0 2px rgba(32, 201, 151, .25); }
.timeline-icon-default { background: #adb5bd; }


.nav-action-badge {
    font-size: 0.68rem;
    line-height: 1;
    min-width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
    padding: 0.22rem 0.42rem;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}

.navbar .nav-link.active .nav-action-badge {
    box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}

@media (max-width: 991.98px) {
    .nav-action-badge {
        margin-left: 0.5rem;
    }
}


/* Kleine Status-Icons im Accordion-Header: ✅ erledigt, 🔵 aktuell, ⏳ offen */
#stepsAccordion .step-header-icon {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: .65rem;
    border-radius: 999px;
    font-size: 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

#stepsAccordion .step-header-icon.is-done {
    background: #f1f3f5;
    border-color: #ced4da;
    color: #6c757d;
    filter: grayscale(.25);
}

#stepsAccordion .step-header-icon.is-current {
    background: #e7f1ff;
    border-color: rgba(13, 110, 253, .35);
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .08);
}

#stepsAccordion .step-header-icon.is-open {
    background: #fff8e1;
    border-color: rgba(255, 193, 7, .45);
}

#stepsAccordion .step-header-title {
    flex: 0 1 auto;
}

#stepsAccordion .claim-step-item.is-step-done:not(.is-open) .step-header-icon,
#stepsAccordion .claim-step-item.is-step-done:not(.is-open) .step-header-key,
#stepsAccordion .claim-step-item.is-step-done:not(.is-open) .step-header-title {
    opacity: .72;
}

#stepsAccordion .claim-step-item.is-current-step:not(.is-step-done) .step-header-key,
#stepsAccordion .claim-step-item.is-current-step:not(.is-step-done) .step-header-title {
    color: #0d6efd;
}

@media (max-width: 575.98px) {
    #stepsAccordion .accordion-button {
        align-items: flex-start;
    }

    #stepsAccordion .step-header-status {
        margin-left: .55rem !important;
    }

    #stepsAccordion .step-header-title {
        max-width: 58vw;
    }
}

/* 8D-Accordion: aktiven Bereich klar hervorheben und erledigte Bereiche abschwächen */
#stepsAccordion .claim-step-item {
    border-left: 4px solid transparent;
    transition: opacity .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

#stepsAccordion .claim-step-item .accordion-button {
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

#stepsAccordion .claim-step-item .accordion-body {
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

/* Erledigte, eingeklappte D-Schritte wirken bewusst schwächer wie die erledigten Progress-Badges */
#stepsAccordion .claim-step-item.is-step-done:not(.is-open) {
    opacity: .62;
}

#stepsAccordion .claim-step-item.is-step-done:not(.is-open) .accordion-button.collapsed {
    background: #f4f5f7;
    color: #6c757d;
}

#stepsAccordion .claim-step-item.is-step-done:not(.is-open) .badge {
    opacity: .72;
}

/* Der gerade geöffnete Accordion-Inhalt bekommt mehr Kontrast */
#stepsAccordion .claim-step-item.is-open {
    opacity: 1;
    border-left-color: #0d6efd;
    background: #edf4ff;
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, .10);
}

#stepsAccordion .claim-step-item.is-open .accordion-button:not(.collapsed) {
    background: #dbeafe;
    color: #0b3d91;
    box-shadow: inset 0 -1px 0 rgba(13, 110, 253, .16);
}

#stepsAccordion .claim-step-item.is-open .accordion-body {
    background: #eef5ff;
    border-top: 1px solid rgba(13, 110, 253, .14);
    box-shadow: inset 0 12px 24px rgba(13, 110, 253, .045);
}

#stepsAccordion .claim-step-item.is-open textarea,
#stepsAccordion .claim-step-item.is-open .form-control,
#stepsAccordion .claim-step-item.is-open .form-select {
    background-color: #fff;
}

/* Wenn ein erledigter Schritt geöffnet wird, bleibt er lesbar, wirkt aber weiterhin abgeschlossen */
#stepsAccordion .claim-step-item.is-step-done.is-open {
    border-left-color: #adb5bd;
    background: #f1f3f5;
    box-shadow: inset 0 0 0 1px rgba(108, 117, 125, .10);
}

#stepsAccordion .claim-step-item.is-step-done.is-open .accordion-button:not(.collapsed) {
    background: #e9ecef;
    color: #495057;
}

#stepsAccordion .claim-step-item.is-step-done.is-open .accordion-body {
    background: #f6f7f9;
    border-top-color: rgba(108, 117, 125, .18);
}

/* Der aktuell erreichte 8D-Schritt darf auch im Accordion stärker auffallen */
#stepsAccordion .claim-step-item.is-current-step:not(.is-step-done) {
    border-left-color: #0d6efd;
}

#stepsAccordion .claim-step-item.is-current-step:not(.is-step-done) .accordion-button.collapsed {
    background: #f0f6ff;
    color: #0d6efd;
}

@media (max-width: 575.98px) {
    #stepsAccordion .claim-step-item.is-open .accordion-body {
        background: #f2f7ff;
    }
}

.location-switcher-form .location-switcher {
    min-width: 210px;
    max-width: 260px;
    background-color: #212529;
    color: #fff;
    border-color: rgba(255,255,255,.35);
}

.location-switcher-form .location-switcher:focus {
    border-color: rgba(255,255,255,.7);
    box-shadow: 0 0 0 .2rem rgba(255,255,255,.12);
}

@media (max-width: 991.98px) {
    .location-switcher-form .location-switcher {
        width: 100%;
        max-width: none;
    }
}

/* Auswertung */
.kpi-card {
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 .25rem .75rem rgba(0,0,0,.035);
}

.kpi-card .display-6 {
    line-height: 1;
}

/* Fotodokumentation */
.upload-photo-form {
    background: #f8fafc;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: .75rem;
    padding: .85rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: .85rem;
}

.photo-card {
    border: 1px solid rgba(0,0,0,.10);
    border-radius: .9rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 .25rem .75rem rgba(0,0,0,.04);
}

.photo-thumb-link {
    display: block;
    background: #111827;
}

.photo-thumb {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.photo-card-body {
    padding: .75rem;
}

.report-photo {
    max-height: 260px;
    width: 100%;
    object-fit: contain;
    background: #f8f9fa;
}

.report-file-card {
    break-inside: avoid;
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media print {
    .report-photo {
        max-height: 180px;
    }
}

/* Benutzerverwaltung nach Standort: Kachelansicht */
.location-user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    gap: 1rem;
}

.location-user-card {
    position: relative;
    min-height: 245px;
    padding: 1.1rem .95rem 1rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1rem;
    background: linear-gradient(180deg, #f7f8fc 0%, #ffffff 100%);
    box-shadow: 0 .35rem 1rem rgba(15, 23, 42, .06);
    text-align: center;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, opacity .16s ease;
}

.location-user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .75rem 1.4rem rgba(15, 23, 42, .10);
    border-color: rgba(13, 110, 253, .22);
}

.location-user-card.is-archived {
    opacity: .68;
    filter: grayscale(.18);
}

.location-user-card.is-all {
    background: linear-gradient(180deg, #eef5ff 0%, #ffffff 100%);
    border-color: rgba(13, 110, 253, .18);
}

.location-card-menu {
    position: absolute;
    top: .65rem;
    right: .75rem;
    color: #6c757d;
    font-weight: 800;
    font-size: .95rem;
    line-height: 1;
    text-decoration: none;
    letter-spacing: -.08rem;
}

.location-card-menu:hover {
    color: #0d6efd;
}

.location-avatar {
    width: 58px;
    height: 58px;
    margin: .2rem auto .75rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    font-size: .92rem;
    letter-spacing: .02em;
    background: radial-gradient(circle at 30% 25%, #8ec5ff 0%, #0d6efd 55%, #0b3d91 100%);
    box-shadow: 0 .35rem .85rem rgba(13, 110, 253, .25);
}

.location-user-card.is-all .location-avatar {
    background: radial-gradient(circle at 30% 25%, #cbd5e1 0%, #334155 60%, #0f172a 100%);
    box-shadow: 0 .35rem .85rem rgba(15, 23, 42, .22);
}

.location-card-title {
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
}

.location-card-subtitle {
    margin-top: .15rem;
    font-size: .8rem;
    color: #6c757d;
}

.location-card-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
}

.location-card-stats div {
    min-width: 0;
}

.location-card-stats strong {
    display: block;
    color: #111827;
    font-size: 1.02rem;
    line-height: 1.1;
}

.location-card-stats span {
    display: block;
    margin-top: .15rem;
    color: #6c757d;
    font-size: .76rem;
}

.location-card-meta {
    min-height: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .3rem;
    font-size: .72rem;
    color: #6c757d;
}

.location-card-meta span {
    background: #f1f3f5;
    border: 1px solid rgba(0,0,0,.05);
    border-radius: 999px;
    padding: .1rem .45rem;
}

.location-context-card {
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

@media (max-width: 575.98px) {
    .location-user-grid {
        grid-template-columns: 1fr;
    }
}

/* Fotos/Nachweise direkt im 8D-Accordion */
.step-file-section {
    background: rgba(248, 250, 252, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .9rem;
    padding: 1rem;
}

.step-upload-form {
    background: #fff;
    border: 1px dashed rgba(13, 110, 253, .35);
    border-radius: .75rem;
    padding: .75rem;
}

.step-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.step-file-list .list-group-item {
    border-radius: .7rem;
    margin-bottom: .5rem;
    border: 1px solid rgba(0,0,0,.08);
}

@media (min-width: 1200px) {
    .step-photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .step-photo-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}
