/* ---------- Grundwerte ---------- */
:root {
    --grund: #f4f6f9;
    --flaeche: #ffffff;
    --rand: #dfe4ea;
    --text: #1f2933;
    --text-leise: #65717e;
    --akzent: #1e6f8f;
    --akzent-hell: #e3f1f6;
    --leiste: #16324a;
    --leiste-text: #c9d6e2;
    --gut: #2f7d4f;
    --warnung: #a86200;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, "Segoe UI", sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--grund);
}

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
.leise { color: var(--text-leise); }
.rechts { text-align: right; }
.klein { font-size: 0.85rem; }

/* ---------- Rahmen mit Seitenleiste ---------- */
.rahmen { display: flex; min-height: 100vh; }

.seitenleiste {
    width: 220px;
    flex-shrink: 0;
    background: var(--leiste);
    color: var(--leiste-text);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.marke {
    display: flex; align-items: center; gap: 0.6rem;
    color: #fff; font-weight: 600; font-size: 1.1rem;
    padding: 0.25rem 0.5rem 1.25rem;
}
.marke-zeichen {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--akzent); color: #fff; font-weight: 700;
}

.menue {
    display: block; padding: 0.55rem 0.75rem; border-radius: 6px;
    color: var(--leiste-text);
}
.menue:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; color: #fff; }
.menue.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; }
.menue.gesperrt { opacity: 0.45; cursor: default; }
.menue.gesperrt:hover { background: none; color: var(--leiste-text); }
.menue-gruppe {
    margin: 1rem 0.75rem 0.25rem; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6;
}

.inhalt { flex: 1; padding: 1.75rem 2rem; min-width: 0; }

.balken-gross { height: 10px; background: var(--rand); border-radius: 5px; overflow: hidden; margin: 0.25rem 0 0.5rem; }
.balken-gross > div { height: 100%; background: var(--akzent); transition: width 0.3s; }

.probebetrieb { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 12px, #ffd45a 12px, #ffd45a 24px); color: #4a3500;
    font-weight: 700; padding: 0.5rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; text-align: center; }

/* Angemeldeter Zugang unten in der Seitenleiste */
.benutzer-kasten { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.benutzer-kasten > .klein { padding: 0 0.75rem 0.35rem; opacity: 0.8; }
.abmelden { margin: 0; }
.abmelden-knopf { width: 100%; text-align: left; border: none; background: none; font: inherit; cursor: pointer; }

/* ---------- Anmeldung und Ersteinrichtung ---------- */
.konto-rahmen { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--leiste); }
.konto-karte { width: min(420px, 100%); }
.konto-marke { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1.1rem; margin-bottom: 1rem; }
.konto-formular { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1rem; }
.konto-karte .abmelden { margin-top: 1rem; }
code.passwort { font-size: 1.1rem; padding: 0.1rem 0.4rem; background: #fff; border-radius: 4px; letter-spacing: 0.05em; user-select: all; }

.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* ---------- Karten ---------- */
.karte {
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.karten { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 1.25rem; }
.kennzahl { font-size: 2rem; font-weight: 650; margin-top: 0.25rem; }

dl.felder { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; }
dl.felder dt { color: var(--text-leise); }
dl.felder dd { margin: 0; }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); overflow-x: auto; }
table.tabelle { width: 100%; border-collapse: collapse; }
table.tabelle th, table.tabelle td { padding: 0.6rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rand); }
table.tabelle th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-leise); background: #fafbfc; font-weight: 600; }
table.tabelle tr:last-child td { border-bottom: none; }
table.tabelle tbody tr.klickbar { cursor: pointer; }
.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.foto { display: flex; flex-direction: column; gap: 0.3rem; color: inherit; text-decoration: none; font-size: 0.85rem; }
.foto:hover { text-decoration: none; }
.foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--rand); background: #f2f4f6; }
.foto:hover img { outline: 2px solid var(--akzent); }
.termin-foto { max-width: 100%; max-height: 50vh; border-radius: 6px; border: 1px solid var(--rand); display: block; margin: 0.5rem 0; }
table.tabelle th.sortierbar { cursor: pointer; user-select: none; white-space: nowrap; }
table.tabelle th.sortierbar:hover { color: var(--akzent); }
table.tabelle tbody tr.klickbar:hover { background: var(--akzent-hell); }
table.tabelle td.zahl, table.tabelle th.zahl { text-align: right; white-space: nowrap; }

/* ---------- Kennzeichen ---------- */
.marke-klein {
    display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
    font-size: 0.78rem; background: #edf0f3; color: var(--text-leise); white-space: nowrap;
}
.marke-klein.firma { background: #e8e3f6; color: #5a3d9a; }
.marke-klein.indirekt { background: #fdf0dc; color: var(--warnung); }
.marke-klein.abweichend { background: #fdf0dc; color: var(--warnung); }
.marke-klein.gut { background: #e1f2e7; color: var(--gut); }

/* ---------- Eingaben ---------- */
.werkzeuge { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
input.eingabe, select.eingabe {
    font: inherit; padding: 0.5rem 0.75rem; border: 1px solid var(--rand);
    border-radius: 6px; background: var(--flaeche); color: var(--text);
}
input.eingabe.suche { min-width: 320px; flex: 1; max-width: 520px; }
input.eingabe:focus, select.eingabe:focus { outline: 2px solid var(--akzent-hell); border-color: var(--akzent); }

.knopf {
    font: inherit; padding: 0.45rem 0.9rem; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
}
.knopf:hover:not(:disabled) { border-color: var(--akzent); color: var(--akzent); }
.knopf:disabled { opacity: 0.4; cursor: default; }

.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.haupt:hover:not(:disabled) { background: #185d78; color: #fff; }
.knopf.klein { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
a.knopf { display: inline-block; text-decoration: none; }

/* ---------- Formulare ---------- */
.karten.zwei { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.felder-raster { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 0.9rem; }
.feld { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--text-leise); }
.feld .eingabe { font-size: 0.95rem; width: 100%; }
.feld.breit { grid-column: 1 / -1; }
.feld.ankreuz { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--text); font-size: 0.95rem; padding-top: 1.2rem; }
textarea.eingabe { font: inherit; padding: 0.5rem 0.75rem; border: 1px solid var(--rand); border-radius: 6px; resize: vertical; }

.termin-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.termin { display: inline-flex; align-items: center; gap: 0.2rem; margin: 0.15rem 0.25rem 0 0; padding: 0.1rem 0.2rem 0.1rem 0.5rem;
    border-radius: 999px; background: var(--akzent-hell); font-size: 0.85rem; white-space: nowrap; }
.termin.vorbei { background: #edf0f3; color: var(--text-leise); }
.termin.fertig { background: #e1f2e7; color: var(--gut); padding-right: 0.5rem; }
.termin.rueckmeldung { background: #fdf0dc; color: var(--warnung); padding-right: 0.5rem; }
.termin.abgesagt { background: #edf0f3; color: var(--text-leise); text-decoration: line-through; padding-right: 0.5rem; }
button.termin { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 0.85rem; padding-right: 0.5rem; color: inherit; }
button.termin:hover { border-color: var(--akzent); }

/* ---------- Karte ---------- */
.karte-layout { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; align-items: start; }
.kartenflaeche { height: calc(100vh - 170px); min-height: 480px; border-radius: var(--radius); border: 1px solid var(--rand); }
.punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; }
.pruefliste { max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; }
.pruef-eintrag { text-align: left; border: none; background: none; padding: 0.35rem 0.25rem; border-bottom: 1px solid var(--rand); cursor: pointer; font: inherit; font-size: 0.85rem; }
.pruef-eintrag:hover, .pruef-eintrag.aktiv { background: var(--akzent-hell); }
@media (max-width: 900px) { .karte-layout { grid-template-columns: 1fr; } }

.tour-nummer span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff;
    font-size: 11px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); }
.tour-farbe { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 0.4rem; }
.touren-layout { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 1rem; align-items: start; }
.touren-layout .kartenflaeche { position: sticky; top: 1rem; }
.stoppliste { max-height: 40vh; overflow-y: auto; }
@media (max-width: 1000px) { .touren-layout { grid-template-columns: 1fr; } }

/* ---------- Dialog ---------- */
.dialog-hintergrund { position: fixed; inset: 0; background: rgba(22, 50, 74, 0.35); display: grid; place-items: center; z-index: 900; padding: 1rem; }
.dialog { width: min(560px, 100%); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.termin button { border: none; background: none; cursor: pointer; color: var(--text-leise); font-size: 0.9rem; padding: 0 0.3rem; }
.termin button:hover { color: #8a1c14; }

.karte.beendet { opacity: 0.65; }
tr.beendet td { color: var(--text-leise); }
tr.beendet td:not(:last-child) { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.25); }

.meldung { border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.meldung ul { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.meldung.fehler { background: #fdecea; color: #8a1c14; border: 1px solid #f5c6c0; }
.meldung.gut { background: #e1f2e7; color: var(--gut); }
.meldung.warnung { background: #fdf0dc; color: var(--warnung); }

.blaettern { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; margin-top: 0.75rem; }

.hinweis { background: var(--akzent-hell); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1.25rem; }

/* ---------- Blazor-Standard ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Es ist ein Fehler aufgetreten." }

.tabelle tr.gewaehlt td { background: var(--akzent-hell); }
