/* MSolutions-Design: Navy und Orange aus dem Logo, Schrift Manrope (lokal, keine Google-Anfrage) */
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/manrope-latin.woff2") format("woff2");
}

:root {
    --navy: #14213d;
    --orange: #e06c1f;
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #14213d;
    --muted: #4a5568;
    --border: #dde2ea;
    --primary: #e06c1f;
    --primary-text: #14213d;
    --link: #14213d;
    --bar: #14213d;
    --bar-text: #ffffff;
    --bar-muted: #c9d1de;
    --einnahme: #1e7b4a;
    --ausgabe: #b42318;
    --sonstiges: #4a5568;
    --error: #b42318;
    --error-bg: #fdecea;
    --warn-bg: #fff4e8;
    --ok-bg: #e7f5ec;
    --field: #ffffff;
    --grund: var(--bg);
    --linie: var(--border);
    --leise: var(--muted);
    --orange-text: #9a4b12;
    --radius: 12px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 2rem 0 .75rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
main.narrow { max-width: 440px; padding-top: 3rem; }

.topbar {
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
    background: var(--bar); color: var(--bar-text);
    padding: .6rem 1rem;
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { display: block; height: 28px; width: auto; }
.topbar nav { display: flex; gap: .25rem; flex: 1; }
.topbar nav a { text-decoration: none; color: var(--bar-muted); font-weight: 600; font-size: .95rem; padding: .4rem .7rem; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: var(--bar-text); }
.topbar nav a.active { color: var(--bar-text); border-bottom-color: var(--orange); }
.topbar button.link { color: var(--bar-muted); }
.topbar button.link:hover { color: var(--bar-text); }
.logout { margin: 0; display: flex; align-items: center; gap: .9rem; }
.logout a { color: var(--bar-muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.logout a:hover, .logout a.active { color: var(--bar-text); }
.logout .icon-link { display: inline-flex; padding: .3rem; }
.qr-code { display: inline-block; background: #fff; padding: .5rem; border-radius: 8px; line-height: 0; }
.qr-code svg { width: 200px; height: 200px; }
.geheimnis { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: .08em; word-break: break-all; }
.codes-liste { columns: 2; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; padding-left: 1.2rem; }
.code-eingabe { font-size: 1.4rem; letter-spacing: .3em; text-align: center; max-width: 12rem; }

.login-logo { display: block; margin: 0 auto 1.5rem; }
.login-logo img { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }

form label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input[type=search], input[type=file], select, textarea {
    display: block; width: 100%; margin-top: .3rem;
    font: inherit; font-weight: 400; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    padding: .55rem .65rem;
}
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
label.radio, label.checkbox { font-weight: 400; margin-bottom: .35rem; display: flex; gap: .5rem; align-items: center; }

button, .button {
    display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    border: 1px solid var(--border); background: var(--card); color: var(--text);
    border-radius: 8px; padding: .6rem 1rem; min-height: 44px;
}
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.link { background: none; border: 0; color: var(--muted); padding: .35rem; font-weight: 400; }

.field-error { display: block; color: var(--error); font-weight: 400; font-size: .9rem; margin-top: .25rem; }
.error-box, .warn-box, .flash { border-radius: 6px; padding: .7rem .9rem; margin: 0 0 1rem; }
.error-box { background: var(--error-bg); color: var(--error); }
.warn-box { background: var(--warn-bg); }
.flash-ok, .ok-box { background: var(--ok-bg); }
.ok-box { border-radius: 6px; padding: .7rem .9rem; margin: 0 0 1rem; }
.flash-warn { background: var(--warn-bg); }

.hint, .empty, .file-meta small { color: var(--muted); }
.empty { padding: 1rem 0; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.tile-label { color: var(--muted); font-size: .9rem; }
.tile-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: .85rem; }

.filter { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: .5rem; margin-bottom: 1rem; align-items: end; }
.filter select, .filter input { margin-top: 0; }

.beleg-liste { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.beleg-liste li + li { border-top: 1px solid var(--border); }
.beleg-liste a { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; color: inherit; text-decoration: none; }
.beleg-liste a:hover { background: var(--bg); }
.beleg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.beleg-main strong, .beleg-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beleg-main small { color: var(--muted); }
.beleg-betrag { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

.badge { font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; border: 1px solid currentColor; min-width: 5.5rem; text-align: center; }
.badge-einnahme { color: var(--einnahme); }
.badge-ausgabe { color: var(--ausgabe); }
.badge-sonstiges { color: var(--sonstiges); }
.badge-eingang { color: var(--link, var(--primary)); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; align-items: start; }
.preview img { max-width: 100%; border-radius: 6px; display: block; }
.preview iframe { width: 100%; height: 70vh; border: 0; border-radius: 6px; background: #fff; }
.erechnung { font-size: .95rem; }
.erechnung-kopf { margin-top: 0; }
.erechnung-parteien { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: .75rem; }
.erechnung table { width: 100%; border-collapse: collapse; margin-bottom: .5rem; }
.erechnung th, .erechnung td { padding: .3rem .25rem; border-bottom: 1px solid var(--border, #ddd); text-align: left; vertical-align: top; }
.erechnung .num { text-align: right; white-space: nowrap; }
.erechnung tr.total td { font-weight: 700; border-bottom: 0; }
.erechnung-details { margin-bottom: .75rem; }
.erechnung-details summary { cursor: pointer; }
@media (max-width: 600px) { .erechnung-parteien { grid-template-columns: 1fr; } }
.file-meta { margin-bottom: 0; word-break: break-word; }

@media (max-width: 720px) {
    .filter { grid-template-columns: 1fr 1fr; }
    .filter input[type=search] { grid-column: 1 / -1; }
    .filter button { grid-column: 1 / -1; }
    .split, .row { grid-template-columns: 1fr; gap: 0; }
    .preview { margin-bottom: 1rem; }
    .preview iframe { height: 55vh; }
    .badge { min-width: 0; }
    .topbar nav { order: 3; flex-basis: 100%; }
}

/* Schritt 2: Buchungen und EÜR */
.positiv { color: var(--einnahme); }
.negativ { color: var(--ausgabe); }
.field-hint { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); margin-top: .25rem; }
a.field-hint { color: var(--link); }
ul.plain { margin: .4rem 0 0; padding-left: 1.1rem; }
.warn-box ul.plain { margin-bottom: 0; }
.ohne-beleg { color: var(--ausgabe); }
.beleg-liste li.storniert { opacity: .55; }
.beleg-liste li.storniert strong { text-decoration: line-through; }
.filter-wide { grid-column: 1 / -1; margin: 0; }
form.inline { margin: 0; }
form.inline select { margin: 0; width: auto; }
.storno { margin-top: 1rem; }
.storno button.link { color: var(--error); }
.storno form { display: inline; }
.plain-fieldset { margin: 0; }
.offen-hinweis { font-size: .75rem; color: var(--link, var(--primary)); margin-left: .4rem; }
.preview h2 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.export { margin-top: 1rem; }

.segmented { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.segmented legend { width: 100%; }
.segmented label.radio { border: 1px solid var(--border); border-radius: 6px; padding: .45rem .9rem; margin: 0; cursor: pointer; }
.segmented label.radio:has(input:checked) { border-color: var(--primary); background: var(--bg); font-weight: 600; }

.ku { margin-top: 1rem; }
.ku-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; font-variant-numeric: tabular-nums; }
.ku .hint { margin: .6rem 0 0; font-size: .9rem; }
.meter { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.meter span { display: block; height: 100%; background: var(--einnahme); }
.meter-achtung span { background: var(--orange); }
.meter-warnung span, .meter-kritisch span { background: var(--error); }

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.group td { font-weight: 700; background: var(--bg); }
.table tr.total td { font-weight: 700; }
.table tr.grand td { font-size: 1.1rem; border-bottom: 0; }
.table small { color: var(--muted); }

.monate { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; }
.monat { display: grid; grid-template-columns: 2.5rem 1fr 9rem; gap: .75rem; align-items: center; padding: .3rem 0; }
.monat + .monat { border-top: 1px solid var(--border); }
.monat-name { color: var(--muted); font-size: .9rem; }
.bars { display: flex; flex-direction: column; gap: 3px; }
.bar { display: block; height: 7px; border-radius: 4px; min-width: 2px; }
.bar-einnahme, .dot-einnahme { background: var(--einnahme); }
.bar-ausgabe, .dot-ausgabe { background: var(--ausgabe); }
.monat-werte { display: flex; flex-direction: column; text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.legend { color: var(--muted); font-size: .85rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; margin: 0 .2rem 0 .6rem; }
.legend .dot:first-child { margin-left: 0; }

@media (max-width: 720px) {
    .monat { grid-template-columns: 2.2rem 1fr 7.5rem; gap: .5rem; }
    .table th, .table td { padding: .5rem .55rem; }
}

/* Schritt 3: Inventar */
.muted { color: var(--muted); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tabs a { text-decoration: none; color: var(--muted); padding: .5rem .8rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--orange); }
.beleg-betrag small { font-weight: 400; }
details { border: 1px solid var(--border); border-radius: 6px; padding: .6rem .8rem; margin-bottom: 1rem; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: .8rem; }
h2.first { margin-top: 0; }
form.card h2 { font-size: 1.05rem; margin: 1.5rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.table.compact th, .table.compact td { padding: .4rem .55rem; }

@media (max-width: 720px) {
    .topbar nav { flex-wrap: wrap; }
    .topbar nav a { white-space: nowrap; padding: .3rem .55rem; }
}

.beleg-liste.umbruch .beleg-main strong, .beleg-liste.umbruch .beleg-main small { white-space: normal; }
.split > * { min-width: 0; }
section.card { overflow-x: auto; }
.table.compact { font-size: .9rem; }

/* Schritt 3b: Abos */
.frist-warnung { color: var(--error); font-weight: 600; }
.tile-warnung { border-color: var(--error); }
.tile-warnung .tile-value { color: var(--error); }
.abo-tiles { margin-bottom: 1rem; }
.frist-box a { color: inherit; }
.inline-fields { display: grid; grid-template-columns: 1fr 1.3fr; gap: .5rem; }
.inline-fields input, .inline-fields select { margin-top: .3rem; }
.frist-box { margin-top: 1rem; }

/* Vermietung */
.beleg-main .meter { margin: .35rem 0 .2rem; max-width: 28rem; }
.rentabilitaet { margin-top: .75rem; }

/* Partner */
[hidden] { display: none !important; }
.partner-art { font-size: .75rem; color: var(--muted); margin-left: .4rem; font-weight: 400; }

/* Bankkonten und Kontoauszüge */
/* Feste Farben, damit der Knopf auch im Dunkelmodus lesbar bleibt (--error wird dort hellrot). */
button.danger { background: #b42318; border-color: #b42318; color: #fff; }
button.danger:hover { background: #912018; border-color: #912018; }
.filter-inline { margin: .5rem 0 1rem; }
.umsatz-liste { list-style: none; padding: 0; margin: 0 0 1rem; }
.umsatz-liste .umsatz { margin-bottom: .75rem; scroll-margin-top: 1rem; }
.umsatz.erledigt { opacity: .8; }
.umsatz-kopf { display: flex; justify-content: space-between; gap: 1rem; }
.umsatz-kopf .beleg-main small { display: block; color: var(--muted); word-break: break-word; }
.umsatz-status { margin: .4rem 0; font-weight: 600; color: var(--einnahme); }
.umsatz-status.warn { color: var(--ausgabe); }
.umsatz-titel { margin: .5rem 0 .2rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.umsatz-buchungen li { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .15rem 0; }
.umsatz-buchungen li.storniert { text-decoration: line-through; color: var(--muted); }
.umsatz-aktionen { align-items: flex-start; margin-top: .5rem; }
.umsatz-aktionen details { margin: 0; }
.umsatz-loeschen { text-align: right; font-size: .85rem; }

/* Rechnungen */
.rechnung-entwurf { color: var(--sonstiges); }
.rechnung-offen, .rechnung-teilbezahlt { color: var(--orange); }
.rechnung-ueberfaellig { color: var(--ausgabe); }
.rechnung-bezahlt { color: var(--einnahme); }
.rechnung-storniert { color: var(--sonstiges); text-decoration: line-through; }
.positionen { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; margin: 0 0 1rem; }
.pos-kopf, .pos-zeile { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) 5rem 5rem 7rem 6rem 7rem; gap: .5rem; align-items: start; }
.pos-kopf { font-size: .8rem; color: var(--muted); font-weight: 600; }
.pos-zeile { margin: .35rem 0; }
.pos-zeile textarea { min-height: 2.4rem; resize: vertical; overflow: hidden; }
.pos-betrag { text-align: right; padding-top: .55rem; font-variant-numeric: tabular-nums; }
.pos-summe { text-align: right; margin: .5rem 0 0; }
.pos-summe small { display: block; }
.pos-gesamtrabatt { margin-top: .6rem; }
.pos-rabatt td { color: var(--muted); font-size: .9em; padding-top: 0; }
@media (max-width: 640px) {
    .pos-kopf { display: none; }
    .pos-zeile { grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
    .pos-zeile textarea { grid-column: 1 / -1; }
}
.sammel .row { align-items: center; }
.umsatz-kopf input[type=checkbox] { width: 1.2rem; height: 1.2rem; margin: .2rem .4rem 0 0; flex: none; }
.umsatz-kopf .beleg-main { flex: 1; }
.checkbox-inline { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .3rem 0; } .checkbox-inline input { width: auto; }

/* To-do-Karte und Jahresabschluss-Checkliste */
.todo { margin: 1.5rem 0; }
.todo h2 { margin-top: 0; }
.todo-leer { margin: 0; }
.todo-liste { list-style: none; margin: 0; padding: 0; }
.todo-liste > li { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; padding: .55rem 0 .55rem .7rem; border-top: 1px solid var(--border); border-left: 3px solid var(--orange); }
.todo-liste > li:first-child { border-top: 0; }
.todo-liste > li.todo-info { border-left-color: var(--border); }
.todo-liste > li > details, .todo-liste > li > span { flex: 1; }
.todo-liste summary { cursor: pointer; }
.todo-liste details ul { margin: .4rem 0 0; font-size: .92rem; }
.todo-link { white-space: nowrap; }
.checkliste { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.checkliste li { display: flex; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.checkliste p { margin: .2rem 0 0; }
.check-icon { flex: 0 0 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.check-ok .check-icon { background: var(--ok-bg); }
.check-offen .check-icon { background: var(--warn-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) { .todo-liste > li { flex-direction: column; gap: .3rem; } }

/* Fristen-Banner (Kündigungs- und Garantiefristen), ausblendbar */
.frist-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; background: var(--warn-bg); border-radius: 6px; padding: .55rem .8rem; margin: 0 0 1rem; }
.frist-banner[hidden] { display: none; }
.frist-banner.dringend { border-left: 4px solid var(--orange); }
.frist-banner .frist-tage { color: var(--muted); font-size: .9rem; }
.frist-banner .frist-weg { margin-left: auto; padding: .1rem .4rem; }
@media (max-width: 600px) {
    .frist-banner { position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
}

/* Kundenmanagement: Menügruppe, Seitenleiste am Desktop */
.nav-gruppe { display: contents; }
.nav-gruppe .nav-unter { display: contents; }
.nav-gruppe:not(.offen) .nav-unter { display: none; }
.nav-gruppe.offen .nav-unter a { font-weight: 500; }
@media (min-width: 1000px) {
    body.mit-menue { padding-left: 232px; }
    body.mit-menue .topbar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 232px; box-sizing: border-box;
        flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 1rem;
        padding: 1.1rem .75rem; overflow-y: auto;
    }
    body.mit-menue .brand { padding: 0 .55rem .5rem; }
    body.mit-menue .topbar nav { flex-direction: column; gap: .1rem; flex: 1; }
    body.mit-menue .topbar nav a {
        border-bottom: 0; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; padding: .45rem .65rem;
    }
    body.mit-menue .topbar nav a:hover { background: rgba(255, 255, 255, .06); }
    body.mit-menue .topbar nav a.active { border-left-color: var(--orange); background: rgba(255, 255, 255, .08); }
    body.mit-menue .nav-gruppe { display: block; margin: .35rem 0; }
    body.mit-menue .nav-gruppe .nav-unter { display: flex; flex-direction: column; gap: .1rem; }
    body.mit-menue .nav-gruppe:not(.offen) .nav-unter { display: none; }
    body.mit-menue .nav-gruppe .nav-titel.active { background: none; border-left-color: transparent; }
    body.mit-menue .nav-gruppe .nav-unter a { padding-left: 1.4rem; font-size: .9rem; }
    body.mit-menue .logout { flex-wrap: wrap; padding: .5rem .55rem 0; border-top: 1px solid rgba(255, 255, 255, .12); }
    body.mit-menue main { margin: 0 auto; }
}

/* Ansprechpartner, Kontaktverlauf, Mahnwesen */
.kontakte { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; margin: 0 0 1rem; }
.kontakte legend { font-weight: 700; padding: 0 .3rem; }
.kontakt-zeile { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; align-items: center; padding-bottom: .6rem; margin-bottom: .6rem; border-bottom: 1px solid var(--border); }
.kontakt-zeile input { margin: 0; }
.checkbox-inline { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; white-space: nowrap; }
.checkbox-inline input { width: auto; margin: 0; }
.verlauf { list-style: none; padding: 0; margin: 1rem 0 0; }
.verlauf li { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--border); }
.notiz-form .row { align-items: end; }
.pos-aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .4rem; }
.pos-aktionen select { width: auto; max-width: 100%; margin: 0; }
.mahn-zeile { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; }
.mahn-zeile .beleg-main { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.mahn-zeile em { color: var(--ausgabe); font-style: normal; font-weight: 700; }
.beleg-liste .mahn-zeile a.beleg-main { display: block; padding: 0; }
.beleg-liste .mahn-zeile a.beleg-main:hover { background: none; }
.beleg-liste .mahn-zeile a.button { padding: .45rem .8rem; white-space: nowrap; }
.angebot-entwurf, .mahnstufe-1 { color: var(--muted); }
.angebot-offen { color: #1d4f91; }
.angebot-angenommen { color: var(--einnahme); }
.angebot-abgelehnt, .angebot-abgelaufen { color: #6b7280; }
.mahnstufe-2 { color: var(--orange); }
.mahnstufe-3 { color: var(--ausgabe); }
.dokument-upload { margin: .75rem 0 0; }
.dokument-upload summary { cursor: pointer; font-weight: 600; }
.dokument-upload form { margin-top: .75rem; }
.datei-optionen { border: 0; padding: 0; margin: 0; border-radius: 0; }
.datei-optionen > summary { font-weight: 400; list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; column-gap: .75rem; align-items: start; }
.datei-optionen > summary::-webkit-details-marker { display: none; }
.datei-optionen > summary .mahn-zeile { grid-column: 1; }
.datei-optionen > summary .datei-status { grid-column: 1; padding: 0 .8rem .55rem; margin-top: -.45rem; display: block; color: #4b5563; font-size: .82rem; }
.datei-knoepfe { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: inline-flex; align-items: center; gap: .15rem; margin-right: .5rem; }
.datei-sort { min-width: 0; width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: #374151; font-size: .95rem; line-height: 1; cursor: pointer; }
.datei-sort:hover:not(:disabled) { background: #f3f4f6; }
.datei-sort:disabled { opacity: .3; cursor: default; }
.beleg-liste li.ordner-kopf { padding: .45rem .8rem; background: #f6f7f9; font-weight: 700; font-size: .9rem; color: #1f2937; }
.beleg-liste li.ordner-kopf small { font-weight: 400; color: #6b7280; }
.ordner-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin-bottom: .6rem; }
.ordner-form label { flex: 1 1 14rem; margin: 0; }
.datei-pfeil { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
    border-radius: 6px; color: #374151; font-size: 1.05rem; transition: transform .15s, background .15s; }
.datei-optionen > summary:hover .datei-pfeil { background: #f3f4f6; }
.datei-optionen[open] > .datei-pfeil, .datei-optionen[open] > summary .datei-pfeil { transform: rotate(180deg); }
.datei-optionen[open] > summary { margin-bottom: .6rem; border-bottom: 1px solid #eef0f3; }
.datei-optionen[open] > :not(summary) { margin-left: .8rem; margin-right: .8rem; }
.datei-optionen[open] { padding-bottom: .7rem; }
form.card h2.first { border-top: 0; padding-top: 0; margin-top: 0; }

/* Kundenportal */
.portal-neu { display: inline-block; margin-left: .4rem; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: #e06c1f; color: #fff; vertical-align: middle; }
.portal-status { display: inline-block; margin-left: .4rem; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; border: 1px solid currentColor; vertical-align: middle; }
.portal-status-neu { color: #b4520f; }
.portal-status-freigegeben { color: #1e6b3a; }
.portal-status-aenderung { color: #9b2c2c; }
.portal-status-ersetzt { color: var(--muted); }
.portal-rueckmeldung { margin: 0 .8rem .6rem; padding: .55rem .75rem; border-radius: 8px; background: rgba(20, 33, 61, .05); font-size: .92rem; }
.portal-rueckmeldung.ungelesen { background: rgba(224, 108, 31, .12); }
.portal-rueckmeldung p { margin: .35rem 0 0; }
.portal-zugangsdaten { margin-bottom: 1rem; border-color: #e06c1f; }
.portal-zugangsdaten textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: .5rem 0; }
.portal-zugang-aktionen { padding: 0 .8rem .65rem; }
.portal-zugang-aktionen button { padding: .3rem .7rem; font-size: .88rem; }
.positionen.mit-intervall .pos-kopf, .positionen.mit-intervall .pos-zeile { grid-template-columns: 3.6rem minmax(0, 1fr) 4.5rem 5rem 6.5rem 5.5rem 7rem 7rem; }
.pos-zeile.pos-zs { grid-template-columns: 3.6rem minmax(0, 1fr) 7rem 2rem !important; background: var(--surface-2, rgba(0,0,0,.03)); border-radius: var(--radius); padding: .2rem .3rem; }
.pos-zs input[type=text] { font-weight: 600; }
.pos-zs .pos-betrag { font-weight: 600; }
.pos-entfernen { padding: .45rem 0 0; }
tr.pos-zwischensumme td { font-weight: 600; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
    .positionen.mit-intervall .pos-zeile { grid-template-columns: 1fr 1fr 1fr; }
    .pos-zeile.pos-zs { grid-template-columns: 1fr auto auto !important; }
    .pos-griff { grid-column: 1 / -1; justify-content: flex-start; }
}
.pos-griff { display: flex; align-items: center; gap: .1rem; padding-top: .45rem; cursor: grab; user-select: none; }
.pos-griff .pos-nr { min-width: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.pos-griff button { padding: 0 .2rem; text-decoration: none; font-size: 1rem; line-height: 1; }
.pos-zieht { opacity: .5; }

/* Hosting (all-inkl) */
.hosting-tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.row > label.voll { grid-column: 1 / -1; }
.hosting-verbindung { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem .9rem; }
.pw-paar { display: grid; gap: .4rem; }
.pw-paar .pw-erzeugen { justify-self: start; padding-left: 0; }
.pw-anzeige { font-family: ui-monospace, monospace; font-size: .9rem; background: var(--warn-bg); padding: .4rem .6rem; border-radius: 6px; user-select: all; }

/* Stelle der Unterschrift im PDF markieren */
.sigfeld { margin: .5rem 0 1rem; }
.sigfeld-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .3rem 0; }
.sigfeld-kopf button:not(.link) { min-width: 2.2rem; padding: .2rem .6rem; }
.sigfeld-buehne { position: relative; max-width: 100%; border: 1px solid #d1d5db; box-shadow: 0 2px 8px rgba(0,0,0,.08); cursor: crosshair; background: #fff; }
.sigfeld-buehne canvas { display: block; max-width: 100%; height: auto; }
.sigfeld-wahl { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.sf-rolle { display: inline-flex; align-items: center; gap: .4rem; border: 2px solid #d1d5db; background: #fff; color: #1f2937; border-radius: 999px; padding: .3rem .8rem; font-weight: 600; cursor: pointer; }
.sf-rolle small { font-weight: 400; color: #6b7280; }
.sf-punkt { width: .8rem; height: .8rem; border-radius: 3px; border: 2px dashed currentColor; }
.sf-rolle.sf-kunde .sf-punkt { color: #e0701d; background: rgba(224, 112, 29, .2); }
.sf-rolle.sf-anbieter .sf-punkt { color: #1e3a8a; background: rgba(30, 58, 138, .2); }
.sf-rolle.sf-kunde.aktiv { border-color: #e0701d; background: #fff4ec; }
.sf-rolle.sf-anbieter.aktiv { border-color: #1e3a8a; background: #eef2ff; }
.sigfeld-rahmen { position: absolute; border: 2px dashed #e0701d; background: rgba(224, 112, 29, .18); pointer-events: none; display: flex; align-items: flex-start; box-shadow: 0 0 0 3px rgba(255,255,255,.7); }
.sigfeld-rahmen span { font-size: .72rem; font-weight: 700; color: #fff; background: #e0701d; padding: 1px 6px; border-radius: 0 0 4px 0; white-space: nowrap; }
.sigfeld-rahmen.sf-anbieter { border-color: #1e3a8a; background: rgba(30, 58, 138, .16); }
.sigfeld-rahmen.sf-anbieter span { background: #1e3a8a; }

/* Eigene Unterschrift (MSolutions) */
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/manrope-latin.woff2") format("woff2");
}

/* Portal-Bausteine, die auch in der Buchhaltung vorkommen. Farben kommen aus den Variablen oben,
   damit ein späteres :root den Dunkelmodus nicht wieder auf dunkle Schrift zurücksetzt. */
:root {
    --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--grund); line-height: 1.6; font-size: 16px; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--link); }
a:hover { color: var(--orange-text); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; margin: 0 0 .5rem; }
h2 { font-size: 1.45rem; font-weight: 800; margin: 0 0 .5rem; }
h3 { font-size: 1.15rem; font-weight: 800; margin: 0 0 .4rem; }
p { margin: 0 0 .9rem; }
img { max-width: 100%; }

.breite { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
main.breite { flex: 1 0 auto; padding-top: 40px; padding-bottom: 72px; }

/* Kopf */
.kopf { background: var(--card); border-bottom: 1px solid var(--linie); color: var(--text); }
.kopf-innen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.marke img { display: block; width: 168px; height: auto; }
.abmelden { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0; font-size: .95rem; color: var(--leise); }
.abmelden strong { color: var(--navy); }
.zurueck { font-weight: 600; text-decoration: none; padding: 10px 0; }

/* Fuß */
.fuss { background: var(--navy); color: #d5dce6; font-size: .9rem; padding: 28px 0; }
.fuss a { color: #fff; }
.fuss a:hover { color: #f5b88a; }

/* Bausteine */
.karte { background: var(--card); color: var(--text); border-radius: var(--radius); padding: 28px; border: 1px solid var(--linie); }
.leise { color: var(--leise); }
.klein { font-size: .9rem; }
.ueberzeile { font-size: .85rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-text); margin: 0 0 .4rem; }
.kopfzeile { margin-bottom: 32px; max-width: 720px; }
.abschnitt { margin: 40px 0 16px; }
.hinweis { background: var(--grund); border-radius: 8px; padding: 10px 14px; }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 22px; border-radius: 8px; border: 1.5px solid var(--orange); background: var(--orange); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.knopf:hover { background: #c95d14; border-color: #c95d14; color: #fff; }
.knopf.rahmen { background: var(--card); color: var(--text); border-color: var(--border); }
.knopf.rahmen:hover { background: var(--navy); color: #fff; }
.knopf.gross { font-size: 1.05rem; padding: 13px 26px; }
.knopf.voll { width: 100%; }
.knopf:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #f5b88a; outline-offset: 2px; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }

label { display: block; font-weight: 700; font-size: .95rem; margin: 14px 0 6px; }
input[type=text], input[type=password], textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; min-height: 48px; background: var(--field); color: var(--text); }
textarea { resize: vertical; }

.meldung { border-radius: 10px; padding: 12px 16px; margin: 0 0 20px; font-weight: 600; }
.meldung-ok { background: #dcefe3; color: #1e5c35; }
.meldung-warn { background: #fdebdd; color: #8a3d0a; }

.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.status-neu { background: #fdebdd; color: #8a3d0a; }
.status-freigegeben { background: #dcefe3; color: #1e5c35; }
.status-aenderung { background: #fde2e2; color: #8a1f1f; }
.status-ersetzt { background: var(--linie); color: #374151; }
.status-live { background: #e5e9f0; color: var(--navy); }
.status-zeile { font-weight: 600; margin: 12px 0 4px; }
.status-zeile.freigegeben { color: #1e5c35; }
.status-zeile.aenderung { color: #8a3d0a; }

/* Login */
.login { display: flex; justify-content: center; padding: 24px 0; }
.login-karte { width: 100%; max-width: 440px; box-shadow: 0 10px 40px rgba(20, 33, 61, .08); }
.login-karte .knopf { margin-top: 22px; }
.login-karte .klein { margin-top: 18px; }

/* Website-Vorschau */
.website { display: flex; flex-wrap: wrap; padding: 0; overflow: hidden; border: 2px solid var(--orange); margin-bottom: 24px; }
.website-bild { flex: 1 1 380px; min-height: 240px; background: var(--navy); padding: 28px; display: flex; align-items: center; justify-content: center; }
.browser { width: 100%; max-width: 460px; background: #fff; border-radius: 10px; overflow: hidden; }
.browser-leiste { background: #eef1f5; padding: 9px 12px; display: flex; align-items: center; gap: 6px; }
.browser-leiste span { width: 9px; height: 9px; border-radius: 50%; background: #c7ced8; }
.browser-leiste em { margin-left: 8px; font-style: normal; font-size: .75rem; color: var(--leise); }
.browser-inhalt { height: 170px; display: flex; align-items: center; justify-content: center; }
.browser-inhalt img { width: 55%; height: auto; }
.website-text { flex: 1 1 360px; padding: 28px 32px; }

/* Dateien */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.datei { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.datei-bild { display: flex; align-items: center; justify-content: center; height: 210px; background: #e9edf3; text-decoration: none; }
.datei-bild img { width: 100%; height: 100%; object-fit: cover; }
.pdf { font-weight: 800; font-size: 1.6rem; color: var(--navy); border: 2px solid var(--navy); border-radius: 8px; padding: 10px 18px; }
.datei-text { padding: 22px 24px; }

/* Rückmeldung */
.rueckmeldung { margin-top: 8px; }
.rueckmeldung summary { list-style: none; width: fit-content; }
.rueckmeldung summary::-webkit-details-marker { display: none; }
.rueckmeldung[open] summary { margin-bottom: 4px; }

@media (max-width: 560px) {
    .karte:not(.website):not(.datei), .website-text, .datei-text { padding: 20px; }
    .website-bild { padding: 18px; min-height: 180px; }
    .browser-inhalt { height: 120px; }
    .browser-inhalt.startseite { height: auto; }
}

/* Dokumente */
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.dateiliste { list-style: none; margin: 8px 0 0; padding: 0; }
.dateiliste li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--linie); }
.dateiliste li:first-child { border-top: 0; }
.dateityp { flex: 0 0 auto; min-width: 52px; text-align: center; font-weight: 800; font-size: .8rem; color: var(--navy); border: 2px solid var(--navy); border-radius: 6px; padding: 6px 4px; }
.dateiinfo { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.dateiinfo .hinweis { margin: 6px 0; }
.dateiinfo .knoepfe { margin-bottom: 0; }
.unterabschnitt { margin-top: 28px; }
input[type=file] { width: 100%; font: inherit; padding: 10px; border: 1px dashed #9ca3af; border-radius: 8px; background: var(--grund); }

/* Live-Bild der Startseite: die Seite wird in Desktop-Breite geladen und verkleinert (portal.js setzt den Faktor). */
a.website-bild { text-decoration: none; }
.browser-inhalt.startseite { position: relative; height: auto; aspect-ratio: 16 / 10; overflow: hidden; display: block; }
.browser-inhalt.startseite img { position: absolute; inset: 0; margin: auto; width: 55%; }
.browser-inhalt.startseite iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; background: #fff;
    transform-origin: 0 0; transform: scale(.35); pointer-events: none; opacity: 0; transition: opacity .3s; }
.browser-inhalt.startseite iframe.geladen { opacity: 1; }

/* Hosting bei all-inkl */
.reiter { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--linie); margin: 0 0 22px; }
.reiter a { padding: 10px 14px; text-decoration: none; color: var(--leise); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.reiter a.aktiv { color: var(--navy); border-bottom-color: var(--orange); }
.tabelle-rahmen { overflow-x: auto; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle th { font-size: .85rem; color: var(--leise); font-weight: 700; }
.tabelle .zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zeilenkopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.formular label { display: block; font-weight: 700; margin: 0 0 16px; }
.formular input, .formular select, .formular textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border: 1.5px solid var(--linie); border-radius: 8px; font: inherit; font-weight: 400; background: #fff; color: var(--text); }
.formular .feldhinweis { display: block; font-weight: 400; font-size: .85rem; color: var(--leise); margin-top: 4px; }
.formular .feldfehler { display: block; font-weight: 600; font-size: .9rem; color: #b42318; margin-top: 4px; }
.formular-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 20px; }
.pw-paar { display: grid; gap: 6px; }
.knopf-link { background: none; border: 0; padding: 4px 0; color: var(--navy); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; justify-self: start; }
.pw-anzeige { font-family: ui-monospace, monospace; font-size: .9rem; background: #fff4e5; padding: 8px 10px; border-radius: 8px; user-select: all; }
.knopf.gefahr { background: #fff; color: #b42318; border-color: #b42318; }
.knopf.gefahr:hover { background: #b42318; color: #fff; }
.hosting-links { display: flex; gap: 10px; flex-wrap: wrap; }
.abstand-oben { margin-top: 18px; }

/* Digitale Annahme */
.annahme-hinweis { border: 2px solid var(--orange); margin-bottom: 24px; }
.annahme-hinweis h2 { margin-top: 0; }
.annahme-hinweis ul { margin: 8px 0 0; padding-left: 20px; }
.annahme { margin-top: 14px; padding: 14px 16px; border-radius: 10px; background: var(--grund); border: 1px solid var(--linie); }
.annahme > p:first-child, .annahme .status-zeile { margin-top: 0; }
.annahme label.haken { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin: 14px 0 4px; cursor: pointer; }
.annahme label.haken input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--orange); }
.annahme.erledigt { background: #f1f8f3; border-color: #cfe6d7; }

/* Unterschrift */
@font-face {
    font-family: "MSUnterschrift";
    font-style: normal;
    font-weight: 600;
    font-display: block;
    src: url("fonts/dancing-script-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "MSUnterschrift";
    font-style: normal;
    font-weight: 600;
    font-display: block;
    src: url("fonts/dancing-script-latin-ext-600-normal.woff2") format("woff2");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
.annahme-intern .feldname { display: block; font-weight: 700; margin: .8rem 0 .3rem; }
.unterschrift-feld { position: relative; max-width: 560px; background: #fff; border: 1.5px dashed #9ca3af; border-radius: 10px; overflow: hidden; }
.unterschrift-feld canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.unterschrift-feld.vorschau canvas { aspect-ratio: 4 / 1; cursor: default; }
.unterschrift-feld::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px solid #c7ced8; pointer-events: none; }
.unterschrift-tipp { position: absolute; left: 0; right: 0; top: 38%; text-align: center; color: #9ca3af; pointer-events: none; }
.unterschrift-feld.hat-strich .unterschrift-tipp { display: none; }
.annahme-intern button[type=submit] { margin-top: .8rem; }

/* Kundenportal-Seite eines Kunden: Kopf, Reiter, Kacheln, Dokumententabelle, Zeitleiste */
.akt-kopf { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin: -.25rem 0 1rem; color: var(--muted); }
.akt-kopf strong { color: var(--text); }
.reiter-leiste { overflow-x: auto; scrollbar-width: thin; }
.reiter-leiste a { white-space: nowrap; }
.reiter-leiste small { color: var(--muted); font-weight: 400; }
.tile-link { color: inherit; text-decoration: none; }
.tile-link:hover { border-color: var(--orange); }
.filterleiste { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .88rem; background: var(--card); color: var(--text); cursor: pointer; min-height: 0; }
.chip.an { border-color: var(--orange); background: #fdebdd; color: #8a3d0a; font-weight: 700; }
.dok-liste .dok-kopfzeile, .dok-zeile { display: grid; grid-template-columns: minmax(12rem, 2.2fr) 6.5rem 7.5rem 9rem 8.5rem 6.5rem; gap: .5rem; align-items: center; }
.dok-liste .dok-kopfzeile { padding: .5rem 3.4rem .5rem .8rem; font-size: .82rem; color: var(--muted); font-weight: 600; }
.dok-zeile { padding: .6rem .8rem; font-size: .9rem; }
.dok-titel { color: inherit; text-decoration: none; min-width: 0; }
.dok-titel:hover strong { text-decoration: underline; }
.dok-titel small { display: block; color: var(--muted); font-size: .8rem; }
.beleg-liste .dok-zeile a.dok-titel { display: block; padding: 0; }
.dok-zelle { font-variant-numeric: tabular-nums; }
.dok-ok { color: var(--einnahme); font-weight: 600; }
.dok-wartet { color: #b4520f; font-weight: 600; }
.dok-leise { color: var(--muted); }
.beleg-liste li.ordner-kopf { padding: 0; }
.ordner-schalter { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .4rem; width: 100%; padding: .45rem .8rem; cursor: pointer; font-weight: 700; }
.ordner-schalter:focus-visible { outline: 2px solid var(--orange); }
.ordner-pfeil { margin-left: auto; transition: transform .15s; }
.ordner-kopf.zu .ordner-pfeil { transform: rotate(-90deg); }
.zeitleiste { list-style: none; margin: 0; padding: 0; }
.zeitleiste li { display: grid; grid-template-columns: 5.5rem 1.6rem 1fr; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--border); align-items: start; }
.zeitleiste li.tag-kopf { display: block; font-weight: 700; padding: .9rem 0 .2rem; border-top: 0; }
.zeitleiste li.tag-kopf:first-child { padding-top: 0; }
.zeitleiste time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.zeitleiste small { color: var(--muted); }
@media (max-width: 900px) {
    .dok-liste .dok-kopfzeile { display: none; }
    .dok-zeile { grid-template-columns: 1fr 1fr; gap: .2rem .8rem; }
    .dok-titel { grid-column: 1 / -1; margin-bottom: .2rem; }
    .dok-zelle { font-size: .82rem; }
    .dok-zelle::before { content: attr(data-label) ": "; color: var(--muted); }
    .zeitleiste li { grid-template-columns: 4.6rem 1.4rem 1fr; }
}
@media (prefers-color-scheme: dark) {
    .chip.an { background: #3a2414; color: #f5b88a; }
    .dok-wartet { color: #f28a3e; }
}
.kontakt-name { display: flex; gap: .4rem; }
.kontakt-name select { width: auto; flex: 0 0 auto; margin: 0; }
.kontakt-name input { flex: 1; min-width: 0; }
.signatur-vorschau { width: 100%; max-width: 560px; height: 300px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.einladung-status { margin: .1rem .8rem .3rem; font-size: .85rem; color: var(--muted); }
.einladung-ok { color: var(--einnahme); }
.einladung-fehler { color: var(--error); }
.einladung-form { margin: .2rem .8rem .5rem; }
.einladung-form .inline-fields { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.einladung-form .inline-fields label { flex: 1 1 16rem; margin: 0; }

/* Bereiche: Buchhaltung / Kundenverwaltung */
.bereich-wahl { display: flex; gap: .2rem; background: rgba(255, 255, 255, .08); border-radius: 8px; padding: .2rem; flex: 0 0 auto !important; }
.topbar nav.bereich-wahl a { flex: 1; text-align: center; border: 0; border-radius: 6px; padding: .35rem .6rem; font-size: .85rem; white-space: nowrap; }
.topbar nav.bereich-wahl a.active { background: var(--orange); color: #fff; border: 0; }
.bereich-karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; margin-top: 1rem; }
.bereich-karte { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: .5rem; }
.bereich-karte:hover { border-color: var(--orange); }
.bereich-karte p { flex: 1; color: var(--muted); margin: 0; }
.bereich-karte .button { align-self: flex-start; }
.bereich-symbol { font-size: 2rem; }
@media (min-width: 1000px) {
    body.mit-menue .topbar nav.bereich-wahl { flex-direction: row; flex: 0 0 auto; }
    body.mit-menue .topbar nav.bereich-wahl a { border-left: 0; border-radius: 6px; padding: .4rem .3rem; font-size: .8rem; }
    body.mit-menue .topbar nav.bereich-wahl a.active { background: var(--orange); }
}
@media (max-width: 999px) {
    .topbar { flex-wrap: wrap; }
    .topbar nav.bereich-wahl { order: 2; flex-basis: 100%; }
}
/* body ist ein Flex-Container: ohne min-width würde breiter Inhalt (z. B. die Reiterleiste) main am Handy verbreitern. */
body > main { min-width: 0; width: 100%; box-sizing: border-box; }

/* Fahrtenbuch */
fieldset.ohne-rahmen { border: 0; padding: 0; margin: 0; min-width: 0; }
.fahrt-hz { align-self: end; margin-bottom: .9rem; }
.monat-wahl { justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.monat-wahl h2 { margin: 0; }
.monat-wahl a { text-decoration: none; font-size: 1.2rem; padding: 0 .4rem; }
.fahrten-monate { list-style: none; padding: 0; margin: 0; }
.fahrten-monate li { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.fahrten-monate li:last-child { border-bottom: 0; }

/* Kategorien */
.kategorien-tabelle tr.ausgeblendet td { opacity: .55; }

/* Darstellung: Hell, Dunkel oder dem System folgen. data-theme setzt das Startskript vor dem ersten Paint. */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1628;
    --card: #1b2744;
    --field: #121c33;
    --text: #e8ecf3;
    --muted: #c5d0e0;
    --border: #31415f;
    --primary: #f28a3e;
    --primary-text: #1a1208;
    --link: #f5b88a;
    --bar: #0a1120;
    --bar-text: #ffffff;
    --bar-muted: #c5d0e0;
    --einnahme: #7ddea8;
    --ausgabe: #ffb4ab;
    --sonstiges: #c5d0e0;
    --error: #ffb4ab;
    --error-bg: #3f2422;
    --warn-bg: #3a2c18;
    --ok-bg: #173324;
    --grund: #0e1628;
    --linie: #31415f;
    --leise: #c5d0e0;
    --orange-text: #f5b88a;
}
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0e1628;
        --card: #1b2744;
        --field: #121c33;
        --text: #e8ecf3;
        --muted: #c5d0e0;
        --border: #31415f;
        --primary: #f28a3e;
        --primary-text: #1a1208;
        --link: #f5b88a;
        --bar: #0a1120;
        --bar-text: #ffffff;
        --bar-muted: #c5d0e0;
        --einnahme: #7ddea8;
        --ausgabe: #ffb4ab;
        --sonstiges: #c5d0e0;
        --error: #ffb4ab;
        --error-bg: #3f2422;
        --warn-bg: #3a2c18;
        --ok-bg: #173324;
        --grund: #0e1628;
        --linie: #31415f;
        --leise: #c5d0e0;
        --orange-text: #f5b88a;
    }
}

.theme-wahl { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }
.theme-wahl button { margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); min-height: 36px; padding: .35rem .7rem; font-size: .85rem; }
.theme-wahl button + button { border-left: 1px solid var(--border); }
.theme-wahl button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }
.topbar .theme-wahl { border-color: rgba(255, 255, 255, .28); background: transparent; }
.topbar .theme-wahl button { color: var(--bar-text); background: transparent; }
.topbar .theme-wahl button + button { border-left-color: rgba(255, 255, 255, .28); }
.topbar .theme-wahl button[aria-pressed="true"] { background: var(--orange); color: #1a1208; }
.theme-wahl-gast { margin: 0 0 1rem; }

.login-logo img.logo-dunkel { display: none; }
html[data-theme="dark"] .login-logo img.logo-hell { display: none; }
html[data-theme="dark"] .login-logo img.logo-dunkel { display: block; }
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .login-logo img.logo-hell { display: none; }
    html:not([data-theme="light"]) .login-logo img.logo-dunkel { display: block; }
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .formular input,
html[data-theme="dark"] .formular select,
html[data-theme="dark"] .formular textarea {
    background: var(--field);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    box-shadow: 0 0 0 1000px var(--field) inset;
    transition: background-color 9999s ease-out;
}
html[data-theme="dark"] .karte,
html[data-theme="dark"] .kopf,
html[data-theme="dark"] .tabelle,
html[data-theme="dark"] .tabelle-rahmen,
html[data-theme="dark"] .qr-code,
html[data-theme="dark"] .datei-sort,
html[data-theme="dark"] .sf-rolle,
html[data-theme="dark"] .sigfeld-buehne,
html[data-theme="dark"] .browser,
html[data-theme="dark"] .unterschrift-feld,
html[data-theme="dark"] .signatur-vorschau,
html[data-theme="dark"] .pw-anzeige,
html[data-theme="dark"] .beleg-liste li.ordner-kopf {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] .datei-status,
html[data-theme="dark"] .sf-rolle small,
html[data-theme="dark"] .beleg-liste li.ordner-kopf small { color: var(--muted); }
html[data-theme="dark"] .knopf.gefahr { background: transparent; color: var(--error); border-color: var(--error); }
html[data-theme="dark"] .chip.an,
html[data-theme="dark"] .sf-rolle.sf-kunde.aktiv { background: #3a2c18; color: #f6e7df; }
html[data-theme="dark"] .meldung-ok, html[data-theme="dark"] .status-freigegeben { background: var(--ok-bg); color: var(--einnahme); }
html[data-theme="dark"] .meldung-warn, html[data-theme="dark"] .status-neu { background: var(--warn-bg); color: #f6e7df; }
html[data-theme="dark"] .status-aenderung { background: var(--error-bg); color: var(--error); }
html[data-theme="dark"] .dok-wartet, html[data-theme="dark"] .portal-status-neu { color: #f5b88a; }

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) input,
    html:not([data-theme="light"]) select,
    html:not([data-theme="light"]) textarea,
    html:not([data-theme="light"]) .formular input,
    html:not([data-theme="light"]) .formular select,
    html:not([data-theme="light"]) .formular textarea {
        background: var(--field);
        color: var(--text);
        border-color: var(--border);
    }
    html:not([data-theme="light"]) .karte,
    html:not([data-theme="light"]) .kopf,
    html:not([data-theme="light"]) .tabelle-rahmen,
    html:not([data-theme="light"]) .qr-code,
    html:not([data-theme="light"]) .datei-sort,
    html:not([data-theme="light"]) .sf-rolle,
    html:not([data-theme="light"]) .sigfeld-buehne,
    html:not([data-theme="light"]) .browser,
    html:not([data-theme="light"]) .unterschrift-feld,
    html:not([data-theme="light"]) .signatur-vorschau,
    html:not([data-theme="light"]) .beleg-liste li.ordner-kopf {
        background: var(--card);
        color: var(--text);
        border-color: var(--border);
    }
}

@media print {
    html, html[data-theme="dark"] {
        color-scheme: light !important;
        --bg: #ffffff !important;
        --card: #ffffff !important;
        --field: #ffffff !important;
        --text: #14213d !important;
        --muted: #333333 !important;
        --border: #cccccc !important;
        --grund: #ffffff !important;
        --linie: #cccccc !important;
        --leise: #333333 !important;
        --link: #14213d !important;
    }
    body { background: #fff !important; color: #14213d !important; }
    .theme-wahl, .topbar, .frist-banner { display: none !important; }
}
