/* Rechnungsportal – schlichte, gut lesbare Oberfläche für kaufmännische Anwender. */
:root {
  --primaer: #1f4e8c;
  --primaer-dunkel: #163a69;
  --hintergrund: #f4f6f9;
  --karte: #ffffff;
  --text: #1d2733;
  --gedimmt: #5b6776;
  --linie: #d9dee5;
  --rot: #b42318;
  --rot-hell: #fdecea;
  --orange: #b54708;
  --orange-hell: #fff4e5;
  --gelb-hell: #fff7d1;
  --gelb: #c49000;
  --gruen: #067647;
  --gruen-hell: #e7f6ee;
  --blau-hell: #eaf1fb;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--hintergrund); color: var(--text); font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.45; }
a { color: var(--primaer); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.gedimmt { color: var(--gedimmt); }
.klein { font-size: .85rem; }
.rechts { text-align: right; }
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.versteckt { display: none !important; }

.kopf { display: flex; align-items: center; gap: 1.5rem; background: var(--primaer); color: #fff; padding: .6rem 1.25rem; flex-wrap: wrap; }
.kopf a { color: #fff; text-decoration: none; }
.marke { font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.hauptnavigation { display: flex; gap: .25rem; flex-wrap: wrap; }
.hauptnavigation a { padding: .4rem .7rem; border-radius: 6px; }
.hauptnavigation a:hover, .hauptnavigation a.aktiv { background: rgba(255,255,255,.18); }
.benutzer { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.benutzer form { margin: 0; }
button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.umgebung { background: var(--gelb-hell); border-bottom: 1px solid #ecd27a; padding: .35rem 1.25rem; font-size: .88rem; }
.umgebung.staging { background: var(--orange-hell); border-bottom: 2px solid var(--orange); color: #7a2e00; }
.umgebung-modus { display: block; font-weight: 600; }
/* Mailmodus (Versandseiten, Rechnungsdetail): Sandbox/Testadresse deutlich abgesetzt, echter Versand in Rot */
.modus { border: 1px solid #ecd27a; border-left: 6px solid var(--gelb); background: var(--gelb-hell); border-radius: var(--radius); padding: .5rem .8rem; margin: .5rem 0; font-size: .9rem; }
.modus.testadresse { border-color: #f7c98b; border-left-color: var(--orange); background: var(--orange-hell); }
.modus.echt { border-color: #f4b4ad; border-left-color: var(--rot); background: var(--rot-hell); }
.modus-hinweis { display: block; color: #7a5a00; font-size: .82rem; margin-top: .15rem; }
.inhalt { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.fuss { max-width: 1400px; margin: 1rem auto 2rem; padding: 0 1.25rem; color: var(--gedimmt); font-size: .8rem; }

.meldungen { list-style: none; padding: 0; margin: 0 0 1rem; }
.meldung { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: .4rem; border: 1px solid var(--linie); background: var(--karte); }
.meldung.success { background: var(--gruen-hell); border-color: #a6dcc0; }
.meldung.error { background: var(--rot-hell); border-color: #f4b4ad; }
.meldung.warning { background: var(--orange-hell); border-color: #f7c98b; }
.meldung.info { background: var(--blau-hell); border-color: #b9cdea; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.karte.schmal { max-width: 480px; margin: 2rem auto; }
.raster { display: grid; gap: 1rem; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.raster.kacheln { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.kopfzeile h1 { margin: 0; }

.kachel { display: block; background: var(--karte); border: 1px solid var(--linie); border-left: 6px solid var(--gedimmt); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: var(--text); }
.kachel .anzahl { font-size: 2rem; font-weight: 700; display: block; }
.kachel:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.kachel.zu_bearbeiten { border-left-color: var(--primaer); }
.kachel.wartet { border-left-color: var(--gelb); }
.kachel.versandbereit { border-left-color: #6941c6; }
.kachel.versendet { border-left-color: #0e7090; }
.kachel.handlungsbedarf { border-left-color: var(--rot); }
.kachel.bezahlt { border-left-color: var(--gruen); }

.marke-status { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eef1f5; color: var(--text); white-space: nowrap; }
.marke-status.zu_bearbeiten, .marke-status.entwurf, .marke-status.offen { background: var(--blau-hell); color: var(--primaer-dunkel); }
.marke-status.wartet, .marke-status.unsicher, .marke-status.pruefpflichtig { background: var(--gelb-hell); color: #7a5a00; }
.marke-status.handlungsbedarf, .marke-status.blockierend, .marke-status.fehlt, .marke-status.fehler { background: var(--rot-hell); color: var(--rot); }
.marke-status.geprueft, .marke-status.bestaetigt, .marke-status.erkannt, .marke-status.ok, .marke-status.bezahlt, .marke-status.erledigt { background: var(--gruen-hell); color: var(--gruen); }
.marke-status.korrigiert { background: #f0e9ff; color: #5925dc; }
.marke-status.info, .marke-status.ausgeschlossen, .marke-status.nicht_noetig { background: #eef1f5; color: var(--gedimmt); }
.marke-status.versandbereit { background: #f0e9ff; color: #5925dc; }

table.tabelle { width: 100%; border-collapse: collapse; background: var(--karte); font-size: .92rem; }
.tabelle th, .tabelle td { padding: .45rem .55rem; border-bottom: 1px solid var(--linie); vertical-align: top; text-align: left; }
.tabelle th { background: #f0f3f7; font-weight: 600; position: sticky; top: 0; }
.tabelle tr.markiert td { background: var(--gelb-hell); }
.tabelle tr.ausgeschlossen td { color: var(--gedimmt); text-decoration: line-through; }
.tabelle td.abweichung { color: var(--rot); font-weight: 600; }
.tabellenrahmen { overflow: auto; max-height: 70vh; border: 1px solid var(--linie); border-radius: var(--radius); }

.knopf { display: inline-block; padding: .5rem .95rem; border-radius: 6px; border: 1px solid var(--linie); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.knopf:hover { background: #f2f4f7; }
.knopf.primaer { background: var(--primaer); border-color: var(--primaer); color: #fff; }
.knopf.primaer:hover { background: var(--primaer-dunkel); }
.knopf.gefahr { color: var(--rot); border-color: #f4b4ad; }
.knopf.klein { padding: .25rem .55rem; font-size: .85rem; }
.knopf[disabled] { opacity: .5; cursor: not-allowed; }
.aktionen { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.aktionen.kompakt { margin: 0 0 .6rem; }
.aktionen.kompakt select { width: auto; min-width: 12rem; }

.formular label, .feldgruppe label { display: block; font-weight: 600; margin: .6rem 0 .2rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #b8c1cc; border-radius: 6px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 3px solid #bcd3f5; border-color: var(--primaer); }
.helptext, .hilfe { color: var(--gedimmt); font-size: .82rem; display: block; margin-top: .15rem; }
.errorlist { color: var(--rot); margin: .2rem 0; padding-left: 1.1rem; font-size: .88rem; }
.formular-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1rem; }
ul.checkliste { list-style: none; padding: 0; margin: 0; }
ul.checkliste li { padding: .2rem 0; }

.reiter { display: flex; gap: .2rem; border-bottom: 2px solid var(--linie); margin-bottom: 1rem; flex-wrap: wrap; }
.reiter a { padding: .55rem .95rem; text-decoration: none; color: var(--gedimmt); border-radius: 6px 6px 0 0; font-weight: 600; }
.reiter a.aktiv { color: var(--primaer); border-bottom: 3px solid var(--primaer); margin-bottom: -2px; background: var(--karte); }
.reiter .zaehler { background: var(--rot); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .3rem; }

.ablage { border: 2px dashed #9fb3cf; border-radius: var(--radius); background: #f8fbff; padding: 1.5rem; text-align: center; transition: background .15s; }
.ablage.aktiv { background: var(--blau-hell); border-color: var(--primaer); }
.ablage p { margin: .3rem 0; }
.uploadliste { list-style: none; padding: 0; text-align: left; margin: .8rem 0 0; }
.uploadliste li { padding: .4rem .6rem; border-radius: 6px; margin-bottom: .3rem; background: #fff; border: 1px solid var(--linie); }
.uploadliste li.ok { border-color: #a6dcc0; }
.uploadliste li.fehler { border-color: #f4b4ad; background: var(--rot-hell); }

.ampel { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px dashed var(--linie); }
.ampel:last-child { border-bottom: 0; }
.ampel .symbol { width: 1.4rem; text-align: center; font-weight: 700; }
.ampel.fehler .symbol { color: var(--rot); }
.ampel.warnung .symbol { color: var(--orange); }
.ampel.ok .symbol { color: var(--gruen); }

/* Dokumentansicht: Original links, erkannte Daten rechts */
.dokumentansicht { display: grid; grid-template-columns: minmax(380px, 1.1fr) minmax(380px, 1fr); gap: 1rem; align-items: start; }
.seitenrahmen { position: sticky; top: .5rem; background: #525659; border-radius: var(--radius); padding: .5rem; max-height: calc(100vh - 1rem); overflow: auto; }
.seitenbild { position: relative; }
.seitenbild img { width: 100%; display: block; background: #fff; }
.markierung { position: absolute; border: 3px solid #e11d48; background: rgba(225,29,72,.12); border-radius: 3px; pointer-events: none; }
.seitenwahl { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .5rem; }
.seitenwahl a { background: #fff; padding: .2rem .55rem; border-radius: 5px; text-decoration: none; font-size: .85rem; }
.seitenwahl a.aktiv { background: var(--primaer); color: #fff; }
.feldtabelle td { vertical-align: middle; }
.feldtabelle tr.unsicher td { background: var(--gelb-hell); }
.feldtabelle tr.fehlt td { background: var(--rot-hell); }
.feldtabelle tr.information td { background: #f6f7f9; color: var(--gedimmt); }
.feldtabelle tr[data-bereich] { cursor: pointer; }
.feldtabelle form.feldformular { display: flex; gap: .3rem; align-items: center; margin: 0; }
.feldtabelle form.feldformular input[name=wert] { min-width: 9rem; }
.feldtabelle details { font-size: .8rem; color: var(--gedimmt); }
.konfidenz { font-size: .78rem; color: var(--gedimmt); white-space: nowrap; }
.pdfrahmen { width: 100%; height: 80vh; border: 1px solid var(--linie); border-radius: var(--radius); background: #fff; }

.hinweis { border: 1px solid var(--linie); border-left: 5px solid var(--gedimmt); background: var(--karte); border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: .6rem; }
.hinweis.blockierend { border-left-color: var(--rot); }
.hinweis.pruefpflichtig { border-left-color: var(--gelb); }
.hinweis.erledigt, .hinweis.bestaetigt { opacity: .75; }
.hinweis form { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }
.hinweis form input[name=kommentar] { flex: 1; min-width: 14rem; }
details summary { cursor: pointer; }
pre.roh { white-space: pre-wrap; word-break: break-word; background: #f6f8fa; padding: .6rem; border-radius: 6px; font-size: .8rem; max-height: 300px; overflow: auto; }
dl.angaben { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.angaben dt { color: var(--gedimmt); }
dl.angaben dd { margin: 0; }

@media (max-width: 900px) {
  .dokumentansicht { grid-template-columns: 1fr; }
  .seitenrahmen { position: static; max-height: none; }
  .benutzer { margin-left: 0; }
}

/* Abrechnung: nächster Schritt, Zustände, Posteingang, Seitenzuordnung */
.schritt { border-left: 6px solid var(--primaer); background: var(--blau-hell); padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 1.05rem; }
.schritt.warten { border-left-color: var(--gelb); background: var(--gelb-hell); }
.schritt.bereit, .schritt.erledigt { border-left-color: var(--gruen); background: var(--gruen-hell); }
.schritt.problem { border-left-color: var(--rot); background: var(--rot-hell); }
.marke-status.unterlagen_eingegangen, .marke-status.pruefung_erforderlich { background: var(--blau-hell); color: var(--primaer-dunkel); }
.marke-status.gegenzeichnung_ausstehend { background: var(--gelb-hell); color: #7a5a00; }
.marke-status.abrechnungsbereit, .marke-status.rechnung_erstellt, .marke-status.archiviert, .marke-status.versendet { background: var(--gruen-hell); color: var(--gruen); }
.marke-status.aufgeteilt, .marke-status.simuliert { background: #f0e9ff; color: #5925dc; }
.marke-status.manuell { background: #eef1f5; color: var(--gedimmt); }
.unbestaetigt { border: 2px solid var(--rot); background: var(--rot-hell); border-radius: var(--radius); padding: .6rem .8rem; margin: .5rem 0; }
.eingang td { vertical-align: top; }
.eingang select, .eingang input { max-width: 13rem; }
.quelle { display: block; font-size: .75rem; color: var(--gedimmt); }
.seitenraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.seitenraster figure { margin: 0; border: 1px solid var(--linie); border-radius: var(--radius); padding: .4rem; background: var(--karte); }
.seitenraster img { width: 100%; height: auto; display: block; }
.seitenraster select { width: 100%; margin-top: .3rem; }
.auftragswerte td.zahl { font-variant-numeric: tabular-nums; }

/* Plattform: Modulkacheln */
.kacheln.module .kachel.modul { display: flex; flex-direction: column; gap: .2rem; }
.kacheln.module .kachel.modul.geplant { opacity: .55; border-style: dashed; cursor: default; }
/* Schmale Fenster: breite Tabellen scrollen innerhalb der Karte statt die ganze Seite zu verbreitern */
@media (max-width: 900px) { .karte table.tabelle { display: block; overflow-x: auto; max-width: 100%; } }

/* Bestätigungsdialog (statt window.confirm) */
dialog.bestaetigung { border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.25rem; max-width: 34rem; width: calc(100% - 2rem);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); color: var(--text); background: var(--karte); }
dialog.bestaetigung::backdrop { background: rgba(29,39,51,.45); }
dialog.bestaetigung p { margin: 0 0 .4rem; font-size: 1rem; }
/* Posteingang: Datumsfelder mit Beschriftung, Summe der Auswahl */
.eingang label.klein { display: inline; font-weight: 400; margin: 0; }
[data-summe-auswahl] { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Sprung aus einem Hinweis („Zur Pflegeseite“ → Zeile des Preises): angesprungene Tabellenzeile hervorheben */
.tabelle tbody tr { scroll-margin-top: 3rem; }
.tabelle tbody tr:target td { background: var(--gelb-hell); }
.tabelle tbody tr:target td:first-child { box-shadow: inset 4px 0 0 var(--gelb); }
