/* Rechnungstool – Basis aus freevend (Handy zuerst, Grün + Beige). Ergänzungen unten. */
:root {
  --page: #F5EFE3; --card: #FFFDF9; --ink: #2C2A26; --ink2: #5E5A52; --muted: #6F6A61; --line: #E6DCC8;
  --green: #4A7C3F; --green-d: #3A6431; --green-soft: #93B788; --green-tint: #E8F0E4;
  --neutral: #B9AC92; --beige-d: #D9C7A7; --sand: #EADFCB; --earth: #8B6F47; --earth-tint: #F1E9DA;
  --red: #B4462F; --red-ink: #9A3A26; --red-tint: #F6E3DD;
  --amber-ink: #8A5A00; --amber-tint: #FBF1D3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 50, 30, .07), 0 4px 14px rgba(60, 50, 30, .06);
  --leiste: 64px;
  --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink); line-height: 1.35; font-size: 15px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--leiste) + var(--unten));
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--green-d); }
h2 { margin: 0 0 2px; font-size: 16px; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; display: block; }
.klein { font-size: 12.5px; color: var(--muted); }
.mt { margin-top: 10px; }
.leer { text-align: center; color: var(--muted); padding: 24px 10px; }
.umbruch { white-space: normal !important; overflow-wrap: anywhere; }

/* ---------- Kopf ---------- */
.appbar {
  background: var(--green); color: #FFFDF9; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 40;
}
.ab-links { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ab-text { min-width: 0; }
.ab-titel { font-size: 20px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-sub { font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-rechts { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; }
.frisch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .17); padding: 5px 10px; border-radius: 20px; white-space: nowrap; color: #FFFDF9; text-decoration: none; }
.frisch i { width: 8px; height: 8px; border-radius: 50%; background: #C9EBBE; }
.frisch.alt { background: var(--red-tint); color: var(--red-ink); }
.frisch.alt i { background: var(--red); }
.ab-knopf { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .17); display: grid; place-items: center; flex: 0 0 40px; color: #FFFDF9; border: 0; cursor: pointer; }

/* ---------- Inhalt ---------- */
.inhalt { padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 620px; margin: 0 auto; flex: 1; }
.spalten { display: flex; flex-direction: column; gap: 10px; }
.spalten > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.karte { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kasten { padding: 13px 14px; }
.abschnitt { font-size: 12.5px; font-weight: 700; color: var(--ink2); text-transform: uppercase; letter-spacing: .05em; margin: 10px 4px -2px; display: flex; align-items: center; gap: 8px; }
.abschnitt .zaehler { background: var(--red); color: #FFFDF9; border-radius: 10px; font-size: 11.5px; padding: 1px 7px; letter-spacing: 0; }
.abschnitt a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--green-d); font-size: 13.5px; text-decoration: none; }
.zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hinweistext { font-size: 12.5px; color: var(--ink2); margin: 0 0 10px; }
.flash { background: var(--green-tint); border: 1px solid var(--green-soft); color: var(--green-d); padding: 10px 13px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.hinweis { display: flex; gap: 8px; align-items: flex-start; background: var(--amber-tint); border: 1px solid var(--beige-d); color: var(--amber-ink); padding: 10px 13px; border-radius: 12px; font-size: 13.5px; text-decoration: none; }
.hinweis.rot { background: var(--red-tint); border-color: var(--red); color: var(--red-ink); }
.hinweis .ic { margin-top: 1px; }
.allesgut { padding: 14px; display: flex; align-items: center; gap: 10px; color: var(--green-d); font-weight: 600; }

/* ---------- Hauptzahl ---------- */
.hero { padding: 16px 16px 13px; }
.label { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero-zahl { font-size: 52px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.hero-zahl.mittel { font-size: 46px; }
.hero-sub { font-size: 14px; color: var(--ink2); margin-top: 5px; }
.hero-sub b { color: var(--ink); font-weight: 700; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 68px; margin-top: 10px; border-bottom: 1px solid #CFC3AB; }
.spark .s { flex: 1; max-width: 24px; background: var(--neutral); border-radius: 4px 4px 0 0; position: relative; outline-offset: 2px; }
.spark .s.heute { background: var(--green); }
.spark .s:hover, .spark .s:focus { filter: brightness(.9); }
.spark .s em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--ink2); white-space: nowrap; padding-bottom: 2px; }
.spark-achse { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ---------- Offene Punkte ---------- */
.todo, .liste { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.todo li { border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 11px 10px 11px 12px; text-decoration: none; color: inherit; }
.sym { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--green-tint); color: var(--green-d); }
.sym.rot, .todo .kritisch .sym { background: var(--red-tint); color: var(--red); }
.sym.gelb, .todo .warnung .sym { background: var(--amber-tint); color: var(--amber-ink); }
.sym.sand, .todo .info .sym { background: var(--earth-tint); color: var(--earth); }
.tx { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.todo b { display: block; font-size: 15px; font-weight: 700; line-height: 1.25; }
.todo span.chev, .chev { color: var(--neutral); flex: 0 0 auto; }
.todo .tx span { display: block; font-size: 12.5px; color: var(--ink2); line-height: 1.3; margin-top: 1px; }

/* ---------- Listen ---------- */
.liste > li { display: flex; align-items: center; gap: 11px; padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); }
.liste > li:first-child { border-top: 0; }
.liste > li > a:first-child:not(.tx) { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; text-decoration: none; color: inherit; margin: -10px -12px -10px -14px; padding: 10px 12px 10px 14px; }
.liste.gross > li > a:first-child { padding-top: 13px; padding-bottom: 13px; margin-top: -10px; margin-bottom: -10px; }
.liste.dicht > li { padding-top: 7px; padding-bottom: 7px; }
.liste.innen { margin: 4px -14px 0; }
.liste.innen > li:first-child { border-top: 1px solid var(--line); }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; background: var(--green); }
.punkt.aus { background: var(--red); }
.punkt.grau { background: var(--neutral); }
.liste .n { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .m { font-size: 12.5px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .m.rot { color: var(--red-ink); font-weight: 600; }
.liste .r { text-align: right; flex: 0 0 auto; }
.liste .r b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste .r small { display: block; font-size: 11.5px; color: var(--muted); }
.liste .zeit { flex: 0 0 46px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.liste .zeit small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.liste form { margin: 0; flex: 0 0 auto; }
.marken { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.marken:empty { display: none; }
.marke { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; border-radius: 9px; padding: 2px 8px; text-decoration: none; white-space: nowrap; vertical-align: 1px; }
.marke.rot { background: var(--red-tint); color: var(--red-ink); }
.marke.gelb { background: var(--amber-tint); color: var(--amber-ink); }
.marke.gruen { background: var(--green); color: #FFFDF9; }
.marke.sand { background: var(--sand); color: var(--ink2); }
.fachnr { flex: 0 0 36px; min-width: 36px; height: 28px; border-radius: 8px; background: var(--sand); color: var(--ink); display: inline-grid; place-items: center; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.rang { flex: 0 0 22px; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.del { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--sand); color: var(--ink2); display: grid; place-items: center; cursor: pointer; }
.iconlink { color: var(--green-d); display: grid; place-items: center; width: 34px; height: 34px; }
.wahl { width: 22px; height: 22px; accent-color: var(--green); flex: 0 0 22px; }

/* ---------- Umschalter, Chips, Formulare ---------- */
.seg { display: flex; background: var(--sand); border-radius: 13px; padding: 3px; gap: 3px; }
.seg a { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink2); padding: 9px 4px; border-radius: 10px; text-decoration: none; }
.seg a.aktiv { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 50, 30, .18); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.rollen { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.chips.rollen::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 18px; border: 1px solid var(--beige-d); background: var(--card); color: var(--ink2); white-space: nowrap; flex: 0 0 auto; text-decoration: none; }
.chip.aktiv { background: var(--green); border-color: var(--green); color: #FFFDF9; }
.chip.aus { opacity: .5; }
.monat { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.monat b { font-size: 16px; }
.monat a { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; padding: 6px 2px; }
.felder { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.felder label { flex: 1 1 130px; font-size: 12px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 3px; }
.felder label.schmal { flex: 0 0 80px; }
input[type=text], input[type=search], input[type=date], input[type=datetime-local], input[type=password] {
  font-size: 16px; padding: 10px 11px; border: 1.5px solid var(--beige-d); border-radius: 11px; width: 100%; background: var(--card); min-height: 44px;
}
input:focus-visible, button:focus-visible, a:focus-visible, .fach:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--green-d); outline-offset: 2px; }
details > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--green-d); display: inline-flex; align-items: center; gap: 5px; padding: 6px 0; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 6px; }
details.karte > summary { padding: 0; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px; font-size: 16.5px; font-weight: 700; background: var(--green); color: #FFFDF9; border: 0; padding: 0 16px; cursor: pointer; text-decoration: none; }
.btn:active { background: var(--green-d); }
.btn.zweit { background: var(--sand); color: var(--ink); }
.btn.klein { min-height: 44px; font-size: 14px; border-radius: 12px; padding: 0 13px; flex: 0 0 auto; }
.aktion { position: sticky; bottom: calc(var(--leiste) + var(--unten)); z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 8px 14px 10px; }
.aktion-knoepfe { display: flex; gap: 8px; max-width: 592px; margin: 0 auto; }
.aktion-knoepfe .btn { flex: 1; }
.aktion-knoepfe .btn.zweit { flex: 0 0 40%; }
.aktion-mehr { max-width: 592px; margin: 0 auto; }
.aktion-mehr.frei { margin-top: 8px; }

/* ---------- Leiste unten ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px calc(8px + var(--unten)); height: calc(var(--leiste) + var(--unten)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar .tb { width: 56px; height: 30px; border-radius: 15px; display: grid; place-items: center; position: relative; }
.tabbar .aktiv { color: var(--green-d); }
.tabbar .aktiv .tb { background: var(--green-tint); }
.tabbar .bz { position: absolute; top: -3px; right: 6px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #FFFDF9; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--card); }

/* ---------- Fächer als Raster ---------- */
.schrank { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 5px; }
.etage { display: grid; gap: 5px; margin-bottom: 5px; }
.fach { background: #F4EEE1; border: 1px solid var(--line); border-radius: 10px; padding: 6px 7px; min-height: 64px; position: relative; display: flex; flex-direction: column; min-width: 0; text-align: left; cursor: pointer; font-family: inherit; }
.fach .kopf { display: flex; align-items: center; gap: 6px; }
.fach .nr { font-size: 12.5px; font-weight: 800; color: var(--muted); line-height: 1.1; }
.fach .pn { font-size: 11px; line-height: 1.2; color: var(--muted); margin-top: 3px; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fach.v { background: var(--card); border-color: var(--green-soft); }
.fach.v .nr, .fach.v .pn { color: var(--ink); }
.fach.gewaehlt { outline: 2px solid var(--green-d); outline-offset: 1px; }
.fach .anz { position: absolute; top: -7px; right: -6px; min-width: 25px; height: 25px; border-radius: 13px; background: var(--green); color: #FFFDF9; font-size: 13.5px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; border: 2px solid var(--card); }
.fach .stoer { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--red-ink); white-space: nowrap; }
.kompakt .etage { gap: 3px; margin-bottom: 3px; }
.kompakt .fach { min-height: 44px; padding: 4px 0; align-items: center; border-radius: 7px; }
.kompakt .fach .kopf { justify-content: center; }
.kompakt .fach .nr { font-size: 10.5px; }
.kompakt .fach .anz { position: static; border: 0; min-width: 0; height: auto; background: none; color: var(--green-d); font-size: 14.5px; padding: 0; margin-top: 2px; line-height: 1; }
.kompakt .fach.v { background: var(--green-tint); border-color: var(--green-soft); }
.kompakt .fach.f { background: var(--red-tint); border-color: var(--red); }
.kompakt .fach.f .anz { color: var(--red-ink); }
.fachinfo { font-size: 13px; font-weight: 600; background: var(--earth-tint); border-radius: 10px; padding: 8px 10px; margin-top: 6px; color: var(--ink2); min-height: 36px; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); margin-top: 8px; }
.legende span { display: inline-flex; align-items: center; gap: 5px; }
.legende i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); background: #F4EEE1; }
.legende i.v { background: var(--green-tint); border-color: var(--green-soft); }
.legende i.f { background: var(--red-tint); border-color: var(--red); }

/* ---------- Fotos ---------- */
.fotos { display: flex; gap: 8px; margin-top: 8px; }
.fotos .f { position: relative; width: calc(33.33% - 6px); aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--sand); }
.fotos .f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos .f .z { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; padding: 3px 6px; }
.fotos .f form { position: absolute; top: 4px; right: 4px; }

/* ---------- Diagramme ---------- */
.meter { display: flex; gap: 2px; height: 12px; margin-top: 12px; }
.meter i { display: block; height: 100%; }
.meter .a { background: var(--green); border-radius: 4px 0 0 4px; }
.meter .b { background: var(--green-soft); border-radius: 0 4px 4px 0; flex: 1; }
.meter-leg { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; margin-top: 7px; color: var(--ink2); }
.meter-leg b { color: var(--ink); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.key.a { background: var(--green); }
.key.b { background: var(--green-soft); }
.plot { position: relative; height: 150px; margin: 24px 0 0 34px; border-bottom: 1px solid #CFC3AB; }
.plot .grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.plot .grid span { position: absolute; left: -34px; top: -8px; width: 29px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plot .cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.plot .c { flex: 1; max-width: 24px; background: var(--green); border-radius: 4px 4px 0 0; position: relative; min-height: 1px; }
.plot .c:hover, .plot .c:focus { background: var(--green-d); }
.plot .c em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--ink2); white-space: nowrap; padding-bottom: 3px; }
.plot .c.rechts em { left: auto; right: 0; transform: none; }
.plot .c.links em { left: 0; transform: none; }
.xachse { display: flex; gap: 2px; margin: 4px 0 0 34px; }
.xachse span { flex: 1; max-width: 24px; font-size: 11px; color: var(--muted); white-space: nowrap; width: 0; text-align: center; }
.tabelle-twin { margin-top: 8px; }
.hbars { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; margin-top: 8px; }
.hbars a { color: var(--ink); text-decoration: none; }
.hbars .bar { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--green); min-width: 2px; }
.hbars b { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
#tip { position: fixed; z-index: 90; background: var(--ink); color: #FFFDF9; font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap; transform: translate(-50%, -100%); }

/* ---------- Tabellen ---------- */
.tabelle { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.reihe td { background: var(--green-tint); color: var(--green-d); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.werte { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0 0; font-size: 14px; }
.werte dt { color: var(--muted); }
.werte dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- Steuersatz ---------- */
.satzwahl { display: flex; gap: 6px; flex: 0 0 auto; }
.sbtn { min-width: 56px; min-height: 44px; border-radius: 11px; border: 1.5px solid var(--beige-d); background: var(--card); font-size: 14.5px; font-weight: 700; cursor: pointer; }
.sbtn.aktiv { background: var(--green); border-color: var(--green); color: #FFFDF9; }

/* ---------- Anmelden ---------- */
body.login { padding: 0; justify-content: center; align-items: center; }
.login-karte { width: min(340px, calc(100% - 32px)); padding: 26px 20px 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.login-karte h1 { margin: 0; font-size: 24px; color: var(--green-d); }
.login-karte p { color: var(--muted); }
.login-karte form { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-karte label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.login-karte small { color: var(--muted); }

.nur-druck, .nur-druck-block { display: none; }

/* ---------- Breiter Bildschirm ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 96px; }
  .tabbar { top: 0; bottom: 0; right: auto; width: 96px; height: auto; flex-direction: column; justify-content: flex-start; gap: 14px; border-top: 0; border-right: 1px solid var(--line); padding: 84px 6px 12px; }
  .tabbar a { flex: 0 0 auto; }
  .inhalt { max-width: 1080px; padding: 20px 24px 28px; }
  .spalten { flex-direction: row; align-items: flex-start; gap: 18px; }
  .spalten > div { flex: 1; }
  .aktion { bottom: 0; }
  .appbar { padding-left: 24px; padding-right: 24px; }
}

/* ---------- Druck ---------- */
@media print {
  body { background: #fff; padding: 0; display: block; }
  .appbar, .tabbar, .aktion, .druck-aus, .flash, #tip { display: none !important; }
  .inhalt { max-width: none; padding: 0; }
  .karte { box-shadow: none; border-color: #999; }
  .nur-druck { display: revert; }
  .nur-druck-block { display: block; }
  .liste > li { break-inside: avoid; }
  tr { break-inside: avoid; }
  .haken { font-size: 20px; margin-left: 10px; }
}

/* =================== Rechnungstool =================== */
.inhalt { max-width: 720px; }
.test-band { background: var(--amber-tint); color: var(--amber-ink); font-size: 12.5px; font-weight: 700; text-align: center; padding: 5px 10px; border-bottom: 1px solid var(--beige-d); }
.ab-logo { height: 34px; width: auto; border-radius: 8px; background: #fff; padding: 2px 4px; }
.suche { display: flex; gap: 8px; }
.suche input { flex: 1; }
textarea, select, input[type=number], input[type=email], input[type=tel] {
  font: inherit; font-size: 16px; padding: 10px 11px; border: 1.5px solid var(--beige-d); border-radius: 11px; width: 100%; background: var(--card); min-height: 44px; color: inherit;
}
textarea { min-height: 64px; resize: vertical; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 3px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.reihe2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.reihe2 > label, .reihe2 input { min-width: 0; }       /* Datumsfelder sprengen sonst am Handy die Breite */
.reihe2.ad-ort { grid-template-columns: 5.5em minmax(0, 1fr) 3.5em; }
.reihe3 { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.knoepfe .btn { flex: 1 1 140px; }
.btn.rot { background: var(--red); }
.btn.rand { background: var(--card); color: var(--green-d); border: 1.5px solid var(--green-soft); }
.betrag { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.nr { font-variant-numeric: tabular-nums; font-weight: 700; }
.quelle { font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
.quelle.kundenpreis, .quelle.kundenpreis_prozent, .quelle.kundenrabatt { background: var(--green); color: #FFFDF9; }
.quelle.preisliste, .quelle.preisliste_prozent { background: var(--green-tint); color: var(--green-d); }
.quelle.bizerba { background: var(--sand); color: var(--ink2); }
.quelle.eigener_standard { background: var(--earth-tint); color: var(--earth); }
.quelle.manuell { background: var(--amber-tint); color: var(--amber-ink); }
.kz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kz .karte { padding: 11px 12px; }
.kz b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.kz span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Editor ---------- */
.ed-kunde { display: flex; align-items: center; gap: 10px; }
.ed-kunde .tx b { font-size: 16px; }
.ed-pos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-pos li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 11px; display: flex; flex-direction: column; gap: 7px; }
.ed-pos li.text { background: var(--green-tint); border-color: var(--green-soft); }
.ed-kopf { display: flex; align-items: center; gap: 8px; }
.ed-kopf .artnr { font-weight: 800; font-size: 13px; background: var(--sand); border-radius: 7px; padding: 2px 7px; }
.ed-kopf .posnr { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 18px; }
.ed-kopf .platz { flex: 1; }
.ed-kopf button { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--sand); color: var(--ink2); display: grid; place-items: center; cursor: pointer; }
.ed-kopf button.weg { background: var(--red-tint); color: var(--red-ink); }
.ed-bez { font-size: 15px !important; min-height: 44px !important; padding: 8px 10px !important; }
.ed-werte { display: grid; grid-template-columns: .95fr 1fr 1.1fr .85fr; gap: 6px; align-items: end; }
.ed-werte label { font-size: 11px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.ed-werte input, .ed-werte select { padding: 8px 7px; min-height: 42px; text-align: right; font-size: 16px; }
.ed-werte select { text-align: left; }
.ed-summe { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink2); }
.ed-summe b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ed-neu { position: relative; }
.vorschlaege { list-style: none; margin: 4px 0 0; padding: 0; position: absolute; left: 0; right: 0; top: 100%; z-index: 45; background: var(--card); border: 1px solid var(--beige-d); border-radius: 13px; box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; }
.vorschlaege li { padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.vorschlaege li:first-child { border-top: 0; }
.vorschlaege li.aktiv, .vorschlaege li:hover { background: var(--green-tint); }
.vorschlaege .tx { flex: 1; min-width: 0; }
.vorschlaege .tx b { display: block; font-size: 14.5px; }
.vorschlaege .tx span { font-size: 12px; color: var(--ink2); }
.ed-fuss { position: sticky; bottom: calc(var(--leiste) + var(--unten)); z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 8px 14px 10px; margin: 0 -14px -18px; }
.ed-fuss .zeile { max-width: 692px; margin: 0 auto; }
.ed-fuss .gesamt { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ed-fuss .status { font-size: 12px; color: var(--muted); }
.ed-fuss .knoepfe { max-width: 692px; margin: 6px auto 0; }
.zusatz { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Rechnungsansicht ---------- */
.pos-tab td { white-space: normal; vertical-align: top; }
.pos-tab tr.text td { background: var(--green-tint); font-weight: 700; }
.summen { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 14px; margin-top: 10px; }
.summen .gesamt { font-size: 18px; font-weight: 800; color: var(--green-d); border-top: 1px solid var(--line); padding-top: 6px; }
.summen dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summen dt { color: var(--ink2); }
dialog { border: 0; border-radius: 18px; padding: 18px; max-width: min(420px, calc(100% - 28px)); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(40, 35, 25, .45); }
dialog h2 { font-size: 18px; margin-bottom: 6px; }

@media (min-width: 900px) {
  .ed-werte { grid-template-columns: 110px 120px 130px 100px; justify-content: end; }
  .ed-fuss { margin: 0 -24px -28px; bottom: 0; }
  .inhalt { max-width: 900px; }
}

/* ---------- Seitenleiste links (wie MeinBüro-Favoriten) – ersetzt die Leiste unten ---------- */
:root { --rand: 72px; }
body { padding-bottom: 0; padding-left: calc(var(--rand) + env(safe-area-inset-left, 0px)); }
.tabbar.seitenleiste {
  top: 0; bottom: 0; left: 0; right: auto; width: calc(var(--rand) + env(safe-area-inset-left, 0px)); height: auto;
  flex-direction: column; justify-content: flex-start; gap: 2px; border-top: 0; border-right: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 4px calc(10px + var(--unten)) calc(4px + env(safe-area-inset-left, 0px));
  overflow-y: auto; scrollbar-width: none;
}
.tabbar.seitenleiste::-webkit-scrollbar { display: none; }
.seitenleiste a { flex: 0 0 auto; padding: 6px 0 5px; font-size: 10.5px; line-height: 1.15; text-align: center; border-radius: 12px; }
.seitenleiste .tb { width: 48px; height: 30px; }
.seitenleiste .sl-logo { padding: 2px 0 8px; }
.seitenleiste .sl-logo img { width: 60px; height: auto; display: block; margin: 0 auto; border-radius: 8px; }
.seitenleiste .sl-neu { color: var(--green-d); }
.seitenleiste .sl-neu .tb { background: var(--green); color: #FFFDF9; }
.ed-fuss { bottom: 0; }
.aktion { bottom: 0; }

@media (min-width: 900px) {
  :root { --rand: 210px; }
  body { padding-left: var(--rand); }
  .tabbar.seitenleiste { width: var(--rand); padding: 14px 12px; gap: 3px; }
  .seitenleiste a { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14.5px; text-align: left; padding: 6px 8px; }
  .seitenleiste a:hover { background: var(--sand); }
  .seitenleiste .tb { width: 38px; height: 34px; border-radius: 10px; flex: 0 0 38px; }
  .seitenleiste .aktiv { background: var(--green-tint); }
  .seitenleiste .sl-logo { padding: 0 0 12px; }
  .seitenleiste .sl-logo img { width: 150px; }
  .seitenleiste .sl-neu { background: var(--green); color: #FFFDF9; font-weight: 700; margin-bottom: 8px; }
  .seitenleiste .sl-neu:hover { background: var(--green-d); }
  .seitenleiste .sl-neu .tb { background: transparent; }
  .appbar { padding-left: 24px; }
}
.ed-fuss .knoepfe { flex-wrap: nowrap; }
.ed-fuss .knoepfe .btn { flex: 1 1 0; min-width: 0; min-height: 48px; font-size: 15px; padding: 0 8px; gap: 6px; }

/* ---------- PC: mehr Breite + Editor als Tabelle (eine Zeile je Position) ---------- */
.ed-akt { display: flex; gap: 8px; }
.ed-tabkopf { display: none; }
@media (min-width: 900px) {
  .inhalt { max-width: 1200px; }
  body.breit .inhalt { max-width: 1560px; }
  body.breit .ed-fuss .zeile, body.breit .ed-fuss .knoepfe { max-width: 1512px; }
  body.breit .ed-fuss .knoepfe { justify-content: flex-end; }
  body.breit .ed-fuss .knoepfe .btn { flex: 0 0 220px; }

  .ed-tabelle { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .ed-tabkopf, .ed-pos li {
    display: grid; align-items: center; column-gap: 8px;
    grid-template-columns: 30px 104px minmax(220px, 1fr) 92px 92px 108px 80px 104px 104px 116px;
  }
  .ed-tabkopf { padding: 8px 12px; background: var(--green); color: #FFFDF9; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
  .ed-tabkopf .re { text-align: right; }
  .ed-pos { gap: 0; }
  .ed-pos:empty { display: none; }
  .ed-pos li { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 5px 12px; gap: 0 8px; }
  .ed-pos li:first-child { border-top: 0; }
  .ed-pos li:nth-child(even):not(.text) { background: #FBF7EF; }
  .ed-pos li > .ed-kopf, .ed-pos li > .ed-werte, .ed-pos li > .ed-summe { display: contents; }
  .ed-pos li > * , .ed-pos li .ed-kopf > *, .ed-pos li .ed-werte > *, .ed-pos li .ed-summe > * { grid-row: 1; }
  .ed-pos .posnr { grid-column: 1; }
  .ed-pos .artnr { grid-column: 2; justify-self: start; }
  .ed-pos .ed-bez { grid-column: 3; min-height: 36px !important; padding: 6px 9px !important; font-size: 15px !important; resize: none; }
  .ed-pos .ed-werte label { font-size: 0; gap: 0; }
  .ed-pos .ed-werte label:nth-child(1) { grid-column: 4; }
  .ed-pos .ed-werte label:nth-child(2) { grid-column: 5; }
  .ed-pos .ed-werte label:nth-child(3) { grid-column: 6; }
  .ed-pos .ed-werte label:nth-child(4) { grid-column: 7; }
  .ed-pos .ed-werte input, .ed-pos .ed-werte select { min-height: 38px; padding: 6px 8px; }
  .ed-pos .ed-summe span { display: none; }
  .ed-pos .ed-summe b { grid-column: 8; text-align: right; }
  .ed-pos .quelle { grid-column: 9; justify-self: start; }
  .ed-pos .platz { display: none; }
  .ed-pos .ed-akt { grid-column: 10; justify-content: flex-end; gap: 6px; }
  .ed-pos .ed-akt button { width: 32px; height: 32px; }
  .ed-pos li.text { background: var(--green-tint); }
  .ed-pos li.text .ed-bez { grid-column: 2 / 10; font-weight: 700; }
}
@media (max-width: 899px) {
  .ed-kopf { gap: 6px; min-width: 0; }
  .ed-kopf .ed-akt { gap: 5px; flex: 0 0 auto; }
  .ed-kopf button { width: 30px; height: 30px; }
  .ed-kopf .quelle { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

/* ---------- Rechtsklick-Menü ---------- */
.kontextmenue { position: fixed; z-index: 95; background: var(--card); border: 1px solid var(--beige-d); border-radius: 12px; box-shadow: 0 8px 30px rgba(40,35,25,.22); padding: 5px; min-width: 210px; display: flex; flex-direction: column; }
.kontextmenue[hidden] { display: none; }
.kontextmenue button { all: unset; cursor: pointer; padding: 10px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.kontextmenue button:hover, .kontextmenue button:focus-visible { background: var(--green-tint); color: var(--green-d); }
.marke.ls { background: var(--earth-tint); color: var(--earth); }
