:root {
  --grund: #f4f2ee; --flaeche: #ffffff; --tinte: #1f2933; --leise: #5b6770; --linie: #d9d4cb;
  --marke: #1d4e5f; --marke-hell: #e3eef1; --gruen: #2e7d4f; --gelb: #b7791f; --rot: #b3372f; --grau: #7a858c;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tinte); background: var(--grund); line-height: 1.5; }
a { color: var(--marke); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h2 small { font-weight: normal; color: var(--leise); font-size: .85rem; }
code { background: var(--marke-hell); padding: .1rem .3rem; border-radius: 4px; word-break: break-all; }

.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .8rem; padding: .6rem 1rem; background: var(--marke); color: #fff; }
.kopf a { color: #fff; text-decoration: none; }
.marke { font-weight: 700; letter-spacing: .02em; font-size: 1.15rem; }
.betrieb { opacity: .85; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suche { margin: 0; flex: 0 1 14rem; min-width: 5rem; }
.benutzer { flex: none; white-space: nowrap; }
.suche input { width: 100%; min-height: 2.1rem; padding: .25rem 1rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.15); color: #fff; font: inherit; font-size: .95rem; }
.suche input::placeholder { color: rgba(255,255,255,.75); }
.suche input:focus { background: #fff; color: var(--tinte); }
textarea { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--linie); border-radius: 8px; background: #fff; color: var(--tinte); resize: vertical; }
.treffer { list-style: none; padding: 0; margin: 0 0 1rem; }
.treffer li { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: .6rem .9rem; margin-bottom: .4rem; }
.art-wahl { position: absolute; opacity: 0; pointer-events: none; }
.umschalter { display: inline-flex; border: 1px solid var(--marke); border-radius: 8px; overflow: hidden; margin: 0 0 1rem; }
.umschalter label { padding: .55rem 1.4rem; cursor: pointer; font-weight: 600; color: var(--marke); background: #fff; min-height: 2.6rem; display: flex; align-items: center; }
#art-firma:checked ~ .umschalter label[for=art-firma], #art-privat:checked ~ .umschalter label[for=art-privat] { background: var(--marke); color: #fff; }
#art-firma:focus-visible ~ .umschalter label[for=art-firma], #art-privat:focus-visible ~ .umschalter label[for=art-privat] { outline: 3px solid #7fb6c6; outline-offset: -3px; }
#art-privat:checked ~ .nur-firma, #art-privat:checked ~ fieldset .nur-firma { display: none; }
#art-firma:checked ~ fieldset .nur-privat { display: none; }
#preis-aufschlag:checked ~ .umschalter label[for=preis-aufschlag], #preis-fest:checked ~ .umschalter label[for=preis-fest] { background: var(--marke); color: #fff; }
#preis-aufschlag:focus-visible ~ .umschalter label[for=preis-aufschlag], #preis-fest:focus-visible ~ .umschalter label[for=preis-fest] { outline: 3px solid #7fb6c6; outline-offset: -3px; }
#preis-fest:checked ~ fieldset .nur-aufschlag, #preis-aufschlag:checked ~ fieldset .nur-fest { display: none; }
.rechts { text-align: right; }
.ergebnis { width: 100%; display: table; }
.ergebnis td, .ergebnis th { white-space: normal; }
.ergebnis td.rechts, .ergebnis th.rechts { white-space: nowrap; }
.ergebnis tr.summe td { font-weight: 700; border-top: 2px solid var(--tinte); font-size: 1.1rem; }
.gross { font-size: 1.5rem; font-weight: 700; color: var(--marke); }
.leiste { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; }
.leiste form { margin: 0; }
.leiste select { width: auto; min-width: 12rem; }
form.leiste { margin: 0; flex-wrap: nowrap; }
/* Akte: Karten füllen die Spalten ohne Lücken */
.kacheln.akte { display: block; columns: 21rem 3; column-gap: 1rem; }
.kacheln.akte > .karte { break-inside: avoid; margin: 0 0 1rem; }
.breit { grid-column: 1 / -1; }
tr.klick:hover { background: var(--marke-hell); }
.verlauf { list-style: none; padding: 0; margin: 0; }
.verlauf li { border-left: 3px solid var(--linie); padding: .1rem 0 .8rem .9rem; }
.verlauf li.offen { border-left-color: var(--gelb); }
.verlauf .kopfzeile { font-size: .85rem; color: var(--leise); }
.daten { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0 0 .8rem; }
.daten dt { color: var(--leise); font-size: .9rem; } .daten dd { margin: 0; }
.blaettern { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; }
.benutzer { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.benutzer form { margin: 0; }
.menue-knopf { display: none; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.menue-schalter { display: none; }

.menue { position: fixed; top: 3.2rem; bottom: 0; left: 0; width: 15rem; background: var(--flaeche); border-right: 1px solid var(--linie); padding: 1rem .6rem; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; }
.menue a { display: block; padding: .55rem .8rem; border-radius: 8px; text-decoration: none; color: var(--tinte); }
.menue a:hover { background: var(--marke-hell); }
.menue a.aktiv { background: var(--marke); color: #fff; }
.menue .gruppe { margin: 1rem .8rem .3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); }

main { padding: 1.5rem; max-width: 80rem; }
body.innen main { margin-left: 15rem; }
body.aussen main { margin: 8vh auto 0; max-width: 26rem; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1rem; align-items: start; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 0 0 1rem; }
.kacheln .karte { margin: 0; }
.karte.neu { border-style: dashed; }
.karte.schmal { max-width: 26rem; }
.betriebsname { font-weight: 600; color: var(--marke); margin-top: 0; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0 1rem; }
.filter { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; }
.filter .feld { margin: 0; }

.feld { display: block; margin: 0 0 .9rem; }
.feld span { display: block; font-size: .9rem; color: var(--leise); margin-bottom: .2rem; }
.feld small, small { color: var(--leise); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=datetime-local], input[type=time], select {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--linie); border-radius: 8px; background: #fff; color: var(--tinte); min-height: 2.6rem; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid #7fb6c6; outline-offset: 1px; }
.haken { display: flex; gap: .5rem; align-items: center; padding: .25rem 0; }
.haken { align-items: flex-start; }
.haken input { width: 1.2rem; height: 1.2rem; min-width: 1.2rem; flex: none; margin: .2rem 0 0; }
fieldset { border: 1px solid var(--linie); border-radius: 8px; margin: 0 0 .9rem; padding: .5rem .8rem; }
legend { font-size: .9rem; color: var(--leise); padding: 0 .3rem; }
details { margin-top: .8rem; }
summary { cursor: pointer; color: var(--marke); }
details form { margin-top: .8rem; }

button, .knopf { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1.1rem; min-height: 2.6rem; border-radius: 8px; border: 1px solid var(--marke); background: var(--marke); color: #fff; cursor: pointer; text-decoration: none; }
button:hover, .knopf:hover { filter: brightness(1.1); }
button.zweit, .knopf.zweit { background: #fff; color: var(--marke); }
button.schlicht { background: transparent; border-color: rgba(255,255,255,.5); min-height: 0; padding: .25rem .7rem; font-weight: 500; }

.meldung { padding: .7rem 1rem; border-radius: 8px; border: 1px solid; margin: 0 0 1rem; }
.meldung.gut { background: #e8f4ec; border-color: #a9d3b9; color: #1d5a37; }
.meldung.schlecht { background: #fbeceb; border-color: #e3aaa5; color: #7d241e; }
.ampel { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: #fff; margin: 0 .3rem .3rem 0; }
.ampel.gruen { background: var(--gruen); } .ampel.gelb { background: var(--gelb); } .ampel.rot { background: var(--rot); } .ampel.grau { background: var(--grau); }
p.ampel { display: block; border-radius: 8px; padding: .4rem .8rem; }
.nummer, .schluessel { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.schluessel { font-size: 1.15rem; background: var(--marke-hell); padding: .6rem .8rem; border-radius: 8px; line-height: 1.9; }
.schluessel span { display: inline-block; white-space: nowrap; margin-right: .5rem; }
.qr-rahmen { margin: .8rem 0; }
.qr { width: 13rem; height: 13rem; max-width: 100%; border: 1px solid var(--linie); border-radius: 8px; background: #fff; display: block; }
.schritte { padding-left: 1.3rem; margin: 0 0 1rem; }
.schritte li { margin-bottom: .7rem; }

table { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--linie); vertical-align: top; white-space: nowrap; }
td.wert { white-space: normal; word-break: break-word; min-width: 10rem; font-size: .9rem; color: var(--leise); }
th { font-size: .85rem; color: var(--leise); background: #faf9f6; }

@media (max-width: 800px) {
  html { font-size: 16px; }
  .menue-knopf { display: block; }
  .menue { transform: translateX(-100%); transition: transform .15s; width: 80vw; max-width: 18rem; z-index: 4; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .menue-schalter:checked + .menue { transform: none; }
  body.innen main { margin-left: 0; padding: 1rem; }
  .suche { display: none; }
  .kacheln { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}

table.positionen td.wert { color: var(--tinte); font-size: 1rem; min-width: 16rem; }
table.positionen td.wert div { color: var(--leise); font-size: .9rem; }
table.positionen tr.titel td { background: #f1efea; font-weight: 700; }
table.positionen tr.titel input { max-width: 22rem; }
table.positionen tr.nebenbei td { color: var(--leise); }
table.positionen td.zug { white-space: normal; }
table.positionen td.zug form { display: inline-block; margin: 0 .2rem .2rem 0; }
table.positionen td.zug button, table.positionen td.zug .knopf { padding: .2rem .55rem; font-size: .85rem; }
.summen tr.intern td { color: var(--leise); font-size: .9rem; }

.zugleiste { display: flex; flex-wrap: wrap; gap: .3rem; align-items: stretch; }
.zugleiste form { display: flex; margin: 0; }
table.positionen .zugleiste button, table.positionen .zugleiste .knopf { display: inline-flex; align-items: center; box-sizing: border-box; height: 2.1rem; margin: 0; padding: 0 .6rem; font: inherit; font-size: .85rem; font-weight: 600; line-height: 1; }
.karte.hervor { border: 2px solid var(--marke); }

input[type=file] { width: 100%; padding: .5rem; border: 1px dashed var(--linie); border-radius: 8px; background: var(--flaeche); font: inherit; }
.bilder { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.bilder img { height: 3.5rem; width: auto; border: 1px solid var(--linie); border-radius: 4px; background: #fff; }
.bilder.gross { gap: 1rem; }
.bilder.gross figure { margin: 0; }
.bilder.gross img { height: 9rem; display: block; }
.bilder.gross figcaption { font-size: .85rem; color: var(--leise); margin: .2rem 0; max-width: 14rem; overflow-wrap: anywhere; }
input.menge { width: 6.5rem; text-align: right; }
#unterschrift-feld { display: block; width: 100%; max-width: 900px; height: auto; aspect-ratio: 3 / 1; border: 2px solid var(--marke); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
img.unterschrift { max-width: 20rem; max-height: 7rem; border: 1px solid var(--linie); border-radius: 4px; background: #fff; margin-top: .3rem; }
.summen tr.gesamt td { font-size: 1.15rem; }
.ergebnis small { color: var(--leise); }
.gross-knopf { font-size: 1.3rem; padding: .9rem 2rem; min-width: 12rem; }
.gross-knopf.stopp { background: var(--rot); border-color: var(--rot); }
.standort small { color: var(--leise); }
.suchwahl input[type=search] { width: 100%; font: inherit; padding: .55rem .7rem .55rem 2.3rem; margin-bottom: .4rem; border: 1px solid var(--linie); border-radius: 8px; min-height: 2.6rem; color: var(--tinte);
  background: #fff url("/public/lupe.svg") no-repeat .7rem center / 1.1rem; }
.suchwahl [data-treffer] { color: var(--leise); }
.suchwahl [data-treffer] { display: block; margin: .2rem 0 .6rem; }
.suchwahl .feld { margin-bottom: 0; }
