/* Farben aus drklein-wowi.de (nur intern für dieses Gespräch) + erfundene Genossenschaftsfarbe */
:root {
  --dkw-navy: #282d50;
  --dkw-navy-dark: #1c233e;
  --dkw-blue: #1446ff;
  --dkw-blue-hover: #002ac7;
  --dkw-red: #f01e3c;
  --dkw-orange: #ff8200;
  --dkw-bg: #f7f7f7;
  --dkw-line: #dadada;
  --dkw-soft: #e9eaee;
  --white: #ffffff;
  --linde: #2f6b4f;
  --linde-soft: #e8f3ec;
  --mehr: #c25e00;      /* Orange, abgedunkelt für Text-Kontrast */
  --weniger: #1446ff;
  --text-2: #565b78;
  --radius-l: 18px;
  --radius-s: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--dkw-navy);
  background: var(--dkw-bg);
}
button, select, input, textarea { font: inherit; color: inherit; }
a { color: var(--dkw-blue); }
:focus-visible { outline: 3px solid var(--dkw-blue); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Demo-Leiste (für Markus, nicht Teil der Mieteransicht) ---------- */
.demobar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 8px 16px;
  background: var(--dkw-navy-dark); color: var(--white);
  font-size: 14px;
}
.demobar__brand { display: flex; align-items: center; gap: 12px; }
.demobar__logo { height: 14px; width: auto; }
.demobar__hint { color: #ffd2d9; font-weight: 600; }
.demobar__nav { display: flex; gap: 4px; flex-wrap: wrap; }
.demobar__nav a {
  color: #c9cce0; text-decoration: none; padding: 6px 10px; border-radius: 999px;
}
.demobar__nav a[aria-current='page'] { background: var(--white); color: var(--dkw-navy); font-weight: 600; }
.demobar__ctl { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.demobar__select { display: flex; align-items: center; gap: 8px; }
.demobar__select select {
  background: var(--dkw-navy); color: var(--white); border: 1px solid #4a5080; border-radius: 8px; padding: 4px 8px; font-size: 14px; max-width: 64vw;
}
.kistatus { padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.kistatus--an { background: #1f7a4f; }
.kistatus--aus { background: var(--dkw-orange); color: var(--dkw-navy-dark); }

/* ---------- Papierabrechnung ---------- */
.desk { padding: 32px 16px 64px; display: grid; justify-items: center; gap: 16px; }
.desk__tipp { font-size: 15px; color: var(--text-2); text-align: center; max-width: 62ch; }
.paper {
  position: relative;
  width: min(100%, 820px);
  background: #fff;
  padding: 48px 56px 40px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px; line-height: 1.4; color: #222;
  box-shadow: 0 1px 2px rgba(20, 25, 60, .08), 0 18px 40px -18px rgba(20, 25, 60, .35);
  transform: rotate(-0.4deg);
}
.paper__kopf { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.paper__absender { display: flex; gap: 12px; align-items: center; }
.paper__absender img { width: 44px; height: 44px; }
.paper__absender strong { display: block; font-size: 15px; color: var(--linde); }
.paper__absender small { color: #666; }
.paper__zeile { font-size: 9.5px; color: #666; border-bottom: 1px solid #999; display: inline-block; margin: 28px 0 4px; }
.paper__anschrift { line-height: 1.5; }
.paper__meta { margin-top: 18px; display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; font-size: 12px; }
.paper h1 { font-size: 17px; margin: 22px 0 4px; }
.paper table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 11.5px; }
.paper th, .paper td { padding: 4px 6px; border-bottom: 1px solid #ddd; text-align: left; vertical-align: top; }
.paper th { background: #f1f1f1; font-weight: 700; }
.paper td.num, .paper th.num { text-align: right; white-space: nowrap; }
.paper tfoot td { font-weight: 700; border-bottom: 0; }
.paper tfoot tr.erg td { font-size: 14px; border-top: 2px solid #222; }
.paper__fuss { margin-top: 24px; display: flex; justify-content: space-between; font-size: 10px; color: #777; }
.paper__text { margin-top: 14px; font-size: 12px; }

.qr {
  flex: 0 0 auto;
  display: grid; justify-items: center; gap: 6px;
  width: 168px; padding: 10px; border: 1.5px solid #222; border-radius: 6px;
  background: #fff; cursor: pointer; text-align: center; font-size: 11px; line-height: 1.3;
  font-family: Arial, Helvetica, sans-serif;
  position: relative; overflow: hidden;
}
.qr:hover { border-color: var(--dkw-blue); }
.qr__code { width: 128px; height: 128px; }
.qr__code img, .qr__code canvas { width: 128px !important; height: 128px !important; }
.qr strong { font-size: 12px; }
.qr__laser {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--dkw-red); box-shadow: 0 0 12px 3px rgba(240, 30, 60, .55);
  opacity: 0; pointer-events: none;
}
.qr.scanning .qr__laser { animation: scan .7s ease-in-out 1; }
@keyframes scan { 0% { top: 0; opacity: 1; } 100% { top: calc(100% - 3px); opacity: 1; } }
.qr__lan { font-size: 10px; color: #666; word-break: break-all; }

/* ---------- Mieteransicht ---------- */
.mieter { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; }
.app-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 12px;
}
.app-kopf__vm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-kopf__vm img { width: 40px; height: 40px; flex: none; }
.app-kopf__vm strong { display: block; font-size: 16px; line-height: 1.2; }
.app-kopf__vm small { color: var(--text-2); font-size: 12px; }
.lang select {
  appearance: none; border: 1.5px solid var(--dkw-line); background: var(--white);
  border-radius: 999px; padding: 8px 32px 8px 14px; font-weight: 600; font-size: 15px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dkw-navy) 50%), linear-gradient(135deg, var(--dkw-navy) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
[dir='rtl'] .lang select { padding: 8px 14px 8px 32px; background-position: 17px 50%, 12px 50%; }

.ergebnis { padding: 12px 0 24px; }
.ergebnis h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; font-weight: 700; }
.ergebnis__wo { color: var(--text-2); font-size: 16px; margin: 0; }
.ergebnis__zahl {
  margin-top: 20px;
  display: grid; gap: 2px;
}
.ergebnis__label { font-size: 17px; font-weight: 600; }
.ergebnis__betrag { font-size: clamp(48px, 15vw, 72px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ergebnis__betrag.nach { color: var(--dkw-red); }
.ergebnis__betrag.gut { color: var(--linde); }
.ergebnis__sub { color: var(--text-2); font-size: 15px; }

.block { margin-top: 28px; }
.block > h2 { font-size: 20px; margin: 0 0 6px; line-height: 1.3; }
.block > .sub { margin: 0 0 14px; color: var(--text-2); font-size: 15px; }

.kurz {
  background: var(--dkw-navy); color: var(--white);
  border-radius: var(--radius-l); padding: 22px 20px 18px;
}
.kurz h2 { font-size: 17px; margin: 0 0 10px; color: #c9cce0; font-weight: 600; }
.kurz__text { font-size: 19px; line-height: 1.55; margin: 0; }
.kurz__fuss { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.kurz__quelle { font-size: 13px; color: #aab0d4; }
.kurz__quelle.laeuft::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dkw-orange); margin-inline-end: 6px; animation: puls 1s infinite alternate; }
@keyframes puls { from { opacity: .3; } to { opacity: 1; } }
.btn-vorlesen {
  border: 1.5px solid #6a70a0; background: transparent; color: var(--white);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* Wasserfall */
.wf { background: var(--white); border-radius: var(--radius-l); padding: 8px 0; border: 1px solid var(--dkw-soft); }
.wf__row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 86px; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px; border: 0; background: none; text-align: start; cursor: pointer;
  font-size: 15px; line-height: 1.25;
}
button.wf__row:hover { background: #f3f4f8; }
.wf__row--total { cursor: default; font-weight: 700; }
.wf__row--total + .wf__row:not(.wf__row--total) { border-top: 1px solid var(--dkw-soft); }
.wf__name { overflow-wrap: anywhere; }
.wf__track { position: relative; height: 18px; }
.wf__bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; min-width: 2px; }
.wf__bar--start, .wf__bar--ende { background: var(--dkw-navy); }
.wf__bar--mehr { background: var(--dkw-orange); }
.wf__bar--weniger { background: var(--weniger); }
.wf__bar--null { background: var(--dkw-line); }
.wf__val { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf__val.mehr { color: var(--mehr); font-weight: 600; }
.wf__val.weniger { color: var(--weniger); font-weight: 600; }
.wf__check { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px 6px; border-top: 1px solid var(--dkw-soft); font-size: 14px; color: var(--text-2); }
.wf__check strong { color: var(--dkw-navy); font-variant-numeric: tabular-nums; }
[dir='rtl'] .wf__track { transform: scaleX(-1); }

/* Verbrauchsvergleich */
.vg { background: var(--white); border: 1px solid var(--dkw-soft); border-radius: var(--radius-l); padding: 18px 18px 14px; }
.vg__balken { display: grid; gap: 10px; margin: 6px 0 14px; }
.vg__zeile { display: grid; gap: 4px; font-size: 15px; }
.vg__zeile > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.vg__bar { height: 14px; border-radius: 7px; background: var(--dkw-soft); overflow: hidden; }
.vg__bar span { display: block; height: 100%; border-radius: 7px; }
.vg__einheit { font-size: 13px; color: var(--text-2); }
.vg ul { margin: 8px 0 0; padding-inline-start: 20px; }
.vg li { margin: 6px 0; }

/* Chat */
.chat { background: var(--white); border: 1px solid var(--dkw-soft); border-radius: var(--radius-l); padding: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--dkw-blue); color: var(--dkw-blue); background: var(--white);
  border-radius: 999px; padding: 8px 14px; font-size: 15px; cursor: pointer; text-align: start; line-height: 1.3;
}
.chip:hover { background: #eef1ff; }
.verlauf { display: grid; gap: 12px; margin: 14px 0; }
.verlauf:empty { display: none; }
.msg { max-width: 92%; padding: 12px 14px; border-radius: 16px; font-size: 17px; line-height: 1.5; }
.msg--frage { justify-self: end; background: var(--dkw-blue); color: var(--white); border-end-end-radius: 4px; }
.msg--ki { justify-self: start; background: var(--dkw-soft); border-end-start-radius: 4px; }
.msg--warte { color: var(--text-2); font-style: italic; }
.msg__quellen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quelle { font-size: 13px; background: var(--white); border: 1px solid var(--dkw-line); border-radius: 6px; padding: 2px 8px; color: var(--text-2); }
.msg__fuss { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.msg__herkunft { font-size: 12px; color: var(--text-2); }
.btn-mini { border: 0; background: none; color: var(--dkw-blue); font-size: 14px; font-weight: 600; padding: 2px 0; cursor: pointer; }
.btn-weiter { margin-top: 10px; }
.eingabe { display: flex; gap: 8px; margin-top: 12px; }
.eingabe input {
  flex: 1; min-width: 0; border: 1.5px solid var(--dkw-line); border-radius: 12px; padding: 12px 14px; font-size: 17px; background: var(--white);
}
.chat__hinweis { font-size: 13px; color: var(--text-2); margin: 10px 0 0; }

/* Buttons */
.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 16px; cursor: pointer;
  background: var(--dkw-blue); color: var(--white);
}
.btn:hover { background: var(--dkw-blue-hover); }
.btn--leise { background: var(--dkw-soft); color: var(--dkw-navy); }
.btn--leise:hover { background: #dcdee6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Aktionen */
.aktionen { display: grid; gap: 10px; }
.aktion {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--dkw-line); border-radius: 14px;
  background: var(--white); cursor: pointer; text-align: start;
}
.aktion:hover { border-color: var(--dkw-blue); }
.aktion__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #eef1ff; color: var(--dkw-blue); }
.aktion strong { display: block; font-size: 17px; }
.aktion small { color: var(--text-2); font-size: 14px; }
.aktion__pfeil { color: var(--dkw-blue); font-size: 22px; }
[dir='rtl'] .aktion__pfeil { transform: scaleX(-1); }

.kontakt { margin-top: 28px; display: grid; gap: 4px; font-size: 15px; }
.kontakt strong { font-size: 16px; }
.recht { margin-top: 20px; font-size: 14px; color: var(--text-2); border-inline-start: 3px solid var(--dkw-line); padding-inline-start: 12px; }
.fuss { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--dkw-line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.fuss__demo { color: var(--dkw-red); font-weight: 600; }

/* ---------- Bottom-Sheet / Dialog ---------- */
.sheet {
  width: min(100%, 640px); max-height: 92vh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 22px 22px 0 0; background: var(--white); color: var(--dkw-navy);
}
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 22px; } }
.sheet::backdrop { background: rgba(28, 35, 62, .55); }
.sheet[open] { animation: hoch .22s ease-out; }
@keyframes hoch { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__inhalt { padding: 22px 20px 24px; overflow: auto; max-height: 92vh; }
.sheet__kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet h2 { font-size: 21px; margin: 0 0 4px; line-height: 1.3; }
.sheet .sub { color: var(--text-2); font-size: 15px; margin: 0 0 16px; }
.x { border: 0; background: var(--dkw-soft); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; flex: none; }
.rechnung { display: grid; gap: 0; border: 1px solid var(--dkw-soft); border-radius: 14px; overflow: hidden; margin: 8px 0 16px; }
.rechnung__z { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; font-size: 16px; }
.rechnung__z + .rechnung__z { border-top: 1px solid var(--dkw-soft); }
.rechnung__z span:last-child { font-variant-numeric: tabular-nums; text-align: end; font-weight: 600; white-space: nowrap; }
.rechnung__z.op { color: var(--text-2); font-size: 15px; }
.rechnung__z.summe { background: var(--dkw-navy); color: var(--white); font-weight: 700; font-size: 18px; }
.formel { font-size: 15px; background: #f3f4f8; border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.hinweis-gen { font-size: 15px; background: var(--linde-soft); border-radius: 12px; padding: 12px 14px; }
.hinweis-gen strong { display: block; font-size: 13px; color: var(--linde); margin-bottom: 4px; }
.auswahl { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.auswahl label { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--dkw-line); border-radius: 12px; padding: 10px 14px; cursor: pointer; font-size: 16px; }
.auswahl input:checked + span { font-weight: 700; }
.auswahl label:has(input:checked) { border-color: var(--dkw-blue); background: #eef1ff; }
.checkliste { display: grid; gap: 6px; margin: 6px 0 14px; }
.checkliste label { display: flex; gap: 10px; align-items: center; font-size: 16px; padding: 4px 0; }
.checkliste input, .auswahl input { width: 20px; height: 20px; accent-color: var(--dkw-blue); }
.sheet__aktionen { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Nachrichten-Vorschau (so käme es im Nachrichtencenter an) */
.nc { border: 1px solid #c9ccd8; border-radius: 12px; overflow: hidden; font-size: 14px; direction: ltr; text-align: left; }
.nc__kopf { background: var(--dkw-navy); color: var(--white); padding: 10px 14px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.nc__kopf strong { font-size: 14px; }
.nc dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; }
.nc dt, .nc dd { margin: 0; padding: 7px 14px; border-bottom: 1px solid var(--dkw-soft); }
.nc dt { color: var(--text-2); background: #fafafc; }
.nc dd { font-weight: 600; overflow-wrap: anywhere; }
.nc__text { padding: 12px 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.nc__herkunft { padding: 0 14px 10px; font-size: 12px; color: var(--text-2); }
.json { margin-top: 10px; font-size: 13px; }
.json pre { background: var(--dkw-navy-dark); color: #dfe3ff; padding: 12px; border-radius: 10px; overflow: auto; max-height: 260px; font-size: 12px; direction: ltr; text-align: left; }
.best { text-align: center; padding: 18px 0 6px; }
.best__haken { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--linde); color: var(--white); display: grid; place-items: center; font-size: 34px; }

/* ---------- Mitarbeiteransicht ---------- */
.wu { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.wu h1 { font-size: 24px; margin: 0 0 4px; }
.wu .sub { color: var(--text-2); margin: 0 0 20px; font-size: 15px; }
.zaehler { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.zaehler div { background: var(--white); border: 1px solid var(--dkw-soft); border-radius: 14px; padding: 14px 16px; }
.zaehler b { display: block; font-size: 30px; line-height: 1.1; }
.zaehler span { font-size: 14px; color: var(--text-2); }
.tabelle { background: var(--white); border: 1px solid var(--dkw-soft); border-radius: 14px; overflow-x: auto; }
.tabelle table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tabelle th, .tabelle td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--dkw-soft); vertical-align: top; }
.tabelle th { font-size: 13px; color: var(--text-2); font-weight: 600; background: #fafafc; }
.tabelle tr.neu td { background: #fff7ec; }
.tabelle tr[data-id] { cursor: pointer; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill--ja { background: #dff3e8; color: #1f6a43; }
.pill--nein { background: #ffe7d1; color: #8a4300; }
.wu__detail td { background: #f6f7fb; }
.wu__detail pre { margin: 0; font-size: 12px; white-space: pre-wrap; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .paper { padding: 24px 16px; transform: none; font-size: 12px; }
  .paper__kopf { flex-direction: column-reverse; align-items: stretch; }
  .qr { width: 100%; grid-template-columns: 128px 1fr; text-align: start; align-items: center; }
  .paper table { font-size: 10.5px; }
  .paper .opt { display: none; }
  .wf__row { grid-template-columns: minmax(0, 1fr) 70px 78px; font-size: 14px; padding: 9px 12px; gap: 8px; }
  .demobar__nav a { padding: 4px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Nachbesserungen schmale Bildschirme */
.app-kopf__vm strong { overflow-wrap: anywhere; }
.wf__check { flex-wrap: wrap; }
@media (max-width: 560px) {
  .demobar { position: static; }
  .demobar__hint { font-size: 12px; }
  .app-kopf__vm strong { font-size: 14px; }
  .app-kopf__vm img { width: 34px; height: 34px; }
  .lang select { padding: 7px 28px 7px 12px; font-size: 14px; max-width: 150px; }
}
@media (max-width: 560px) {
  .demobar__ctl { flex-wrap: wrap; margin-left: 0; width: 100%; }
  .demobar__select { flex: 1; min-width: 0; }
  .demobar__select select { flex: 1; min-width: 0; max-width: none; }
  .nc dl { grid-template-columns: 1fr; }
  .nc dt { padding-bottom: 0; border-bottom: 0; font-size: 12px; }
  .nc dd { padding-top: 2px; }
  .nc__kopf { flex-direction: column; gap: 2px; }
}
