/* Baukosten – ruhige, gut lesbare Oberfläche, dazu Druckansichten für Bericht und Zahlungsliste. */

:root {
  --hintergrund: #f3f5f8;
  --flaeche: #ffffff;
  --text: #1b2330;
  --leise: #586474;
  --linie: #dbe1e8;
  --linie-stark: #a5b0be;
  --blau: #1d5ea8;
  --blau-dunkel: #15467f;
  --blau-hell: #e7f0fb;
  --blau-zart: #f5f9fe;
  --gruen: #1a7a43;
  --rot: #b42318;
  --gelb-hell: #fff7da;
  --schatten: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 9%);
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blau); }
a:hover { color: var(--blau-dunkel); }
:focus-visible { outline: 3px solid #f2b100; outline-offset: 2px; }
h1 { margin: 0; font-size: 1.6rem; line-height: 1.2; }
h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
h3 { margin: 1.5rem 0 .6rem; font-size: 1.05rem; }
.abschnitt { margin-top: 2rem; }

/* Kopfleiste und Reiter */
.kopfleiste { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding: .65rem 1.25rem; background: var(--blau-dunkel); color: #fff; }
.kopfleiste a { color: #fff; text-decoration: none; }
.marke { font-size: 1.15rem; font-weight: 700; }
.objekt-name { max-width: 32rem; padding: .2rem .7rem; overflow: hidden; border-radius: 999px; background: rgb(255 255 255 / 15%); text-overflow: ellipsis; white-space: nowrap; }
.objekt-name:hover { background: rgb(255 255 255 / 25%); }
.hauptmenue { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; }
.hauptmenue form { margin: 0; }
.hauptmenue .link { color: #fff; text-decoration: none; }
.hauptmenue a:hover, .hauptmenue .link:hover { text-decoration: underline; }
.reiter { display: flex; gap: .25rem; padding: 0 1.25rem; overflow-x: auto; border-bottom: 1px solid var(--linie); background: var(--flaeche); }
.reiter a { padding: .85rem 1rem .75rem; border-bottom: 3px solid transparent; color: var(--leise); font-weight: 600; text-decoration: none; white-space: nowrap; }
.reiter a:hover { color: var(--text); }
.reiter a[aria-current="page"] { border-bottom-color: var(--blau); color: var(--blau-dunkel); }

main { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* Seitenkopf */
.seitenkopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.vorspann { margin: 0 0 .15rem; color: var(--leise); font-size: .92rem; }
.vorspann a { text-decoration: none; }
.aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.aktionen form { display: flex; gap: .5rem; margin: 0; }
.bkp { font-variant-numeric: tabular-nums; white-space: nowrap; }
h1 .bkp { margin-right: .3rem; color: var(--blau); }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1rem; border: 1px solid var(--linie-stark); border-radius: 8px;
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
.knopf:hover { background: var(--blau-zart); color: var(--text); }
.knopf.haupt { border-color: var(--blau); background: var(--blau); color: #fff; }
.knopf.haupt:hover { border-color: var(--blau-dunkel); background: var(--blau-dunkel); }
.knopf.gefahr { border-color: #e6b8b2; color: var(--rot); }
.knopf.gefahr:hover { background: #fdf0ee; }
.knopf.breit { width: 100%; }
.knoepfe { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }
.link { padding: 0; border: 0; background: none; color: var(--blau); font: inherit; text-decoration: underline; cursor: pointer; }

/* Meldungen */
.meldung { margin: 0 0 1rem; padding: .7rem 1rem; border: 1px solid; border-radius: 8px; }
.meldung.ok { border-color: #b6e1c5; background: #ecf8f0; color: #14532d; }
.meldung.info { border-color: #c3d6ef; background: var(--blau-hell); color: #173a64; }
.meldung.fehler { border-color: #f0c1bb; background: #fdeeec; color: #7a1a12; }
.leer { padding: 2rem; border: 1px dashed var(--linie-stark); border-radius: var(--radius); background: var(--flaeche); color: var(--leise); text-align: center; }

/* Formulare */
.formular { max-width: 54rem; padding: 1.25rem 1.4rem; border-radius: var(--radius); background: var(--flaeche); box-shadow: var(--schatten); }
.feld { display: flex; flex: 1 1 10rem; flex-direction: column; gap: .25rem; min-width: 0; margin-bottom: .85rem; }
.feld label, .label { font-size: .9rem; font-weight: 600; }
.feld .wert, .feld output { padding: .5rem 0; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--linie-stark); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit;
}
input.zahl { text-align: right; font-variant-numeric: tabular-nums; }
input.kurz { max-width: 9rem; }
.feld:has(input.kurz) { flex: 0 0 9rem; }
textarea { resize: vertical; }
.hilfe { color: var(--leise); font-size: .85rem; }
.reihe { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.reihe.drei > .feld { flex-basis: 5.5rem; }
.reihe.schmal > .feld { flex: 0 1 12rem; }
fieldset { margin: 0 0 .85rem; padding: 0; border: 0; }
legend { margin-bottom: .4rem; font-size: .9rem; font-weight: 600; }
.typwahl label { display: inline-flex; align-items: center; gap: .4rem; margin: 0 .5rem .4rem 0; padding: .4rem .8rem; border: 1px solid var(--linie-stark); border-radius: 999px; font-weight: 600; cursor: pointer; }
.typwahl label:has(input:checked) { border-color: var(--blau); background: var(--blau-hell); color: var(--blau-dunkel); }
.hinweis { margin: 0 0 .75rem; padding: .5rem .75rem; border: 1px solid #f0dc9a; border-radius: 8px; background: var(--gelb-hell); font-size: .92rem; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.suche input[type=search] { width: 14rem; }
.springen select { width: auto; max-width: 20rem; }
.gefahrenzone { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; max-width: 54rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
.gefahrenzone p { flex-basis: 100%; margin: 0; }

/* Tabellen */
.tabelle-rahmen { overflow-x: auto; border-radius: var(--radius); background: var(--flaeche); box-shadow: var(--schatten); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .75rem; text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; border-bottom: 1px solid var(--linie-stark); background: var(--blau-zart); color: var(--leise); font-size: .85rem; font-weight: 600; }
td { border-bottom: 1px solid var(--linie); }
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rechts { text-align: right; }
.klein { color: var(--leise); font-size: .85rem; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--blau-zart); }
.liste td a { font-weight: 600; text-decoration: none; }
.vonhand { color: #8a6100; cursor: help; }

/* Baukosten und Übersicht */
.kv tr.kopf1 td { border-top: 2px solid var(--linie-stark); background: var(--blau-hell); font-size: 1.05rem; font-weight: 700; }
.kv tr.kopf2 td { background: #fafbfd; font-weight: 700; }
.kv tr a { color: var(--text); text-decoration: none; }
.kv tr.position td:nth-child(2) a:hover { color: var(--blau); text-decoration: underline; }
.kv tr.beleg td { padding-top: .2rem; padding-bottom: .2rem; border-bottom-style: dotted; color: var(--leise); font-size: .88rem; }
.kv tr.subtotal td { border-top: 1px solid var(--linie-stark); background: #fbfcfe; font-weight: 600; }
.kv tr.total td { border-top: 2px solid var(--linie-stark); background: var(--blau-zart); font-weight: 700; }
.kv tr.gesamt td { border-top: 3px double var(--text); background: var(--blau-hell); font-size: 1.05rem; font-weight: 800; }
.mehr { color: var(--rot); font-weight: 600; }
.weniger { color: var(--gruen); font-weight: 600; }

/* Unternehmerblatt */
.karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.karten.breit { grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.karte { padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--flaeche); box-shadow: var(--schatten); }
.werte { display: grid; grid-template-columns: 1fr auto; gap: .3rem .75rem; margin: 0 0 .9rem; }
.werte dt { color: var(--leise); }
.werte dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.werte .summe { padding-top: .3rem; border-top: 1px solid var(--linie); color: var(--text); font-weight: 700; }
.adressblock { margin: .25rem 0 .5rem; font-style: normal; line-height: 1.5; }
.kontakt { display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; margin: 0 0 .5rem; font-size: .92rem; }
.kontakt dt { color: var(--leise); }
.kontakt dd { margin: 0; overflow-wrap: anywhere; }
.blatt > .feld { max-width: 54rem; }
.belege { margin-top: 2rem; }
.beleg-formular { padding: 1.1rem 1.25rem; border-radius: var(--radius); background: var(--flaeche); box-shadow: var(--schatten); }

/* Zahlungslisten */
.auswahl th:first-child, .auswahl td:first-child { width: 2.5rem; }
.auswahl input[type=checkbox] { width: 1.15rem; height: 1.15rem; }
.auswahl-summe { margin: .6rem 0 0; font-weight: 600; }
.zweispaltig { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }

/* Anmeldung und Fehler */
.anmeldung { max-width: 26rem; margin: 5rem auto; padding: 2rem; border-radius: var(--radius); background: var(--flaeche); box-shadow: var(--schatten); }
.anmeldung h1 { margin-bottom: .25rem; color: var(--blau-dunkel); }
.fehlerseite { max-width: 40rem; }
.fehler-details { padding: 1rem; overflow-x: auto; background: #fff; font-size: .8rem; }

/* Dokumente: Bericht und Zahlungsliste */
.dokument { padding: 1.5rem; border-radius: 4px; background: #fff; box-shadow: var(--schatten); }
.berichtsoptionen { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-bottom: 1rem; }
.berichtsoptionen label { display: inline-flex; align-items: center; gap: .35rem; }
.bericht { overflow-x: auto; }
.bericht-tabelle { margin-bottom: 1.5rem; font-size: .8rem; }
.bericht-tabelle th, .bericht-tabelle td { padding: .2rem .4rem; border: 1px solid #c9cfd7; }
.bericht-tabelle thead th { position: static; background: #fff; color: var(--text); font-size: .8rem; }
.bericht-tabelle .briefkopf th { padding: .35rem .5rem; border: 1px solid #9aa4b1; }
.briefkopf-raster { display: grid; grid-template-columns: 1.3fr 2fr auto; gap: 1rem; font-weight: 400; }
.bericht-tabelle .titel th { padding: .7rem .2rem .4rem; border: 0; font-size: 1.05rem; }
.bericht-tabelle .spalten th { border-bottom: 0; }
.bericht-tabelle .spalten.unter th { border-top: 0; border-bottom: 1px solid #9aa4b1; font-weight: 400; }
.bericht-tabelle tr.kopf1 td { font-weight: 700; }
.bericht-tabelle tr.kopf2 td { font-weight: 600; }
.bericht-tabelle tr.beleg td { border-top-style: dotted; border-bottom-style: dotted; }
.bericht-tabelle tr.beleg .betrag { font-weight: 700; }
.bericht-tabelle tr.subtotal td, .bericht-tabelle tr.total td { font-weight: 600; }
.bericht-tabelle tr.total td { border-top: 2px solid #7d8794; }
.bericht-tabelle tr.gesamt td { border-top: 3px double #000; font-weight: 800; }
.zlg { color: var(--blau); font-weight: 700; }

.zahlungsliste-dokument { max-width: 60rem; }
.dok-kopf { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.dok-titel { margin: 0 0 .75rem; font-size: 1.35rem; }
.dok-angaben { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0 0 1.25rem; }
.dok-angaben dt { color: var(--leise); }
.dok-angaben dd { margin: 0; }
.dok-tabelle thead th { position: static; }
.dok-summen { width: auto; min-width: 22rem; margin: 1rem 0 0 auto; }
.dok-summen th { font-weight: 400; }
.dok-summen tr.summe th, .dok-summen tr.summe td { border-top: 2px solid var(--text); font-weight: 700; }
.dok-bemerkung { margin-top: 1.5rem; }

/* Druck */
@page {
  size: A4;
  margin: 14mm 12mm 16mm;
  @bottom-right { content: "Seite " counter(page) " von " counter(pages); color: #555; font: 8pt system-ui, sans-serif; }
}
@page quer { size: A4 landscape; margin: 10mm 10mm 14mm; }

@media print {
  html { font-size: 10pt; }
  body { background: #fff; }
  .kopfleiste, .reiter, .nur-bildschirm, .meldung, .knoepfe, .gefahrenzone, .beleg-formular { display: none !important; }
  main { max-width: none; padding: 0; }
  .dokument, .tabelle-rahmen, .karte { padding: 0; overflow: visible; border-radius: 0; box-shadow: none; }
  thead { display: table-header-group; }
  thead th { position: static; }
  tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .bericht { page: quer; overflow: visible; }
  .bericht-tabelle { font-size: 7.5pt; }
  .bericht-tabelle.zusammenfassung { break-after: page; }
  .zlg { color: #0b3d91; }
}
