/* Eigentümerportal Moritz Frank Immobilien
   Farben und Schriften nach docs/design-mfi.md. Mobil zuerst, große Schrift, starke Kontraste.
   Regel: Jede Fläche setzt ihre Schriftfarbe selbst (helle Schrift wird sonst vererbt).
   Amber-Regel: höchstens EIN amber gefüllter Knopf je Bildschirm (.knopf--haupt). */
:root {
  --night: #07101F; --navy: #0B1D3A; --brand: #00255B; --brand-2: #1C3F73;
  --ice: #EEF2F7; --paper: #F7F9FC; --card: #FFFFFF;
  --text: #0F1A2B; --muted: #44566E; --on-dark: #EAF0F8; --on-dark-muted: #9DB0C8;
  --amber: #F2A93B; --amber-soft: #FFD48A; --brick: #9C5A48; --line: rgba(255,255,255,.12);
  --linie-hell: #C9D3E0; --linie-zart: #E1E7EF; --amber-hell: #FFF4E0;
  --font-head: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 30px 60px -30px rgba(7, 16, 31, .6);
  --schatten-klein: 0 1px 2px rgba(7, 16, 31, .06), 0 6px 20px -12px rgba(7, 16, 31, .25);
  --kopf-hoehe: 72px;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; } /* 18 px Grundschrift */
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--text); font-family: var(--font-body);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}
body.modal-offen { overflow: hidden; }
img, svg { max-width: 100%; }
a { color: var(--brand-2); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--brand); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; border-radius: 4px; }
.dunkel :focus-visible { outline-color: var(--amber); }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; }
.vorzeile { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .22em; font-size: .7rem; color: var(--brand-2); margin: 0 0 .4rem; }
.dunkel .vorzeile { color: var(--amber); }

.sprungmarke { position: absolute; left: -9999px; top: 8px; z-index: 300; background: var(--amber); color: var(--night); padding: 10px 16px; border-radius: 8px; font-weight: 700; }
.sprungmarke:focus { left: 8px; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 50; height: var(--kopf-hoehe);
  background: var(--night); color: var(--on-dark); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
}
.kopf__marke { display: flex; align-items: center; gap: 12px; color: var(--on-dark); text-decoration: none; min-width: 0; }
.kopf__marke .logo-svg { height: 46px; width: auto; flex-shrink: 0; }
.kopf__bereich { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .18em; font-size: .62rem; color: var(--on-dark-muted); border-left: 1px solid var(--line); padding-left: 12px; line-height: 1.3; }
.kopf__rechts { display: flex; align-items: center; gap: 8px; }
.kopf__knopf {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 8px 14px; border-radius: 12px;
  background: transparent; color: var(--on-dark); border: 2px solid var(--on-dark-muted); font-weight: 700; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.kopf__knopf:hover { border-color: var(--on-dark); color: #fff; }
.kopf__knopf--notfall { border-color: var(--amber); color: var(--amber-soft); }
.kopf__knopf--notfall:hover { color: var(--night); background: var(--amber-soft); border-color: var(--amber-soft); }

.logo-svg .logo-name { font-family: var(--font-head); }
.logo-svg .logo-sub { font-family: var(--font-mono); }
.logo-svg--hell .logo-name { fill: var(--on-dark); }
.logo-svg--hell .logo-sub { fill: var(--on-dark-muted); }
.logo-svg--dunkel .logo-name { fill: var(--text); }
.logo-svg--dunkel .logo-sub { fill: var(--muted); }

/* ---------- Rahmen: Menü + Inhalt ---------- */
.rahmen { flex: 1; display: flex; align-items: stretch; width: 100%; }
.menue {
  position: fixed; inset: var(--kopf-hoehe) 0 0 0; z-index: 40; overflow-y: auto;
  background: var(--navy); color: var(--on-dark); padding: 16px 16px 32px; display: none;
}
.menue.offen { display: block; }
.menue__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.menue__link {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 14px; border-radius: 12px;
  color: var(--on-dark); text-decoration: none; font-weight: 600; font-size: 1.02rem;
}
.menue__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menue__link[aria-current="page"] { background: rgba(242, 169, 59, .14); color: var(--amber-soft); box-shadow: inset 4px 0 0 var(--amber); }
.menue__icon { width: 26px; text-align: center; font-size: 1.15rem; color: var(--amber); flex-shrink: 0; }
.menue__trenner { height: 1px; background: var(--line); margin: 14px 4px; }
.menue__person { color: var(--on-dark-muted); font-size: .85rem; padding: 4px 14px 10px; }
.menue__person b { color: var(--on-dark); display: block; font-size: 1rem; }
.menue__abmelden { width: 100%; justify-content: flex-start; }

.notfallblock { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--brand); color: var(--on-dark); }
.notfallblock h2 { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; color: var(--amber); margin: 0 0 8px; font-weight: 500; }
.notfallblock p { margin: 0 0 10px; color: var(--on-dark); font-size: .92rem; }
.notfallblock .tel { display: block; font-family: var(--font-head); font-size: 1.9rem; line-height: 1.15; color: var(--amber-soft); text-decoration: none; margin: 2px 0 10px; }
.notfallblock .tel:hover { text-decoration: underline; }
.notfallblock ul { list-style: none; margin: 0 0 10px; padding: 0; font-size: .92rem; }
.notfallblock li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); color: var(--on-dark); }
.notfallblock li a { color: var(--amber-soft); font-weight: 700; white-space: nowrap; }
.notfallblock .notfallblock__mehr { color: var(--on-dark); font-weight: 700; }

.inhalt { flex: 1; min-width: 0; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.inhalt:focus { outline: none; }

/* ---------- Seitenkopf ---------- */
.seitenkopf { margin: 4px 0 22px; }
.seitenkopf__zurueck { display: inline-block; margin-bottom: 10px; font-weight: 700; }
.seitenkopf__titel { font-family: var(--font-head); font-weight: 400; font-size: 2.3rem; margin: 0 0 8px; color: var(--text); letter-spacing: -.01em; }
.seitenkopf__titel:focus { outline: none; }
.seitenkopf__text { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 46em; }

/* ---------- Karten ---------- */
.karte { background: var(--card); color: var(--text); border: 1px solid var(--linie-zart); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--schatten-klein); }
.karte__titel { font-family: var(--font-head); font-weight: 400; font-size: 1.55rem; margin: 0 0 12px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.karte__icon { color: var(--brand-2); font-family: var(--font-body); font-size: 1.2rem; }
.karte__inhalt > :first-child { margin-top: 0; }
.karte__inhalt > :last-child { margin-bottom: 0; }
.karte__aktionen { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.karte--hell { background: var(--ice); border-color: var(--linie-zart); box-shadow: none; }
.karte--dunkel, .karte--notfall { color: var(--on-dark); border-color: transparent; box-shadow: var(--shadow); }
.karte--dunkel { background: var(--navy); }
.karte--notfall { background: var(--brand); }
.karte--dunkel .karte__titel, .karte--notfall .karte__titel { color: var(--on-dark); }
.karte--dunkel .karte__icon, .karte--notfall .karte__icon { color: var(--amber); }
.karte--dunkel p, .karte--notfall p, .karte--dunkel li, .karte--notfall li { color: var(--on-dark); }
.karte--dunkel a:not(.knopf), .karte--notfall a:not(.knopf) { color: var(--amber-soft); }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 22px;
  border-radius: 12px; border: 2px solid transparent; font-weight: 700; font-size: 1rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; text-align: center; transition: background .15s, color .15s, border-color .15s;
}
.knopf:disabled, .knopf[aria-busy="true"] { opacity: .6; cursor: progress; }
.knopf--haupt { background: var(--amber); color: var(--night); border-color: var(--amber); }
.knopf--haupt:hover { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--night); }
.knopf--zweit { background: transparent; color: var(--brand-2); border-color: var(--brand-2); }
.knopf--zweit:hover { background: var(--ice); color: var(--brand); }
.knopf--text { background: transparent; color: var(--brand-2); border-color: transparent; text-decoration: underline; padding-left: 8px; padding-right: 8px; }
.knopf--gefahr { background: transparent; color: var(--brick); border-color: var(--brick); }
.knopf--gefahr:hover { background: #F8EDEA; }
.dunkel .knopf--zweit, .karte--dunkel .knopf--zweit, .karte--notfall .knopf--zweit { color: var(--on-dark); border-color: var(--on-dark-muted); }
.dunkel .knopf--zweit:hover, .karte--dunkel .knopf--zweit:hover, .karte--notfall .knopf--zweit:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.dunkel .knopf--text, .karte--dunkel .knopf--text, .karte--notfall .knopf--text { color: var(--on-dark); }
.knopf__icon { font-size: 1.1em; }

/* ---------- Hinweise ---------- */
.hinweis { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; margin: 0 0 16px; border: 1px solid var(--linie-hell); border-left-width: 6px; background: var(--card); color: var(--text); }
.hinweis__icon { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .95rem; }
.hinweis__text { flex: 1; min-width: 0; }
.hinweis__text > :first-child { margin-top: 0; } .hinweis__text > :last-child { margin-bottom: 0; }
.hinweis--info { border-left-color: var(--brand-2); background: var(--ice); }
.hinweis--info .hinweis__icon { background: var(--brand-2); color: #fff; }
.hinweis--erfolg { border-left-color: var(--brand-2); background: #EAF1FA; }
.hinweis--erfolg .hinweis__icon { background: var(--brand); color: #fff; }
.hinweis--warnung { border-left-color: var(--amber); background: var(--amber-hell); }
.hinweis--warnung .hinweis__icon { background: var(--amber); color: var(--night); }
.hinweis--fehler { border-left-color: var(--brick); background: #FBF1EE; }
.hinweis--fehler .hinweis__icon { background: var(--brick); color: #fff; }
.hinweis--fehler .hinweis__text { color: var(--text); }

.abzeichen { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle; border: 1px solid transparent; white-space: nowrap; }
.abzeichen--neutral { background: var(--ice); color: var(--muted); border-color: var(--linie-zart); }
.abzeichen--marke { background: var(--brand-2); color: #fff; }
.abzeichen--amber { background: var(--amber-hell); color: var(--text); border-color: var(--amber); }
.abzeichen--warnung { background: #FBF1EE; color: var(--brick); border-color: var(--brick); }

.laden { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 28px 4px; }
.laden__kreis { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--linie-hell); border-top-color: var(--brand-2); animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .laden__kreis { animation: none; } * { transition: none !important; } }
.leer { text-align: center; color: var(--muted); padding: 32px 12px; background: var(--card); border: 1px dashed var(--linie-hell); border-radius: var(--radius); }
.leer p { margin: 0 0 12px; }

/* ---------- Kacheln ---------- */
.kacheln { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 22px; }
.kachel {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; min-height: 92px; border-radius: var(--radius);
  background: var(--card); color: var(--text); border: 1px solid var(--linie-zart); box-shadow: var(--schatten-klein);
  text-decoration: none; position: relative;
}
.kachel:hover { border-color: var(--brand-2); color: var(--text); }
.kachel__icon { font-size: 1.4rem; color: var(--brand-2); line-height: 1; margin-bottom: 4px; }
.kachel__titel { font-weight: 800; font-size: 1.08rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.kachel__text { color: var(--muted); font-size: .92rem; }
.kachel__zaehler { background: var(--brick); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 8px; }
.kachel--notfall { background: var(--brand); color: var(--on-dark); border-color: transparent; }
.kachel--notfall .kachel__titel { color: var(--on-dark); }
.kachel--notfall .kachel__text { color: var(--on-dark-muted); }
.kachel--notfall .kachel__icon { color: var(--amber); }

/* ---------- Formulare ---------- */
.formular { display: grid; gap: 18px; max-width: 640px; }
.feld { display: grid; gap: 6px; }
.feld__label { font-weight: 700; color: var(--text); margin: 0; }
.feld__pflicht { color: var(--brick); }
.feld__hilfe { margin: 0; color: var(--muted); font-size: .9rem; }
.feld input:not([type="checkbox"]):not([type="radio"]), .feld select, .feld textarea {
  width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--linie-hell);
  background: #fff; color: var(--text); font-size: 1.05rem;
}
.feld textarea { min-height: 140px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus { border-color: var(--brand-2); outline: 3px solid rgba(28, 63, 115, .25); outline-offset: 0; }
.feld input[readonly], .feld textarea[readonly] { background: var(--ice); }
.feld--check label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 600; }
.feld--check input, .formular__radio input { width: 26px; height: 26px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--brand-2); }
.formular__radios { display: grid; gap: 8px; }
.formular__radio { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--linie-hell); border-radius: 10px; cursor: pointer; background: #fff; }
.formular__radio:has(input:checked) { border-color: var(--brand-2); background: var(--ice); }
.formular__knoepfe { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.formular__meldung:empty { display: none; }
.passwortregeln { margin: 0; padding-left: 0; list-style: none; font-size: .92rem; color: var(--muted); display: grid; gap: 4px; }
.passwortregeln li::before { content: '○ '; color: var(--muted); }
.passwortregeln li.erfuellt { color: var(--text); }
.passwortregeln li.erfuellt::before { content: '✓ '; color: var(--brand-2); font-weight: 800; }

/* ---------- Tabelle ---------- */
.tabelle { overflow-x: auto; background: var(--card); border: 1px solid var(--linie-zart); border-radius: var(--radius); }
.tabelle table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th { text-align: left; font-size: .85rem; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 2px solid var(--linie-zart); background: var(--ice); }
.tabelle td { padding: 12px 14px; border-bottom: 1px solid var(--linie-zart); vertical-align: top; color: var(--text); }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .rechts { text-align: right; white-space: nowrap; }
.tabelle tr.klickbar { cursor: pointer; }
.tabelle tr.klickbar:hover td { background: var(--paper); }
@media (max-width: 699px) {
  .tabelle { background: transparent; border: 0; }
  .tabelle table, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle thead { position: absolute; left: -9999px; }
  .tabelle tr { background: var(--card); border: 1px solid var(--linie-zart); border-radius: 12px; margin-bottom: 10px; padding: 6px 0; }
  .tabelle td { border: 0; padding: 6px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tabelle td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; }
  .tabelle .rechts { white-space: normal; }
}

/* ---------- Zeilenumbrüche in bereinigtem HTML (lib/ui.js sauberesHtml setzt diese Klassen statt style) ---------- */
.ws-pre-line { white-space: pre-line; }
.ws-pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Modal, Toast ---------- */
.modal-hinter { position: fixed; inset: 0; z-index: 200; background: rgba(7, 16, 31, .62); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; }
.modal { background: var(--card); color: var(--text); border-radius: var(--radius); width: 100%; max-width: 620px; box-shadow: var(--shadow); }
.modal__kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.modal__kopf h2 { font-family: var(--font-head); font-weight: 400; font-size: 1.6rem; margin: 0; color: var(--text); }
.modal__x { background: none; border: 0; font-size: 2rem; line-height: 1; color: var(--muted); cursor: pointer; min-width: 48px; min-height: 48px; border-radius: 10px; }
.modal__x:hover { background: var(--ice); color: var(--text); }
.modal__inhalt { padding: 6px 20px 8px; }
.modal__fuss { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; }
#toasts { position: fixed; z-index: 250; left: 12px; right: 12px; bottom: 16px; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--navy); color: var(--on-dark); padding: 14px 20px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; max-width: 520px; transition: opacity .4s, transform .4s; border-left: 6px solid var(--amber); }
.toast--fehler { border-left-color: var(--brick); }
.toast--weg { opacity: 0; transform: translateY(10px); }

/* ---------- Anmeldung ---------- */
.anmeldung { max-width: 560px; margin: 0 auto; }
.anmeldung__links { display: grid; gap: 6px; margin-top: 18px; }
.anmeldung__links a { font-weight: 700; }

/* ---------- Startseite ---------- */
.begruessung { background: var(--night); color: var(--on-dark); border-radius: var(--radius); padding: 26px 22px; margin-bottom: 22px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.begruessung::after { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(242, 169, 59, .18), transparent 70%); }
.begruessung h1 { font-family: var(--font-head); font-weight: 400; font-size: 2.3rem; margin: 0 0 6px; color: var(--on-dark); position: relative; }
.begruessung h1 em { color: var(--amber-soft); font-style: italic; }
.begruessung p { margin: 0; color: var(--on-dark-muted); max-width: 40em; position: relative; }
.abschnitt-titel { font-family: var(--font-head); font-weight: 400; font-size: 1.75rem; margin: 28px 0 12px; color: var(--text); }
.wohnungen { display: grid; gap: 12px; margin-bottom: 8px; }
.wohnung { background: var(--card); border: 1px solid var(--linie-zart); border-radius: var(--radius); padding: 18px; box-shadow: var(--schatten-klein); color: var(--text); }
.wohnung__objekt { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; color: var(--brand-2); margin: 0 0 4px; }
.wohnung__titel { font-weight: 800; font-size: 1.15rem; margin: 0 0 4px; }
.wohnung__daten { color: var(--muted); margin: 0 0 8px; font-size: .95rem; }
.wohnung__abzeichen { display: flex; flex-wrap: wrap; gap: 6px; }
.aktuelles { display: grid; gap: 0; }

/* ---------- Fuß ---------- */
.fuss { background: var(--night); color: var(--on-dark-muted); padding: 22px 16px; font-size: .88rem; }
.fuss__innen { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: space-between; }
.fuss a { color: var(--on-dark); }
.fuss nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }

.ki-kennzeichnung { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- Breitere Bildschirme ---------- */
@media (min-width: 700px) {
  .kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wohnungen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inhalt { padding: 32px 28px 72px; }
  .seitenkopf__titel, .begruessung h1 { font-size: 2.7rem; }
}
@media (min-width: 1024px) {
  .rahmen { background: linear-gradient(to right, var(--navy) 300px, transparent 300px); }
  .kopf__menueknopf { display: none; }
  .menue { position: sticky; top: var(--kopf-hoehe); display: block; width: 300px; flex-shrink: 0; height: calc(100vh - var(--kopf-hoehe)); inset: auto; border-right: 1px solid var(--line); }
  .kacheln { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inhalt { padding: 36px 40px 80px; }
}
@media (max-width: 420px) {
  .kopf__bereich { display: none; }
  .kopf__knopf { padding: 8px 10px; }
}
@media print {
  .kopf, .menue, .fuss, .sprungmarke, #toasts { display: none !important; }
  body { background: #fff; }
  .karte { box-shadow: none; border-color: #999; }
}
