﻿html, body {
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0;
}

/* FocusOnNavigate setzt den Fokus aufs h1 – Browser-Fokusrahmen ausblenden */
h1:focus {
    outline: none;
}

/* Kopfleiste + Navigation */
.topbar {
    background: #1b6ec2;
    color: #fff;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 48px;
}

.brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
}

.mainnav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
}

.mainnav a, .droplabel {
    color: #e4eefb;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
}

/* Nur die Einträge der blauen Leiste selbst werden weiß hervorgehoben – NICHT die
   Einträge in den weißen Aufklappmenüs (sonst weiß auf weiß, siehe .dropcontent a). */
.mainnav > a:hover, .mainnav > a.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

.dropdown {
    position: relative;
}

.dropcontent {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 190px;
    border: 1px solid #c9d6e6;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    /* Deckend, damit nie Seiteninhalt durchscheint. */
    opacity: 1;
}

.dropdown:hover .dropcontent {
    display: block;
}

/* Farben hier bewusst mit !important-freier, aber höherer Spezifität (.mainnav davor),
   damit die Hervorhebung der blauen Leiste nicht durchschlägt. */
.mainnav .dropcontent a,
.mainnav .dropcontent a:hover,
.mainnav .dropcontent a.active {
    display: block;
    color: #1a1a1a;
    padding: 0.5rem 0.8rem;
    border-bottom: none;
    white-space: nowrap;
}

.mainnav .dropcontent a:hover {
    background: #dbe8f7;
    color: #0b2f5c;
}

/* Aktuelle Seite: kräftig, aber lesbar (vorher weiß auf weiß = unsichtbar). */
.mainnav .dropcontent a.active {
    background: #eef4fb;
    color: #0b2f5c;
    font-weight: 600;
    border-left: 3px solid #1f6fd0;
    padding-left: calc(0.8rem - 3px);
}

.userbox {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* Programmstand (Build-Zeitpunkt) – hilft, veraltete Browser-Caches zu erkennen */
.userbox .version {
    font-size: 0.75rem;
    opacity: 0.7;
    cursor: help;
}

.btn-link {
    background: none;
    border: none;
    color: #cfe0f5;
    cursor: pointer;
    text-decoration: underline;
}

main {
    padding: 1rem;
}

/* Leiste mit offenen Aufgaben (wie Button-Leiste der alten App) */
.taskleiste {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.35rem 1rem;
    background: #eef3fa;
    border-bottom: 1px solid #d5dfec;
    flex-wrap: wrap;
}

.taskleiste-label {
    font-size: 0.8rem;
    color: #667;
}

.taskbtn {
    display: flex;
    align-items: center;
    border: 1px solid #b7c7dc;
    border-radius: 4px;
    background: #fff;
    font-size: 0.85rem;
    overflow: hidden;
}

.taskbtn.aktiv {
    background: #1b6ec2;
    border-color: #1b6ec2;
}

.taskbtn.aktiv .taskbtn-nr,
.taskbtn.aktiv .taskbtn-x {
    color: #fff;
}

.taskbtn-nr {
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.taskbtn-nr .kundenlogo {
    height: 16px;
    margin-right: 0;
}

.taskbtn-nr:hover {
    background: #e4eefb;
}

.taskbtn.aktiv .taskbtn-nr:hover {
    background: #155a9e;
}

.taskbtn-x {
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    color: #888;
    border-left: 1px solid #dde5f0;
}

.taskbtn-x:hover {
    color: #b00020;
    background: #f6e8ea;
}

/* Login */
.login-box {
    max-width: 360px;
    margin: 8vh auto;
    padding: 1.5rem 2rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Programmstand unter dem Anmeldeformular – unaufdringlich, aber vor der Anmeldung lesbar. */
.login-version {
    margin: 1.2rem 0 0 0;
    text-align: right;
    font-size: 0.75rem;
    color: #777;
    cursor: help;
}

.form-row {
    margin-bottom: 0.9rem;
}

.form-row label {
    display: block;
    margin-bottom: 0.25rem;
    color: #444;
}

.form-row input {
    width: 100%;
    padding: 0.45rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Passwortfeld mit Auge zum Ein-/Ausblenden des Klartexts */
.pw-feld {
    position: relative;
}

.pw-feld input {
    padding-right: 2.5rem;
}

/* Edge blendet in Passwortfeldern ab dem ersten Zeichen ein eigenes Auge (und ein "x") ein –
   ausblenden, sonst stehen zwei Symbole nebeneinander. Wir zeigen unser eigenes. */
.pw-feld input::-ms-reveal {
    display: none;
}

.pw-feld input::-ms-clear {
    display: none;
}

.pw-auge {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    color: #666;
    cursor: pointer;
}

.pw-auge:hover {
    color: #1b6ec2;
}

.btn-primary {
    background: #1b6ec2;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.6;
}

.error {
    color: #b00020;
}

.hinweistext {
    color: #777;
    font-size: 0.85rem;
    margin: 0.2rem 0 0.8rem 0;
}

/* Passwortrichtlinie (Anmeldung, Benutzerverwaltung) */
.passwortregeln {
    list-style: none;
    margin: 0.4rem 0 0.8rem 0;
    padding: 0;
    font-size: 0.85rem;
}

.passwortregeln li.ok {
    color: #1b7a34;
}

.passwortregeln li.offen {
    color: #777;
}

/* Menü-Kacheln */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tile {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    color: #222;
    background: #fafcff;
}

.tile:hover {
    border-color: #1b6ec2;
    box-shadow: 0 2px 8px rgba(27, 110, 194, 0.15);
}

.tile h2 {
    margin: 0 0 0.4rem 0;
    font-size: 1.05rem;
    color: #1b6ec2;
}

.tile p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

/* Tabellen */
.grid {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}

.grid th, .grid td {
    border-bottom: 1px solid #e2e2e2;
    text-align: left;
    padding: 0.45rem 0.6rem;
}

.grid thead th {
    background: #f0f4fa;
    position: sticky;
    top: 0;
    /* Über den Zeilen bleiben – ohne z-index schieben sich Inhalte mit eigenem
       Stapelkontext (Logos, gehoverte Zeilen) beim Scrollen über die Kopfzeile. */
    z-index: 3;
    /* Bei border-collapse wandert der Rahmen der Kopfzeile beim Scrollen nicht mit
       (Browser-Eigenheit); der Schatten ersetzt ihn und hält die Kante sichtbar. */
    box-shadow: inset 0 -1px 0 #ccd6e2;
}

.grid tbody tr:hover {
    background: #f7faff;
}

/* Aufgeklappte Einzelbuchungen (Kundenauswertung) */
.aufklapp-pfeil {
    display: inline-block;
    width: 1rem;
    color: #4a6fa5;
}

.grid tr.detailzeile > td {
    background: #f7faff;
    padding: 0.4rem 0.6rem 0.8rem 2rem;
}

.grid .untertabelle {
    font-size: 0.85rem;
}

.grid .untertabelle thead th {
    background: #e6edf7;
    position: static; /* nur die äußere Kopfzeile bleibt beim Scrollen stehen */
}

/* Sortierbare Spaltenköpfe (SortTh) */
.grid th.sortierbar {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.grid th.sortierbar:hover {
    background: #e2eaf6;
}

.grid th .sortpfeil {
    margin-left: 0.25rem;
    font-size: 0.7rem;
    color: #4a6fa5;
}

/* Zahlenspalten rechtsbündig – muss global stehen, weil SortTh das th selbst rendert
   und das seitenbezogene (scoped) CSS dort nicht greift. */
.grid th.num {
    text-align: right;
    white-space: nowrap;
}

.filterbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.8rem;
}

.filterbar input[type="text"], .filterbar input:not([type]) {
    padding: 0.4rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    min-width: 260px;
}

.pager {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-top: 0.8rem;
}

/* Aufgaben: Filterpanel links wie in der alten Anwendung */
.aufgaben-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.filterpanel {
    width: 250px;
    flex-shrink: 0;
    background: #f7f9fc;
    border: 1px solid #e0e6ee;
    border-radius: 6px;
    padding: 0.8rem 1rem 1rem 1rem;
}

.filterpanel h3 {
    font-size: 0.9rem;
    margin: 1rem 0 0.4rem 0;
}

.filterpanel h3:first-child {
    margin-top: 0;
}

.filterpanel label {
    display: block;
    font-size: 0.82rem;
    color: #444;
    margin: 0.55rem 0 0.15rem 0;
}

.filterpanel input,
.filterpanel select {
    width: 100%;
    padding: 0.35rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.85rem;
}

.filterpanel label.check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.8rem;
}

.filterpanel label.check input {
    width: auto;
}

.aufgaben-liste {
    flex: 1;
    min-width: 0;
}

.rowlink {
    cursor: pointer;
}

.rowlink.selektiert {
    background: #dcebfb;
}

/* Aktivität mit Verrechnen = 0 → grau (wie FetchRowStyle der alten App) */
tr.nichtverrechnet td {
    color: #999;
}

/* Bereits abgerechnete Aktivität → hellgrün; Auswahl-Blau hat Vorrang */
tr.abgerechnet {
    background: #e2f4e2;
}

.rowlink.selektiert.abgerechnet {
    background: #dcebfb;
}

/* Wochenarbeitszeiten: Summenzeilen fett (wie FetchRowStyle der Schnellauswertung) */
tr.summenzeile td {
    font-weight: 700;
}

/* Summe zusätzlich als erste Zeile: abgesetzt nach unten statt nach oben */
tr.summenzeile.summe-oben td {
    background: #f2f5f8;
    border-bottom: 2px solid #c9d2da;
}

.hinweis {
    color: #778;
    font-size: 0.83rem;
}

/* Kundenlogos */
.kundenlogo {
    height: 20px;
    width: auto;
    max-width: 48px;
    vertical-align: middle;
    margin-right: 0.3rem;
}

.aufg-titel .kundenlogo {
    height: 28px;
}

.logo-zelle {
    white-space: nowrap;
}

.logo-upload {
    cursor: pointer;
    opacity: 0.5;
}

.logo-upload:hover {
    opacity: 1;
}

.logo-upload input[type="file"] {
    display: none;
}

.akt-loeschen {
    cursor: pointer;
    opacity: 0.55;
}

.akt-loeschen:hover {
    opacity: 1;
}

/* Kopfbereich Aufgaben-Detail auf-/zuklappbar */
.aufklapp {
    cursor: pointer;
    color: #1b6ec2;
    font-weight: 600;
    margin: 0.3rem 0 0.8rem 0;
    user-select: none;
}

/* Arbeitszeiterfassung – mobiltauglich */
.ze-container {
    max-width: 760px;
}

.ze-label {
    display: block;
    margin-bottom: 0.3rem;
    color: #444;
}

.ze-suche {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    border: 1px solid #bbb;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 0.8rem;
}

.ze-liste td {
    padding: 0.6rem;
}

.ze-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #f0f5fb;
    border: 1px solid #d5dfec;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.8rem;
}

.ze-betreff {
    color: #555;
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .ze-liste th:nth-child(4), .ze-liste td:nth-child(4) {
        display: none;
    }

    .ze-kopf {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Betreff-Spalte begrenzen, Rest per Tooltip */
.col-betreff {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Rechnungstext in Aktivitäten-Übersicht: ca. 4x Bearbeiter-Spalte */
.col-rechnungstext {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Aufgaben-Detail (Maske wie alte Anwendung) */
.aufg-titel {
    font-size: 1.25rem;
}

.detailbox {
    border: 1px solid #ccd6e2;
    border-radius: 6px;
    padding: 0.7rem 1rem 1rem 1rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.detailbox legend {
    font-size: 0.85rem;
    color: #345;
    padding: 0 0.4rem;
}

.detailbox .erstellt {
    font-size: 0.8rem;
    color: #777;
}

.detailrow {
    display: grid;
    gap: 0 1rem;
}

.detailrow.zeile1 {
    grid-template-columns: repeat(5, 1fr);
}

/* Zusatztext der Abrechnungsmail: eine Spalte über die volle Breite */
.detailrow.zusatztext {
    grid-template-columns: 1fr;
    margin-top: 0.6rem;
}

.detailrow.zusatztext textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    font: inherit;
    resize: vertical;
}

/* Zeile 2: die beiden Termin-Felder zusammen so breit wie das Kunde-Feld darüber (1/5) */
.detailrow.zeile2 {
    grid-template-columns: 1fr 1fr 2fr 2fr 2fr 2fr;
}

/* Status-Farbe in der Übersicht */
.status-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
}

.detailbox label {
    display: block;
    font-size: 0.82rem;
    color: #444;
    margin: 0.55rem 0 0.15rem 0;
}

.detailbox input,
.detailbox select,
.detailbox textarea {
    width: 100%;
    padding: 0.35rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.85rem;
    font-family: inherit;
}

.detailbox label.check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.detailbox label.check input {
    width: auto;
}

.pair {
    display: flex;
    gap: 0.6rem;
}

.pair > div {
    flex: 1;
}

.zweispaltig {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1rem;
}

.aktionleiste {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin: 0.5rem 0 1.2rem 0;
}

.ok {
    color: #1a7a2e;
}

@media (max-width: 1100px) {
    .detailrow.zeile1, .detailrow.zeile2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .zweispaltig {
        grid-template-columns: 1fr;
    }
}

.loading-splash {
    padding: 2rem;
    color: #666;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Schnellauswahl-Buttons in der Arbeitszeitbuchung (15/30/60 Minuten) */
.schnellzeit {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin: 0.4rem 0;
}

.schnellzeit button {
    min-width: 2.6rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

/* Dropzone für E-Mail-Import (.msg/.eml) in der Aktivitätserfassung */
.email-dropzone {
    position: relative;
    border: 2px dashed #9ab;
    border-radius: 6px;
    padding: 0.7rem;
    text-align: center;
    color: #567;
    background: #f6f9fc;
    margin-bottom: 0.6rem;
}

.email-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.email-dropzone:hover {
    background: #e9f1fa;
    border-color: #58a;
}

/* Bearbeiter-Mehrfachauswahl in der Aufgaben-Detailansicht */
.bearbeiter-feld {
    position: relative;
}

.bearbeiter-feld input[readonly] {
    cursor: pointer;
    background: #fff;
}

.bearbeiter-editor {
    position: absolute;
    z-index: 20;
    background: #fff;
    border: 1px solid #9ab;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0.8rem;
    max-height: 16rem;
    overflow-y: auto;
    min-width: 12rem;
}

.bearbeiter-editor label.check {
    display: block;
    margin: 0.15rem 0;
    white-space: nowrap;
}

.sperre-btn {
    margin-left: 0.8rem;
}

/* Abrechnungs-Aktionen */
.abr-aktionen {
    white-space: nowrap;
}

.abr-aktionen button {
    margin-right: 0.3rem;
}

/* Hinweis unter den Knöpfen: was beim Abrechnen außerhalb von IMS passiert */
.abr-hinweis {
    margin-top: 0.25rem;
    color: #778;
    font-size: 0.78rem;
    white-space: normal;
    max-width: 22rem;
}

/* ------------------------------------------------------------------
   Mobile Ansicht (Handy/PWA): Projektweg in der Zeiterfassung und
   Monatsübersicht. Greift nur, wenn AnzeigeService "mobil" meldet –
   die Desktop-Ansicht verwendet diese Klassen nicht.
   ------------------------------------------------------------------ */
.ze-seg {
    display: flex;
    gap: 0.25rem;
    background: #f1f3f5;
    border: 1px solid #dde1e5;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 0.75rem;
}

.ze-seg button {
    flex: 1;
    border: 0;
    background: none;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.95rem;
    color: #555;
    cursor: pointer;
}

.ze-seg button.aktiv {
    background: #fff;
    color: #1b1e20;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}

.mobilliste {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mobilkarte {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    font: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid #dde1e5;
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    cursor: pointer;
}

.mobilkarte.statisch {
    cursor: default;
}

.mobilkarte:active {
    background: #f6f7f9;
}

.mk-aufklapp {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.mk-kopf {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.mk-titel {
    font-weight: 600;
}

.mk-sub {
    font-size: 0.88rem;
    color: #555;
}

.mk-mini {
    font-size: 0.78rem;
    color: #778;
}

.mk-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.mk-pill.ok {
    background: #e0efe7;
    color: #2e7d5b;
}

.mk-pill.warn {
    background: #f5ebd9;
    color: #96692a;
}

.mk-pill.krit {
    background: #f6e4e1;
    color: #a2433a;
}

.mk-pill.neutral {
    background: #f1f3f5;
    color: #666;
}

.mk-pfad {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.mk-kontingent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: #f6f7f9;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

.monatsnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.monatsnav button {
    width: 44px;
    height: 38px;
    font-size: 1.1rem;
}

.monatsname {
    font-weight: 600;
    font-size: 1.05rem;
}

.mk-filter {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.mk-zahlen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.mk-zahlen > div {
    background: #f6f7f9;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    display: flex;
    flex-direction: column;
}

.mk-zahlen .k {
    font-size: 0.75rem;
    color: #666;
}

.mk-zahlen .v {
    font-size: 1.05rem;
    font-weight: 600;
}

.mk-gruppen {
    margin-top: 0.5rem;
    border-top: 1px solid #eceff1;
    padding-top: 0.4rem;
}

.mk-gruppe {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #555;
    padding: 2px 0;
}

.mk-gruppe .w {
    color: #1b1e20;
    white-space: nowrap;
}

.mk-gruppe em {
    color: #778;
    font-style: normal;
}

.mk-akt {
    margin-top: 0.5rem;
    border-top: 1px solid #eceff1;
}

.mk-aktzeile {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f2f4f5;
}

.mk-aktzeile.abgerechnet {
    background: #f4fbf4;
}

.mk-aktzeile .t {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mk-aktzeile .txt {
    font-size: 0.86rem;
}

.mk-aktzeile .m {
    font-size: 0.75rem;
    color: #778;
}

.mk-aktzeile .m em {
    font-style: normal;
    color: #96692a;
}

.mk-aktzeile .w {
    text-align: right;
    white-space: nowrap;
    font-size: 0.82rem;
}

.mk-aktzeile .w b {
    display: block;
}

.mk-aktzeile .w span {
    color: #778;
    font-size: 0.75rem;
}

.mk-mehr {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Kopfleiste auf schmalen Bildschirmen: umbrechen statt die Seite breit zu ziehen.
   Ohne das scrollt jede Seite auf dem Handy seitlich weg. Desktop bleibt unberührt. */
@media (max-width: 820px) {
    .topbar {
        flex-wrap: wrap;
        gap: 0.5rem 0.9rem;
        padding: 0.4rem 0.7rem;
    }

    .mainnav {
        flex: 1 1 100%;
        order: 2;
        flex-wrap: wrap;
        gap: 0.3rem 0.8rem;
        font-size: 0.9rem;
    }

    .mainnav a, .droplabel {
        padding: 0.25rem 0.2rem;
    }

    .userbox {
        margin-left: auto;
        font-size: 0.85rem;
    }

    /* Untermenüs klappen nach unten auf – auf Touch reicht der Hover-Aufbau nicht,
       deshalb rechtsbündig ausrichten, damit sie nicht über den Rand laufen. */
    .dropcontent {
        right: 0;
        left: auto;
    }

    main {
        padding: 0.6rem 0.7rem;
    }
}

/* Filterleiste auf dem Handy: Felder untereinander statt nebeneinander */
.filterbar-mobil {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.filterbar-mobil input[type="date"],
.filterbar-mobil input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    font-size: 1rem;
}

/* Aktionen einer Abrechnungskarte – volle Breite, gut treffbar */
.mk-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
    border-top: 1px solid #eceff1;
    padding-top: 0.6rem;
}

.mk-aktionen button {
    flex: 1 1 45%;
    padding: 0.55rem 0.5rem;
    font-size: 0.9rem;
}

.mk-aktionen .abr-hinweis {
    flex: 1 1 100%;
    max-width: none;
    margin-top: 0;
}

.mk-summe {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 2px solid #dde1e5;
    font-weight: 600;
}

/* Summe zusätzlich über der Kartenliste: Trennlinie unten statt oben */
.mk-summe.mk-summe-oben {
    margin-top: 0;
    margin-bottom: 0.8rem;
    padding-top: 0;
    padding-bottom: 0.6rem;
    border-top: none;
    border-bottom: 2px solid #dde1e5;
}

/* Aufteilung einer Abrechnungszeile nach Abrechnungsgruppe */
.abr-gruppen {
    font-size: 0.85rem;
    line-height: 1.35;
    white-space: nowrap;
}

.abr-gruppen .gruppenname {
    font-weight: 600;
}

.abr-gruppen .kontingenthinweis {
    margin-left: 0.35rem;
    color: #778;
}

.abr-betraege {
    text-align: right;
}

.abr-gruppen .gruppensumme {
    margin-top: 0.15rem;
    padding-top: 0.15rem;
    border-top: 1px solid #ccc;
    font-weight: 700;
}

/* Kunde erhält die Abrechnung automatisch per Mail */
.mailkunde {
    margin-left: 0.35rem;
    color: #1b6ec2;
    cursor: help;
}

/* Auswahlfenster (z. B. Aktivität auf andere Aufgabe verschieben) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-fenster {
    background: #fff;
    border-radius: 6px;
    width: 90vw;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-kopf,
.modal-fuss {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #ccd6e2;
}

.modal-kopf {
    justify-content: space-between;
}

.modal-fuss {
    border-bottom: none;
    border-top: 1px solid #ccd6e2;
    justify-content: flex-end;
}

.modal-inhalt {
    padding: 0.6rem 0.8rem;
    overflow-y: auto;
}

.modal-inhalt label {
    display: block;
    font-size: 0.85rem;
    color: #345;
    margin: 0.6rem 0 0.2rem 0;
}

/* Projektbearbeitung: alle Felder auf volle Breite, zwei Spalten über .pair */
.projektbox {
    max-width: 720px;
}

.projektbox .modal-inhalt input,
.projektbox .modal-inhalt select,
.projektbox .modal-inhalt textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    font: inherit;
}

.projektbox .modal-inhalt .pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.projektbox .modal-inhalt .check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.projektbox .modal-inhalt .check input {
    width: auto;
}

/* inaktive Projekte in der Liste zurücknehmen */
tr.inaktiv td {
    color: #8a928d;
    font-style: italic;
}

.modal-inhalt input[type=search] {
    width: 100%;
    padding: 0.35rem;
    border: 1px solid #bbb;
    border-radius: 4px;
    box-sizing: border-box;
}

.modal-liste {
    border: 1px solid #ccd6e2;
    border-radius: 4px;
    max-height: 11rem;
    overflow-y: auto;
}

.modal-zeile {
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid #eef2f6;
}

.modal-zeile:hover {
    background: #f2f7fc;
}

.modal-zeile.selektiert {
    background: #dcebfb;
}

.modal-zeile.leer {
    color: #999;
    cursor: default;
}

/* Vorschau der Rechnungsbeilage (reine Ansicht, ohne Abrechnung) */
.vorschau-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.vorschau-fenster {
    background: #fff;
    border-radius: 6px;
    width: 90vw;
    max-width: 1000px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vorschau-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #ccd6e2;
}

.vorschau-kopf em {
    color: #777;
    font-size: 0.85rem;
    font-style: normal;
}

.vorschau-pdf {
    flex: 1;
    border: none;
    width: 100%;
}

/* Bestätigungsfenster nach dem Abrechnen: blendet sich nach 5 Sekunden selbst aus.
   Die Lage-Ebene lässt Klicks durch, damit im Hintergrund weitergearbeitet werden kann. */
.toast-lage {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1100;
}

.toast {
    pointer-events: auto;
    cursor: pointer;
    background: #fff;
    border: 1px solid #1a7a2e;
    border-left: 6px solid #1a7a2e;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    padding: 1.1rem 1.6rem;
    max-width: 90vw;
    text-align: center;
    font-size: 1.15rem;
    animation: toast-auf 0.15s ease-out;
}

/* Fehler bleiben stehen, bis sie weggeklickt werden – deshalb deutlich abgesetzt. */
.toast.toast-fehler {
    border-color: #b3261e;
    border-left-color: #b3261e;
    background: #fff5f4;
    color: #7a1710;
    max-width: min(90vw, 620px);
    text-align: left;
}

.toast .toast-zusatz {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: #555;
}

@keyframes toast-auf {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}
