/* --------------------------------------------------------------------------
   AP2 – gezielte responsive Werkzeugleisten
   Grundsatz: Mobile dient der Erfassung, nicht der umfassenden Auswertung.
   -------------------------------------------------------------------------- */

/* Journal: Sichtbarkeit kompakt halten. */

.journal-add-form select {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
}

/* Kundenrapporte: Filter und Aktionen kontrolliert umbrechen. */

.rapport-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.rapport-filter {
    display: flex;
    flex: 1 1 560px;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

/* Das erste Label (Kunde / Rubrik) */

.rapport-filter > label:first-of-type {
    display: flex;
    flex-direction: column;
    /* Text über dem Select-Feld */
    flex: 0 0 300px;
    /* Fixe Breite von 300px, kein Wachsen/Schrumpfen */
    width: 100%;
    /* Sicherheits-Fallback für ältere Browser */
}

/* Der Zeilenumbruch direkt nach dem ersten Label */

.rapport-filter > label:first-of-type::after {
    content: "";
    flex-basis: 100%;
    height: 0;
}

/* Die restlichen Labels und der Button (landen in Zeile 2) */

.rapport-filter > label:not(:first-of-type) {
    display: flex;
    flex-direction: column;
    /* Text über den Datumsfeldern */
}

/* Das Select-Feld innerhalb des ersten Labels strecken */

.rapport-filter > label:first-of-type select {
    width: 100%;
    /* Nutzt die vollen 300px des Labels aus */
}

.rapport-filter label:first-child {
    min-width:fit-content;
}

.rapport-filter label:not(:first-child) {
    min-width:fit-content;
}

.rapport-filter .report-button {
    flex: 0 0 auto;
}

.rapport-actions {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 6px;
}

/* Protokoll: zweite Spalte "Total" bleibt stehen, Datum scrollt mit. */
/*
.protocol-table .date-column,
.protocol-table tbody th,
.protocol-table tfoot th {
    /*! position: static; */
    /*! left: auto; */
}
*/

.protocol-table thead .date-column {
    position: sticky;
    top: 0;
    left: auto;
    z-index: 2;
    vertical-align: bottom;
}


.protocol-table thead th.total-column{
	background:darkblue;
    border-left: 1px solid #444;
}

.protocol-table thead .total-column,
.protocol-table thead .date-column
{
    z-index: 6;
    vertical-align: bottom;
    min-width: 60px;
}

.protocol-table tfoot .total-cell {
    bottom: 0;
    z-index: 5;
    color: #fff;
    background: #4a4e57;
}

@media (max-width: 1024px) {
    .rapport-filter {
        flex-basis: 100%;
    }

    .rapport-actions {
        flex-basis: 100%;
    }
}

@media (max-width: 768px) {
    .journal-add-form select {
        width: 118px;
        min-width: 118px;
        max-width: 118px;
        padding-right: 24px;
        font-size: 12px;
    }

    .rapport-filter label:first-child {
        min-width:fit-content;
    }

    .rapport-filter label:not(:first-child) {
        min-width:fit-content;
    }

    .rapport-filter > .report-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .rapport-actions .report-button {
        flex: 1 1 auto;
        min-width: 86px;
        text-align: center;
    }

    /* Horizontale Protokolltabelle bleibt bewusst erhalten. */

    .report-toolbar,
    .report-period-form,
    .report-switches {
        display: flex;
        flex-wrap: wrap;
    }

    .report-period-form,
    .report-switches {
        width: 100%;
        justify-content: space-between;
        flex-wrap:nowrap;
    }

    .report-period-form label {
        /*flex: 1 1 100%;*/
    }

    .report-period-form .report-button,
    .report-switches .report-button {
        flex: 1 1 140px;
        width: auto;
    }
}

/* Sprint 13.1d – Rapporte: klare Zwei-Zeilen-Bedienung auf Mobilgeräten. */

.rapport-period-row {
    display: flex;
    flex: 0 1 auto;
    align-items: flex-end;
    gap: 8px;
    min-width:500px;
}

.rapport-period-row label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.report-print-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;

}

.report-print-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 768px) {
    .rapport-filter {
        display: grid;
        grid-template-columns: minmax(0,1fr);
        gap: 8px;
    }

    .rapport-filter > label:first-of-type {
        width: 100%;
        min-width: 0;
        flex-basis: auto;
    }

    .rapport-period-row {
        display: grid;
        grid-template-columns: repeat(3,1fr);
        /*! width: 100%; */
        gap: 6px;
    }

    .rapport-period-row label {
        width: auto;
    }

    .rapport-period-row input[type="date"] {
        width: 100%;
        min-width: 0;
        padding-inline: 6px;
        font-size: 12px;
    }

    .rapport-period-row .report-button {
        width: auto;
        min-width: 74px;
        align-self: end;
    }

    .rapport-actions {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        gap: 6px;
    }

    .rapport-actions .report-button {
        flex: 2;
        min-width: 0;

        white-space: nowrap;
    }

    .rapport-actions form {
        display: flex !important;
        flex: 1 1 auto;
        min-width: 0;
    }

    .rapport-actions form .report-button {
        width: 100%;
    }

    .rapport-actions .report-print-button {
        flex: 0 0 42px;
        width: 42px;
        min-width: 42px;

    }
}
