:root {
  --text: #1d2430; --leise: #5f6b7a; --linie: #dfe3e8; --flaeche: #f5f7f9; --weiss: #fff;
  --akzent: #1f5fae; --akzent-hell: #e8f0fa;
  --rot: #c8382f; --gelb: #d99a00; --gruen: #2e8b57; --grau: #a0a8b3;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--flaeche);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--akzent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
main { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.leise, small { color: var(--leise); }

/* Kopf */
nav.kopf { display: flex; align-items: center; gap: 1rem; background: var(--weiss); border-bottom: 1px solid var(--linie); padding: .6rem 1.5rem; flex-wrap: wrap; }
nav.kopf .marke { font-weight: 700; }
nav.kopf .marke span { font-weight: 400; color: var(--leise); }
nav.kopf .marke em { font-style: normal; font-size: .75rem; background: #fff3cd; color: #7a5a00; border-radius: 4px; padding: .1rem .4rem; margin-left: .5rem; }
nav.kopf ul { list-style: none; display: flex; gap: .1rem; margin: 0; padding: 0; flex: 1; flex-wrap: wrap; }
nav.kopf a { text-decoration: none; color: var(--text); padding: .4rem .55rem; border-radius: 6px; display: block; }
nav.kopf a:hover { background: var(--flaeche); }
nav.kopf a.aktiv { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
nav.kopf form { margin: 0; }

/* Tabellen */
table { border-collapse: collapse; width: 100%; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--linie); vertical-align: middle; font-size: .92rem; }
th { background: #fafbfc; font-weight: 600; color: var(--leise); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
td.z, th.z { text-align: right; font-variant-numeric: tabular-nums; }
td.minus { color: var(--rot); font-weight: 600; }
td.plus { color: var(--gruen); }
.tabelle-rahmen { overflow-x: auto; }

/* Karten */
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; }
.karte h3 { margin-top: 0; }
.kennzahl { font-size: 1.8rem; font-weight: 700; }

/* Formulare */
form.zeilen { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1rem; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; }
form.zeilen .breit { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--leise); }
label.haken { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #c9d0d8; border-radius: 6px; background: var(--weiss); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent-hell); border-color: var(--akzent); }
input.klein { width: 5.5rem; }
button, .knopf { font: inherit; background: var(--akzent); color: #fff; border: none; border-radius: 6px; padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
button.leise, .knopf.leise { background: transparent; color: var(--akzent); border: 1px solid #c9d0d8; }
button.gefahr { background: var(--rot); }
.aktionen { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .75rem 0; }
.inline { display: inline; margin: 0; }

.hinweis { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; }
.hinweis.ok { background: #e6f4ec; color: #1d5e3a; }
.hinweis.fehler { background: #fbe9e7; color: #8a1f16; }
.hinweis.info { background: var(--akzent-hell); color: #18467f; }

.ampel { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: middle; }
.ampel.rot { background: var(--rot); } .ampel.gelb { background: var(--gelb); } .ampel.gruen { background: var(--gruen); } .ampel.grau { background: var(--grau); }
.marke-status { font-size: .78rem; border-radius: 999px; padding: .1rem .55rem; background: var(--flaeche); border: 1px solid var(--linie); white-space: nowrap; }
.marke-status.überfällig, .marke-status.fehler { background: #fbe9e7; color: #8a1f16; border-color: #f3c3bd; }
.marke-status.offen, .marke-status.wartet { background: #fff6dc; color: #7a5a00; border-color: #f1dc9c; }
.marke-status.abgeschlossen, .marke-status.gesendet { background: #e6f4ec; color: #1d5e3a; border-color: #b9dfc8; }
.marke-status.in.Arbeit { background: var(--akzent-hell); }

/* Kalender */
.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--linie); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.kalender .kt { background: #fafbfc; font-size: .78rem; color: var(--leise); padding: .35rem .5rem; font-weight: 600; }
.kalender .tag { background: var(--weiss); min-height: 92px; padding: .35rem .45rem; font-size: .8rem; }
.kalender .tag.leer { background: #fafbfc; }
.kalender .tag.heute { box-shadow: inset 0 0 0 2px var(--akzent); }
.kalender .nr { color: var(--leise); font-weight: 600; }
.kalender .eintrag { display: block; margin-top: .25rem; padding: .15rem .35rem; border-radius: 4px; background: var(--akzent-hell); color: #18467f; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kalender .eintrag.ueberfaellig { background: #fbe9e7; color: #8a1f16; }
.kalender .eintrag.fertig { background: #e6f4ec; color: #1d5e3a; }

/* Etiketten */
.etiketten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.etikett { border: 1px dashed #bbb; padding: 3mm; display: flex; gap: 3mm; align-items: center; break-inside: avoid; background: #fff; }
.etikett svg { width: 24mm; height: 24mm; flex: none; }
.etikett b { display: block; font-size: 11pt; }
.etikett span { font-size: 9pt; color: #444; }
.qr-gross svg { width: 240px; height: 240px; background: #fff; }
@media print {
  nav.kopf, .nicht-drucken { display: none !important; }
  main { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* Anmeldung */
.anmeldung { max-width: 360px; margin: 10vh auto; }
.anmeldung form { display: grid; gap: .8rem; background: var(--weiss); padding: 1.5rem; border: 1px solid var(--linie); border-radius: var(--radius); }

/* ------------------------------------------------------------ Erfassung */
body.erfassung { background: var(--flaeche); font-size: 17px; -webkit-tap-highlight-color: transparent; }
.e-kopf { background: var(--akzent); color: #fff; padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 5; }
.e-kopf b { flex: 1; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-kopf button { background: rgba(255,255,255,.15); padding: .45rem .7rem; }
.e-kopf small { color: rgba(255,255,255,.85); white-space: nowrap; }
.e-inhalt { padding: 1rem; max-width: 720px; margin: 0 auto; }
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.kachel { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 1.2rem 1rem; text-align: left; color: var(--text); font-size: 1.1rem; font-weight: 600; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; }
.kachel small { font-weight: 400; }
.kachel.hervor { border-color: var(--gelb); background: #fffaf0; }
.scanfeld { display: flex; gap: .5rem; margin-bottom: .8rem; }
.scanfeld input { flex: 1; font-size: 1.1rem; padding: .7rem; }
.scanfeld button { padding: .7rem .9rem; }
.anzeige { background: var(--weiss); border: 2px solid var(--linie); border-radius: 12px; padding: .9rem 1rem; margin-bottom: .8rem; min-height: 84px; transition: border-color .15s, background .15s; }
.anzeige.ok { border-color: var(--gruen); background: #f1faf5; }
.anzeige.fehler { border-color: var(--rot); background: #fdf1ef; }
.anzeige .gross { font-size: 2.2rem; font-weight: 800; float: right; line-height: 1; }
.anzeige .name { font-weight: 700; font-size: 1.1rem; }
.liste { list-style: none; margin: 0; padding: 0; background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; }
.liste li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .75rem; padding: .7rem .8rem; border-bottom: 1px solid var(--linie); align-items: center; }
.liste li:last-child { border-bottom: none; }
.liste li.zuletzt { background: #f1faf5; }
.liste li.ungezaehlt { background: #fffaf0; }
.liste .zahlen { display: flex; gap: .35rem; align-items: center; }
.liste .zahlen button { width: 2.6rem; height: 2.6rem; padding: 0; font-size: 1.3rem; background: var(--flaeche); color: var(--text); border: 1px solid var(--linie); }
.liste .zahlen input { width: 4.2rem; text-align: center; font-size: 1.15rem; font-weight: 700; padding: .45rem .2rem; }
.liste .info { grid-column: 1 / -1; font-size: .85rem; color: var(--leise); display: flex; gap: 1rem; flex-wrap: wrap; }
.liste .info .minus { color: var(--rot); font-weight: 700; }
.liste .info .plus { color: var(--gruen); font-weight: 700; }
.fussleiste { position: sticky; bottom: 0; background: var(--flaeche); padding: .7rem 0; display: grid; gap: .5rem; box-shadow: 0 -8px 12px -10px rgba(0,0,0,.25); }
.fussleiste .reihe { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; align-items: end; }
.fussleiste .reihe input { width: 100%; padding: .8rem .5rem; font-size: 1rem; }
.fussleiste .reihe label { font-size: .75rem; }
.fussleiste button { padding: .95rem; font-size: 1.1rem; font-weight: 700; }
.gruende { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .8rem; }
.gruende button { background: var(--weiss); color: var(--text); border: 2px solid var(--linie); padding: .8rem .3rem; }
.gruende button.gewaehlt { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent); font-weight: 700; }
.feld { display: grid; gap: .3rem; margin-bottom: .8rem; }
.feld input, .feld textarea { font-size: 1rem; padding: .65rem; }
video.kamera { width: 100%; border-radius: 12px; background: #000; margin-bottom: .8rem; max-height: 40vh; object-fit: cover; }
.foto-vorschau { max-width: 140px; border-radius: 8px; display: block; margin-top: .4rem; }
.leer-text { text-align: center; color: var(--leise); padding: 1.5rem .5rem; }
.filter { display: flex; gap: .5rem; margin-bottom: .8rem; }
.filter input, .filter select { flex: 1; padding: .6rem; font-size: 1rem; }

/* Inventur-Uebersicht: Artikel x Bereiche */
.matrix-rahmen { overflow-x: auto; background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; margin-bottom: .6rem; }
table.matrix { border: none; border-radius: 0; font-size: .9rem; }
table.matrix th, table.matrix td { padding: .4rem .5rem; white-space: nowrap; }
table.matrix td:first-child { white-space: normal; min-width: 11rem; }
table.matrix th { text-transform: none; letter-spacing: 0; }
table.matrix .summe { background: var(--akzent-hell); font-weight: 700; color: var(--text); }
table.matrix tr.offen td:first-child { box-shadow: inset 3px 0 0 var(--gelb); }
button.spalte { background: var(--flaeche); color: var(--text); border: 1px solid var(--linie); padding: .3rem .5rem; font-size: .82rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; min-width: 4.2rem; }
button.spalte small { font-weight: 400; color: var(--leise); }
button.spalte.fertig { background: #e6f4ec; border-color: #b9dfc8; }
button.spalte.in_arbeit { background: #fff6dc; border-color: #f1dc9c; }
.kachel.bereich.fertig { background: #f1faf5; border-color: #b9dfc8; }
.kachel.bereich.in_arbeit { background: #fffaf0; border-color: #f1dc9c; }
button:disabled { opacity: .55; cursor: not-allowed; }
.verwaltung table.matrix td.leer-zelle { color: var(--grau); }

table.matrix th:first-child, table.matrix td:first-child { position: sticky; left: 0; background: var(--weiss); z-index: 1; box-shadow: 1px 0 0 var(--linie); }
table.matrix th:first-child { background: #fafbfc; }
.erfassung table.matrix td:first-child { min-width: 9rem; max-width: 12rem; }
.beleg h2 { font-size: 1.25rem; }
@media print { .beleg { border: none; padding: 0; } }

.lieferanschrift { margin: 1.2rem 0 .4rem; padding: .7rem 1rem; border: 1px solid var(--linie); border-radius: 6px; max-width: 22rem; }
@media print { .seite { break-after: page; } .seite:last-child { break-after: auto; } }
@media print { h2.seitenumbruch { break-before: page; } .karten { grid-template-columns: repeat(4, 1fr); } table { font-size: 9pt; } th, td { padding: .25rem .4rem; } }
@media print { :root, body, main { background: #fff !important; } .karte { box-shadow: none; } }
@media print { h2, h3 { break-after: avoid; } tr { break-inside: avoid; } }

/* ------------------------------------------------------------ Dashboard */
:root { --gut: #0aac23; --warn: #fbb315; --krit: #dc3c3d; --serie1: #257de0; }
.dash-kennzahlen { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.dk { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: .9rem 1rem; }
.dk-titel { font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; color: var(--leise); font-weight: 600; }
.dk-wert { white-space: nowrap; font-size: 1.7rem; font-weight: 750; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.dk-unter { font-size: .82rem; color: var(--leise); margin-top: .15rem; }
.dk.kritisch { box-shadow: inset 3px 0 0 var(--krit); } .dk.knapp { box-shadow: inset 3px 0 0 var(--warn); } .dk.gut { box-shadow: inset 3px 0 0 var(--gut); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.dash-haupt { display: grid; gap: 1rem; min-width: 0; }
.dash-zwei { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 1100px) { .dash, .dash-zwei { grid-template-columns: 1fr; } }
.dash-karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 1rem 1.1rem; min-width: 0; }
.dash-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--linie); padding-bottom: .55rem; margin-bottom: .8rem; }
.dash-kopf h3 { margin: 0; font-size: 1rem; }
.dash-kopf a { font-size: .85rem; text-decoration: none; white-space: nowrap; }
.dash-seite { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.dash-seite h4 { font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--leise); margin: 1rem 0 .4rem; }
.dash-seite h4:first-of-type { margin-top: 0; }
.ds-eintrag { display: block; padding: .55rem .7rem; margin-bottom: .45rem; border-radius: 6px; background: #fafbfc; border-left: 3px solid var(--serie1); text-decoration: none; color: var(--text); }
.ds-eintrag.kritisch { border-left-color: var(--krit); } .ds-eintrag.knapp { border-left-color: var(--warn); }
.ds-eintrag b { display: block; font-size: .9rem; } .ds-eintrag small { color: var(--leise); }
.ds-mehr { font-size: .85rem; }
.klein { font-size: .8rem; margin: .6rem 0 0; }
/* Rangliste */
.rang { display: grid; gap: 2px; }
.rang-zeile { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr 3.6rem 5.5rem; gap: .6rem; align-items: center; padding: .22rem .3rem; border-radius: 4px; text-decoration: none; color: var(--text); font-size: .88rem; }
a.rang-zeile:hover { background: var(--flaeche); }
.rang-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rang-spur { position: relative; height: 12px; background: #f1f3f5; border-radius: 0 4px 4px 0; }
.rang-balken { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.rang-balken.gut { background: var(--gut); } .rang-balken.knapp { background: var(--warn); } .rang-balken.kritisch { background: var(--krit); } .rang-balken.eins { background: var(--serie1); }
.rang-marke { position: absolute; top: -3px; bottom: -3px; width: 1px; background: #5f6b7a; }
.rang-wert { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rang-st { font-size: .78rem; } .rang-st.kritisch { color: #a02626; font-weight: 600; } .rang-st.knapp { color: #7a5a00; } .rang-st.gut { color: #1d5e3a; }
/* Heatmap */
table.heat { font-size: .85rem; border: none; }
table.heat td, table.heat th { padding: .3rem .5rem; white-space: nowrap; }
table.heat td.zelle { font-variant-numeric: tabular-nums; border: 2px solid var(--weiss); min-width: 4.5rem; }
table.heat td.gesamt { font-weight: 700; }
.skala { display: flex; align-items: center; gap: 2px; font-size: .78rem; color: var(--leise); margin-top: .5rem; }
.skala i { width: 22px; height: 12px; border: 1px solid var(--linie); }
.skala span { margin: 0 .4rem; }
/* Segmentbalken + Legenden */
.segment { display: flex; gap: 2px; height: 26px; }
.segment span:first-child { border-radius: 4px 0 0 4px; } .segment span:last-child { border-radius: 0 4px 4px 0; }
.segment .kritisch, .segment-legende i.kritisch { background: var(--krit); } .segment .knapp, .segment-legende i.knapp { background: var(--warn); } .segment .gut, .segment-legende i.gut { background: var(--gut); }
.segment-legende { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; margin-top: .5rem; }
.segment-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: middle; }
/* SVG-Diagramm */
svg.diagramm { width: 100%; height: auto; display: block; }
svg.diagramm .gitter { stroke: #eef0f3; stroke-width: 1; } svg.diagramm .basis { stroke: #c9d0d8; stroke-width: 1; }
svg.diagramm .achse { fill: #5f6b7a; font-size: 11px; }
@media print { .dash { grid-template-columns: 1fr; } .dash-seite { position: static; max-height: none; } .dash-karte { break-inside: avoid; } }
.rang.breit .rang-zeile { grid-template-columns: minmax(7rem, 1.3fr) 1fr 5.8rem 6.8rem; }
.konto { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
.konto span { flex: 1; }
.feld select { font-size: 1rem; padding: .65rem; }
.nowrap { white-space: nowrap; }
.artikelliste tbody tr:hover td { background: #f7f9fb; }
.artikelliste tr.markiert td { background: #e6f4ec; }
.artikelliste a.bearbeiten { padding: .25rem .55rem; font-size: .85rem; white-space: nowrap; }

/* Blatt von unten (Artikelsuche, Abweichung) */
.blatt-huelle { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.blatt { background: var(--flaeche); width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; border-radius: 14px 14px 0 0; padding: .8rem 1rem 1.2rem; box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
.blatt-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.blatt-kopf b { font-size: 1.1rem; }
.abw-knopf { background: transparent; color: #8a4b00; border: 1px solid #f1dc9c; padding: .3rem .6rem; font-size: .85rem; margin-left: auto; }
.abw-knopf.gemeldet { color: #1d5e3a; border-color: #b9dfc8; background: #e6f4ec; }

/* Hausseite */
.reiter { display: flex; gap: .3rem; border-bottom: 1px solid var(--linie); margin: .5rem 0 1rem; }
.reiter a { padding: .55rem .9rem; text-decoration: none; color: var(--leise); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.reiter a.aktiv { color: var(--akzent); border-bottom-color: var(--akzent); }
.gruppe-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; }
.gruppe-kachel { display: grid; gap: .45rem; background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 1rem; text-decoration: none; color: var(--text); }
.gruppe-kachel:hover { border-color: var(--akzent); box-shadow: 0 2px 10px rgba(31, 95, 174, .08); }
.gk-kopf { display: flex; justify-content: space-between; align-items: baseline; } .gk-kopf b { font-size: 1.1rem; }
.gk-wert { font-size: 1.6rem; font-weight: 750; } .gk-wert small { font-size: .85rem; font-weight: 400; }
.gk-unter { display: flex; gap: .7rem; flex-wrap: wrap; font-size: .85rem; }
.gk-weiter { font-size: .85rem; color: var(--akzent); }
.gruppe-kachel .rang-spur { display: block; }
.fuss-speichern { position: sticky; bottom: 0; display: flex; align-items: center; gap: 1rem; justify-content: flex-end; background: var(--flaeche); padding: .8rem 0; }
.fuss-speichern span { flex: 1; font-size: .85rem; }
details.mehr { position: relative; } details.mehr summary { list-style: none; cursor: pointer; } details.mehr summary::-webkit-details-marker { display: none; }
.mehr-liste { position: absolute; right: 0; top: 2.6rem; background: var(--weiss); border: 1px solid var(--linie); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); display: grid; min-width: 14rem; z-index: 5; }
.mehr-liste a { padding: .6rem .9rem; text-decoration: none; color: var(--text); } .mehr-liste a:hover { background: var(--flaeche); }
details.anlegen > summary { list-style: none; display: inline-block; margin-top: 1rem; cursor: pointer; } details.anlegen > summary::-webkit-details-marker { display: none; }

.info.zustand { gap: .35rem; }
.z-knopf { background: var(--weiss); color: var(--leise); border: 1px solid var(--linie); padding: .25rem .6rem; font-size: .82rem; }
.z-knopf.aktiv.gut { background: #e6f4ec; color: #1d5e3a; border-color: #b9dfc8; font-weight: 700; }
.z-knopf.aktiv.maengel { background: #fff6dc; color: #7a5a00; border-color: #f1dc9c; font-weight: 700; }
.z-knopf.aktiv.defekt { background: #fbe9e7; color: #8a1f16; border-color: #f3c3bd; font-weight: 700; }
.inv-abschnitt { margin-top: 1rem; } .inv-abschnitt h3 { margin-top: 0; } details.inv-abschnitt summary { cursor: pointer; }

/* Budgetplanung & Vermieter */
.budget-diagramm { padding: 1rem 1.2rem; margin: 1rem 0; }
.budget-diagramm figcaption { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; }
.budget-diagramm .legende { font-size: .85rem; color: var(--leise); display: flex; align-items: center; gap: .35rem; }
.budget-diagramm .legende i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-left: .6rem; }
.budget-diagramm svg { width: 100%; height: auto; max-height: 260px; }
.budget-diagramm .dz-wert { font-size: 12px; font-weight: 650; fill: currentColor; }
.budget-diagramm .dz-achse { font-size: 12px; fill: var(--leise); }
.budget-diagramm .dz-linie { stroke: var(--linie); stroke-width: 1; }
.budget-matrix td.z, .budget-matrix th.z { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.budget-matrix tfoot th { border-top: 2px solid var(--linie); }
.zahler { font-size: .82rem; padding: .1rem .45rem; border-radius: 999px; border: 1px solid var(--linie); white-space: nowrap; }
.zahler.vermieter { border-color: #f47230; }
.zahler.traeger { border-color: #257de0; }
.budget-felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .6rem 1rem; }
.budget-info { margin: 0 0 .3rem; }
.nutzung input.klein { width: 5rem; }
.vermieter-kopf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; line-height: 1.45; }
table.protokoll td.befund, table.protokoll th.befund { width: 30%; }
table.protokoll td.haken-spalte, table.protokoll th.haken-spalte { width: 3rem; text-align: center; }
.unterschriften { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem 3rem; margin-top: 3rem; font-size: .85rem; color: var(--leise); }
.unterschriften .linie { border-bottom: 1px solid #333; height: 2.2rem; margin-bottom: .3rem; }
@media print { .unterschriften { break-inside: avoid; } .budget-diagramm { break-inside: avoid; } }
details.positionen > summary { cursor: pointer; margin: 1.4rem 0 .6rem; } details.positionen > summary::marker { font-size: 1.2rem; }
@media print { details.positionen:not([open]) { display: none; } }
@media print { .tabelle-rahmen { overflow: visible !important; } .beleg table { width: 100%; } }

/* Umgebung, Version, Backoffice */
.umgebung-band { background: #fff3cd; color: #6b4f00; text-align: center; font-size: .82rem; padding: .25rem 1rem; border-bottom: 1px solid #f0d98a; }
.umgebung-band.lokal { background: #e8f1fb; color: #1f4f8a; border-color: #c4d9f2; }
nav.kopf form.abmelden { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
footer.fuss { text-align: center; font-size: .75rem; padding: 1.5rem 0 1rem; }
body.backoffice nav.kopf { background: #1d2733; border-color: #1d2733; }
body.backoffice nav.kopf a, body.backoffice nav.kopf .marke { color: #e9eef4; }
body.backoffice nav.kopf .marke span, body.backoffice nav.kopf .leise { color: #9fb0c3; }
body.backoffice nav.kopf a.aktiv { background: #2f3f52; color: #fff; }
body.backoffice nav.kopf a:hover { background: #2a3746; }
.bo-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; }
.bo-status::before { content: ''; width: .6rem; height: .6rem; border-radius: 50%; background: var(--leise); }
.bo-status.gut::before { background: #0aac23; } .bo-status.warnung::before { background: #fbb315; } .bo-status.kritisch::before { background: #dc3c3d; }
textarea.json { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; min-height: 9rem; width: 100%; }
@media print { .umgebung-band, footer.fuss { display: none; } }

/* Haus als Arbeitsplatz */
.haus-daten > summary { cursor: pointer; list-style: none; margin: 0 0 .6rem; }
.haus-daten > summary::-webkit-details-marker { display: none; }
.haus-daten .stift { opacity: .5; margin-left: .3rem; }
.haus-daten form { margin: 0 0 .8rem; }
.arbeitsplatz { display: grid; grid-template-columns: 15.5rem 1fr; gap: 1.2rem; align-items: start; margin-top: 1rem; }
.bereich-liste { position: sticky; top: .8rem; background: var(--karte, #fff); border: 1px solid var(--linie); border-radius: 10px; padding: .5rem; max-height: calc(100vh - 2rem); overflow: auto; }
.bl-gruppe { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); padding: .6rem .5rem .25rem; display: flex; justify-content: space-between; }
.bl-eintrag { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .38rem .55rem; border-radius: 7px; text-decoration: none; color: inherit; }
.bl-eintrag small { color: var(--leise); white-space: nowrap; font-size: .78rem; }
.bl-eintrag:hover { background: #eef3f9; }
.bl-eintrag.aktiv { background: #e3edf9; font-weight: 600; box-shadow: inset 3px 0 0 #257de0; }
.bl-neu { display: grid; grid-template-columns: 1fr 4.2rem; gap: .35rem; padding: .7rem .3rem .3rem; border-top: 1px solid var(--linie); margin-top: .5rem; align-items: end; }
.bl-neu label { font-size: .75rem; color: var(--leise); display: flex; flex-direction: column; gap: .15rem; }
.bl-neu input { width: 100%; min-width: 0; }
.bl-neu button { grid-column: 1 / -1; }
.bl-mehr { padding: .2rem .3rem; font-size: .85rem; }
.bl-mehr summary { cursor: pointer; color: var(--leise); }
.zeilen-eng { display: flex; flex-wrap: wrap; gap: .35rem; align-items: end; padding: .5rem 0; border-bottom: 1px dashed var(--linie); }
.zeilen-eng input:not([type=checkbox]), .zeilen-eng select { width: 100%; }
.zeilen-eng label { font-size: .8rem; }
.zeilen-eng input.klein { width: 4rem; }
.bereich-detail { min-width: 0; }
.bd-kopf { display: flex; align-items: center; gap: .6rem; }
.bd-kopf h2 { margin: 0; flex: 1; }
.bd-kopf .knopf { font-size: 1.3rem; line-height: 1; padding: .3rem .75rem; }
.bd-kopf .knopf.aus { opacity: .3; pointer-events: none; }
.bd-stamm { display: grid; grid-template-columns: 2fr 1.3fr .8fr .8fr; gap: .5rem .8rem; align-items: end; background: var(--karte, #fff); border: 1px solid var(--linie); border-radius: 10px; padding: .8rem 1rem; margin: .8rem 0 1.2rem; }
.bd-stamm .breit { grid-column: 1 / -1; }
.bd-stamm .aktionen { margin: 0; }
.haken-reihe { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: .4rem; }
.bd-titel { margin: 1.4rem 0 .5rem; }
.bd-titel a { color: inherit; }
.bd-soll { margin-top: 1.4rem; background: var(--karte, #fff); border: 1px solid var(--linie); border-radius: 10px; padding: .7rem 1rem; }
.bd-soll summary { cursor: pointer; }
button.gefahr-text { color: #b42318; }
.stueck-liste { border: 1px solid var(--linie); border-radius: 10px; background: var(--karte, #fff); overflow: hidden; }
details.stueck { border-top: 1px solid var(--linie); }
details.stueck:first-child { border-top: none; }
details.stueck > summary { display: grid; grid-template-columns: 6.5rem 1fr auto 9rem; gap: .8rem; align-items: center; padding: .55rem .9rem; cursor: pointer; list-style: none; }
details.stueck > summary::-webkit-details-marker { display: none; }
details.stueck > summary:hover { background: #f5f8fc; }
details.stueck[open] > summary { background: #eef3f9; }
.st-nr { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; color: var(--leise); }
.st-name { display: flex; flex-direction: column; }
.st-name small { font-size: .78rem; }
.st-pruef { font-size: .8rem; text-align: right; }
.stueck-inhalt { padding: .6rem 1rem 1rem; border-top: 1px solid var(--linie); background: #fbfcfe; }
.stueck-inhalt .zeilen { border: none; padding: 0; background: transparent; }
.stueck-inhalt .inv-abschnitt { margin-top: .8rem; }
details.stueck-neu { margin: .8rem 0; }
details.stueck-neu > summary { display: inline-block; list-style: none; cursor: pointer; }
details.stueck-neu > summary::-webkit-details-marker { display: none; }
details.stueck-neu[open] > summary { margin-bottom: .6rem; }
.chip { display: inline-flex; gap: .3rem; align-items: baseline; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--linie); text-decoration: none; color: inherit; font-size: .88rem; background: var(--karte, #fff); }
.chip small { color: var(--leise); }
.chip.aktiv { background: #1d2733; color: #fff; border-color: #1d2733; }
.chip.aktiv small { color: #c9d4e0; }
@media (max-width: 900px) {
  .arbeitsplatz { grid-template-columns: 1fr; }
  .bereich-liste { position: static; max-height: 16rem; }
  .bd-stamm { grid-template-columns: 1fr 1fr; }
  details.stueck > summary { grid-template-columns: 1fr auto; }
  .st-nr, .st-pruef { display: none; }
}

/* Dashboard: Ring Deckungsgrad */
.ring-karte { display: grid; grid-template-columns: 15rem 1fr; gap: 1.6rem; align-items: start; }
.ring { width: 100%; max-width: 13rem; display: block; margin: 0 auto; }
.ring-seg { cursor: pointer; stroke: var(--karte, #fff); stroke-width: 2; transition: opacity .15s; outline: none; }
.ring-seg:hover, .ring-seg:focus-visible { opacity: .85; }
.ring-seg.blass { opacity: .25; }
.ring-zahl { font-size: 30px; font-weight: 700; fill: currentColor; }
.ring-text { font-size: 12px; fill: var(--leise); }
.ring-legende { display: flex; flex-direction: column; gap: .25rem; margin-top: .8rem; }
.ring-leg { display: grid; grid-template-columns: .8rem 1fr auto; grid-template-rows: auto auto; column-gap: .5rem; align-items: center; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 8px; padding: .35rem .55rem; cursor: pointer; color: inherit; font: inherit; }
.ring-leg i { width: .8rem; height: .8rem; border-radius: 3px; grid-row: 1 / 3; }
.ring-leg small { grid-column: 2 / 4; font-size: .75rem; }
.ring-leg:hover { background: #f3f6fa; }
.ring-leg.aktiv { border-color: var(--linie); background: #eef3f9; }
.ring-titel { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem; }
.ring-titel b { font-size: 1.05rem; text-transform: capitalize; }
.ring-alle { margin-left: auto; font-size: .82rem; }
.ring-rechts .rang { max-height: 24rem; overflow: auto; }
.ring-rechts .rang-zeile[hidden] { display: none; }

/* Dashboard: Bearbeitungsdauer */
.dl-reiter { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.dl-reiter .chip { cursor: pointer; font: inherit; font-size: .88rem; }
.dl-zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: .8rem; }
.dl-zahlen > div { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .7rem; border: 1px solid var(--linie); border-radius: 8px; }
.dl-zahlen span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); }
.dl-zahlen b { font-size: 1.5rem; }
.dl-zahlen small { font-size: .78rem; }
.dl-legende { font-size: .82rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.dl-legende i { width: .75rem; height: .75rem; border-radius: 3px; display: inline-block; margin-left: .5rem; }
.dl-legende i:first-child { margin-left: 0; }
.dl-svg { width: 100%; height: auto; max-height: 230px; margin-top: .3rem; }
.dl-svg .dz-wert { font-size: 11px; font-weight: 650; fill: currentColor; }
.dl-svg .dz-achse { font-size: 12px; fill: currentColor; }
.dl-svg .dz-klein { font-size: 10.5px; fill: var(--leise); }
.dl-svg .dz-linie { stroke: var(--linie); }
.dl-panel h4 { margin: .8rem 0 .3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); }
.dl-offen { display: flex; flex-direction: column; }
.dl-offen a { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem .5rem; border-radius: 6px; text-decoration: none; color: inherit; font-size: .9rem; }
.dl-offen a:hover { background: #f3f6fa; }
.dl-offen a.ueber b { color: #b42318; }
@media (max-width: 900px) { .ring-karte { grid-template-columns: 1fr; } .dl-zahlen { grid-template-columns: 1fr; } }

/* Gruppen-Ringe, Ampel-Tabelle, Einstellungen */
.gruppen-ringe { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.2rem; }
.gruppen-ring { border: 1px solid var(--linie); border-radius: 10px; padding: .8rem 1rem; }
.gruppen-ring h4 { margin: 0 0 .5rem; font-size: 1rem; }
.ring-karte.klein { grid-template-columns: 1fr; gap: .6rem; }
.ring-karte.klein .ring-links { display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem; align-items: center; }
.ring-karte.klein .ring { max-width: 7.5rem; }
.ring-karte.klein .ring-zahl { font-size: 34px; }
.ring-karte.klein .ring-legende { margin-top: 0; gap: .1rem; }
.ring-karte.klein .ring-leg { grid-template-rows: auto; padding: .25rem .45rem; }
.ring-karte.klein .ring-leg i { grid-row: auto; }
.ring-karte.klein .rang { max-height: 11rem; }
.ring-karte.klein .rang-zeile { grid-template-columns: 1fr auto; }
.ring-karte.klein .ring-titel b { font-size: .92rem; }
details.dash-mehr > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
details.dash-mehr > summary::-webkit-details-marker { display: none; }
details.dash-mehr > summary h3 { margin: 0; }
details.dash-mehr > summary::before { content: '▸'; color: var(--leise); }
details.dash-mehr[open] > summary::before { content: '▾'; }
details.dash-mehr[open] > summary { margin-bottom: .8rem; }
.ht-filter { margin-bottom: .5rem; }
.ampel-tabelle td.zelle { padding: 0; }
.ampel-tabelle td.zelle a { display: block; padding: .35rem .6rem; text-decoration: none; color: inherit; font-variant-numeric: tabular-nums; }
.ampel-tabelle td.zelle a:hover { outline: 2px solid #1d2733; outline-offset: -2px; }
.ampel-tabelle tr[hidden] { display: none; }
.st-kritisch { background: #fbe1e1; color: #8a1c1c; }
.st-knapp { background: #fff1c7; color: #6b4f00; }
.st-gut { background: #e2f4e5; color: #1d6b2c; }
.st-leer { background: #f1f3f6; }
.ampel-tabelle td.gesamt { font-weight: 650; border-left: 2px solid var(--linie); }
.skala i.st-kritisch, .skala i.st-knapp, .skala i.st-gut { display: inline-block; width: 1rem; height: .8rem; border-radius: 3px; margin: 0 .2rem 0 .6rem; vertical-align: -1px; }
nav.kopf .zahnrad { font-size: 1.15rem; text-decoration: none; color: var(--leise); padding: .2rem .45rem; border-radius: 6px; }
nav.kopf .zahnrad:hover, nav.kopf .zahnrad.aktiv { background: #eef3f9; color: inherit; }
.einstellungen .karte { margin-bottom: 1rem; }
.einstellungen .zeilen { border: none; padding: 0; background: none; }
.mit-einheit { display: flex; align-items: center; gap: .4rem; }
.mit-einheit input { width: 6rem; }
.schwellen-skala { display: flex; height: .7rem; border-radius: 999px; overflow: hidden; margin: .4rem 0 1rem; max-width: 36rem; }
.einstellungen .zeilen { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 20rem)); gap: 1rem 2rem; margin: .6rem 0; }
.einstellungen .zeilen label { display: flex; flex-direction: column; gap: .3rem; }
.einstellungen h2 { margin-top: 0; }
.einstellungen table input.klein { width: 5.5rem; }
nav.kopf ul a { padding: .4rem .45rem; }
nav.kopf { gap: .8rem; }
